Pre loader

Can we select multiple FastLineRenderableSeries at once using a keyboard key?

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

Answered
1
0

I intend to use the Ctrl key to allow the user to select multiple FastLineRenderableSeries at once in an onkeydown event. Is there any way to do so while maintaining the default behavior?

Note: I was able to use onSelectedChanged to select a FastLineRenderableSeries, but I was only able to select one FastLineRenderableSeries at a time.

Here’s the code that I have to generate the FastLineRenderableSeries:

let fastLineRenderableSeries = new FastLineRenderableSeries(this.wasmContextGraph, {
      dataSeries: xyDataSeries,
      id: traceId,
      xAxisId: this.sciChartGraph.xAxes.get(0).id.toString(),
      yAxisId: traceData.array[0][0],
      isVisible: true,
      isSelected: false,
      opacity: 1,
      resamplingMode: EResamplingMode.Auto,

      onSelectedChanged: (sourceSeries, isSelected) => {
        if (isSelected){
          // some unrelated functions
        } else {
          // some unrelated functions
        }
      }
  });
Version
3.0.284
  • You must to post comments
Best Answer
1
0

Hi

Unfortunately this is not particularly easy. Within the modifierMouseUp in the SeriesSelectionModifier, all series are set as unselected before the clicked series (if there is one) is set as selected. I think the simplest way to do this is to maintain your own list of selected series and reselect them when new ones are selected.

Here is one way to do it:

const selectedSeries: IRenderableSeries[] = [];
let addToSelection = false;
const ssm = new SeriesSelectionModifier({ enableHover: true, enableSelection: true, onSelectionChanged: (args) => {
    if (addToSelection) {
        for (const series of selectedSeries) {
            // Mark all previously selected series as selected
            series.isSelected = true;
        }
    } else {
        selectedSeries.length = 0;
    }
    selectedSeries.push(...args.selectedSeries);
} });
// Could do this with modifierMouseDown instead
const mmu = ssm.modifierMouseUp;
ssm.modifierMouseUp = (args) => {
    addToSelection = args.ctrlKey;
    mmu.call(ssm, args);
}
sciChartSurface.chartModifiers.add(ssm);

We will have a think about the best way of supporting this on the standard modifier at some point in the future.

Regards
David

  • Andrew Burnett-Thompson
    +1 for standard modifier, SciChart WPF has multi-select functionality via CTRL+Click
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.