Skip to content

Getting a chart as an image 3.1.x

Kevin Hill edited this page Apr 5, 2018 · 4 revisions

You can use the new png option when building your chart. Just include the png => true option as such:

$lava->LineChart('MyChart', $myDataTable, [
    'png' => true
]);

Note

Not all charts support PNG output, so a browse through the chart classes, such as AreaChart will show if they use \Khill\Lavacharts\Support\Traits\PngRenderableTrait

Disclaimer

This does not actually create a PNG and output it to the page. This is just a convenience option to not have to setup a callback and retrieve the base64 manually.