Hi,
I want to get the currently selected series like isCheckedChangedCallback in js. But there is no similar method in the documentation, how should I implement this function.
- yu dexiu asked 6 months ago
- You must login to post comments
Hi Yu Dexiu,
Thanks for your question.
There isn’t such a callback on the LegendModifier.
However, since Legend checkboxes can hide or show a RenderableSeries, you can subscribe to IsVisibleChanged event on a RenderableSeries. It will be fired when a user changes series visibility through the Legend.
Alternatively, you can re-template the default Legend and have a binding on Checkboxes that will be triggered when they are checked/unchecked.
You can find more info about Legend customization here:
https://www.scichart.com/documentation/win/current/webframe.html#LegendModifier.html
With best regards,
Lex S., MSEE
SciChart Technical Support Engineer
- Lex answered 6 months ago
- You must login to post comments
Is your question related to WPF (Windows charts) or JS (JavaScript charts)?
In SciChart.js there is a mechanism to get a callback on legend checkbox changed. See the LegendModifier documentation.
Subscribing to Checkbox Checked Changed
As well as subscribing to
BaseRenderableSeries.isVisibleChanged
, you
can now subscribe toLegendModifier.isCheckedChanged
event. This can
be done either in the constructor options toLegendModifier
or after
creation.const legend = new LegendModifier({ showCheckboxes: true, showSeriesMarkers: true, showLegend: true, // Subscribe to checked changed here isCheckedChangedCallback: (series, isChecked) => { console.log(`Option 1: Legend item ${series.type} isChecked=${isChecked}`); } }); // Or here after instantiation legend.isCheckedChanged.subscribe((args) => { console.log(`Option 2: Legend item ${args.series.type} isChecked=${args.isChecked}`); }); // Add the legend to the chart sciChartSurface.chartModifiers.add(legend);
- Andrew Burnett-Thompson answered 6 months ago
- You must login to post comments
Please login first to submit.