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
}
}
});
- Suzanne Ong asked 8 months ago
- last edited 8 months ago
- You must login to post comments
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
- David Burleigh answered 8 months ago
-
+1 for standard modifier, SciChart WPF has multi-select functionality via CTRL+Click
- You must login to post comments
Please login first to submit.