Pre loader

DataPointSelectionModifier not selecting points with CategoryDateTimeAxis x-axis for points with same date

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

0
0

I have a chart with a CategoryDateTimeAxis x-axis, some of the data points that have the same date can’t be selected, and I noticed if I add points that have a different date, the selection works as expected.

It seems that the DataPointSelectionModifier.SelectionChanged even is fired but the DataPointSelectionModifier.SelectedPointMarkers collection is empty

private void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
// Create the X and Y Axis
var xAxis = new CategoryDateTimeAxis() { AxisTitle = "Date", TextFormatting = "dd/MM/yyyy" };
var yAxis = new NumericAxis() { AxisTitle = "Value" };

var selectionModifier = new DataPointSelectionModifier()
{
ReceiveHandledEvents = true,
AllowsMultiSelection = false,
ExecuteOn = ExecuteOn.MouseLeftButton,
UseLayoutRounding = true
};

selectionModifier.SelectionChanged += SelectionModifier_SelectionChanged;

SciChartSurface.XAxis = xAxis;
SciChartSurface.YAxis = yAxis;

SciChartSurface.ChartModifier = new ModifierGroup(
new RubberBandXyZoomModifier(),
new ZoomExtentsModifier(),
selectionModifier);

var series = new XyDataSeries<DateTime, double>();

for (int i = 0; i < 20; i++)
{
    var date = i < 10 ? DateTime.Now.AddDays(i) : DateTime.Now.AddDays(10);
    series.Append(date, i, new SelectedPointMetadata());
}

var renderableSeries = new FastLineRenderableSeries()
{
    DataSeries = series,
    XAxis = xAxis,
    YAxis = yAxis,
    PointMarker = new EllipsePointMarker() { Width = 10, Height = 10, Fill = Colors.Red },
    SelectedPointMarker = new EllipsePointMarker() { Width = 10, Height = 10, Fill = Colors.Green },
};
SciChartSurface.RenderableSeries.Add(renderableSeries);
}

private void SelectionModifier_SelectionChanged(object? sender, EventArgs e)
{

if (sender is not DataPointSelectionModifier dataPointSelectionModifier)
{
    return;
}

var dataPointInfo = dataPointSelectionModifier.SelectedPointMarkers.FirstOrDefault();
if (dataPointInfo is null)
{
    return;
}

var metaData = dataPointInfo.DataPointMetadata as SelectedPointMetadata;

}
}

public class SelectedPointMetadata : IPointMetadata
{
public event PropertyChangedEventHandler PropertyChanged;
public bool IsSelected { get; set; }
}
Version
8.6.0.28199
  • Lex
    Hi Mohamed, Thank you for reporting this. I’m going to discuss this with our team and will get back to you with an update. Kind regards, Lex, SciChart Technical Support Engineer
  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.