-
Notifications
You must be signed in to change notification settings - Fork 140
Upgrading from 3.0 to 3.1
Kevin Hill edited this page Jan 19, 2017
·
2 revisions
Defining the element ID in which a chart will be rendered, has moved from the view into the controller. Instead of passing the element ID to the render method, it is defined in the chart options.
The reason for moving this key piece of chart rendering, is many users have asked about rendering multiple charts in a view and it was tedious to create a loop, pull chart types, titles, and elementIDs to pass to the render method.
Since all information is defined ahead of time, and all charts are stored within Lavacharts, rendering multiple charts in a view is as easy as $lava->renderAll();
// Controller
$data = $lava->DataTable();
$lava->LineChart('StockPrices', $data, [
'title' => 'Github Stock Price'
]);
// View
$lava->Render('LineChart', 'StockPrices', 'stocks-div');
// Controller
$data = $lava->DataTable();
$lava->LineChart('StockPrices', $data, [
'elementId' => 'stocks-div',
'title' => 'Github Stock Price'
]);
// View
$lava->Render('LineChart', 'StockPrices');
Complete Documentation available at lavacharts.com