Example of listening to the controlWrapper events (i.e. statechange event of chartRangeFilter)
@rakannimer could you provide an example for how to listen to the statechange event of controlWrapper (ChartRangeFilter)?
https://github.com/rakannimer/react-google-charts/issues/263 callback function doesn't have the controlWrapper to attach events. Planning to achieve below:
google.visualization.events.addListener(controlWrapper, 'statechange', eventArgs => {
});
You can listen to changes in controlWrapper using controlEvents inside controls. e.g.:
<Chart
chartType={chartType}
data={data}
options={chartOptions}
chartPackages={["corechart", "controls"]}
controls={[
{
controlEvents: [
{
eventName: "statechange",
callback: ({ controlWrapper }) => {
console.log(controlWrapper.getState());
},
},
],
controlType: "ChartRangeFilter",
options: {
filterColumnIndex: 0,
ui: {
chartType: "LineChart",
chartOptions: {
chartArea: { width: "100%", height: "70%" },
hAxis: { baselineColor: "none" },
},
},
},
controlPosition: "bottom",
controlWrapperParams: {
state: {
range: {
start: startDate,
end: endDate,
},
},
},
},
]}
/>;
But if we want to get the state inside the callback ...the controlwrapper refuse to move
But if we want to get the state inside the callback ...the controlwrapper refuse to move
how did you solve this?