Pre loader

The selected event for the LegendModifier checkbox

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

1
0

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.

Version
8.3.0
  • You must to post comments
0
0

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

  • You must to post comments
0
0

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 to LegendModifier.isCheckedChanged event. This can
be done either in the constructor options to LegendModifier 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);
  
  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.