Open romain-lgr opened 6 months ago
In the documentation of apexcharts "formatter" is a js callback function:
https://apexcharts.com/docs/options/yaxis/
It worked this example:
$options = [
'yaxis' => [
'labels' => [
'formatter: function(val, index) {
return val.toFixed(2);
}'
],
],
];
In my own code I
I too am struggling with the ->setOptions($options)
feature. I'm trying to do something similar:
$options = [
'yaxis' => [
'decimalsInFloat' => 0,
]
];
$chart = (new OriginalLineChart)
->addData('Total Viewings', $weeklyViewings)
->addData('Trend Line', $trendLine)
->setXAxis($labels)
->setGrid()
->setStroke(2, [], 'smooth')
->setHeight(300)
->setOptions($options)
;
But every time I try to do that I get Call to undefined method ArielMejiaDev\LarapexCharts\Charts\LineChart::setOptions()
If you're seeing Call to undefined method
- maybe you've got an older version installed. But, the setOptions doesn't seem to do anything, except set options within the class - but then those options aren't called on when rendering the chart.
@pandigresik made this commit: https://github.com/ArielMejiaDev/larapex-charts/commit/480d8f7df6ddb2d0086cf4f16ad638a0e2218992 to add options override support, but that didn't change the rendering of the script in https://github.com/ArielMejiaDev/larapex-charts/blob/master/stubs/resources/views/chart/script.blade.php
I'm going to try and make setOptions effective, then submit a PR.
I saw the commit, but I only installed this a couple of weeks ago. The only way that I could figure out how to change the options was to edit them directly unfortunately.
Hello!,
I am a bit struggling with the options features. I am trying to add options to my area chart like this but I can not make it work. Is it the good way to add options?
Thank you