Closed am-css closed 2 years ago
I fixed this by allowing Wrapper to extend Customizable, and then this allows setOptions() to be called on the Wrapper With this I can do this $cw = Lava::ChartWrapper($chart, 'chart') ->setOption('view', [ 'columns' => [0,2], ]);
Not sure what the implication of extending Customizable like this is, but it works for me
If I have time I may pull the code, create a branch and submit the changes
What Version? 3.1.14
Issue
Trying to build a dashboard with a data set [ 'date', 'item', 'value' ] Want a drop down selection with 'item' and to display 'date' & 'value' in a chart (any chart will do)
Google Charts API says that the ChartWrapper needs to define the data set (see https://developers.google.com/chart/interactive/docs/gallery/controls) // The chart will use the columns 'date' and 'value' // out of all the available ones. 'view': {'columns': [0, 2]}
I have been able to get this to work by editing Dashboards\Wrappers\ChartWrapper.php to hard code the relevant item to the json, overriding jsonSerialize from the parent:
I think there is additional code required to add a customize function to the Wrapper class (like the Chart class) to support this, unless someone can suggest a different mechanism