Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dashboard cannot be refreshed using js on laravel #350

Open
faten7777 opened this issue Oct 10, 2024 · 0 comments
Open

Dashboard cannot be refreshed using js on laravel #350

faten7777 opened this issue Oct 10, 2024 · 0 comments

Comments

@faten7777
Copy link

What Version?

"khill/lavacharts": "^3.1",

Issue

Dashboard cannot be refreshed using js on laravel
Error: Uncaught n.exports.ChartNotFound {name: 'ChartNotFound', message: '[Lavacharts] Chart with label "Donuts" was not found.'}

Controller Code (chart creation code)

$datatable = $lava->DataTable();
$datatable->addStringColumn('Titles')
           ->addNumberColumn('Number'); 
//get data from database 
$pieChart = $lava->PieChart('Donuts', $datatable, [
      'width' => 400,
      'pieSliceText' => 'value'
    ]);
    $filter  = $lava->NumberRangeFilter(1, [
      'ui' => [
      'labelStacking' => 'vertical'
      ]
    ]);

    $control = $lava->ControlWrapper($filter, 'control');
    $chart   = $lava->ChartWrapper($pieChart, 'chart');

    $lava->Dashboard('Donuts', $datatable)->bind($control, $chart);
$decisions = 'decisions';

 return array(
        $decisions => $chart->toJson(),
),

View Code

<div id="my-dash">
              <div id="chart">
              </div>
              <div id="control">
              </div>
            </div>

            <?= $lava->render('Dashboard', 'Donuts', 'my-dash'); ?>

<script >
//ajax call 

lava.loadData('Donuts', data.decisions, function (chart) {});
    console.log(data.decisions);


</script>

result of console log : {"options":{"width":400,"pieSliceText":"value"},"containerId":"chart","chartType":"PieChart"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant