Selecting points in a ScatterPointSeries when using BitmapRenderOptions

1 Answer 28 Views
ChartView
Blaine
Top achievements
Rank 1
Blaine asked on 21 Dec 2023, 11:04 PM

I am currently using a RadCartesianChart and ChartSeriesProvider to display multiple ScatterPointSeries.  These series will have 10's of thousands of points in them.  The only rendering option that has worked well for this is BitmapRenderOptions. However, when using BitmapRenderOptions I can't get tooltips to show and I can't select any points.

Is this a know limitation of the BitmapRenderOptions or is there a way to get it to work?  I'm basically using the Large Data demo but trying to add a selection and tooltip behavior. 

Selection and tooltip work fine if I use the default XamlRenderOptions, but the performance is too bad to use.

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 25 Dec 2023, 04:16 PM

Hello Blaine,

The lightweight render options don't support tooltips. However, there is a feature request to allow this. You can find a custom solution in the following forum.

About the selection, this is also unsupported with the lightweight render options. Partially because the lightweight render options don't allow conditional styling of the data point visuals, which means that you cannot highlight the selection. 

To highlight data points on selection, you can use an extra chart series placed on top of the original one and add data points with different color there, on MouseLeftButtonDown. You can see this idea shown in the attached project, along with the tooltip customization. I hope this helps.

Regards,
Martin Ivanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Blaine
Top achievements
Rank 1
commented on 03 Jan 2024, 06:06 PM

Thanks Martin!  This does make selection work now, but it only works when zoomed out.  As soon as you zoom in you can't select points anymore.  I haven't been able to find a way to make selection work when zoomed in.  Do you know of a way to do this?
Martin Ivanov
Telerik team
commented on 04 Jan 2024, 12:44 PM

This doesn't work because the custom code doesn't take into account the zoom level in the chart. To make this work, you will need to add the PanOffset value of the chart in the code that checks the LayoutSlot of the data points.

 private void RadChart1_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     var chart = (RadCartesianChart) sender;
     var series = chart.Series[0] as ScatterPointSeries;
     var pos = e.GetPosition(chart);

     selectionAdornerSeries.DataPoints.Clear();
     var clickedDataPoint = series.DataPoints.OfType<ScatterDataPoint>().FirstOrDefault(x => x.LayoutSlot.Contains(pos.X - chart.PanOffset.X, pos.Y - chart.PanOffset.Y));
     if (clickedDataPoint != null)
     {
         selectionAdornerSeries.DataPoints.Add(new ScatterDataPoint() { XValue = clickedDataPoint.XValue, YValue = clickedDataPoint.YValue });
     }            
 }

 void RadChart1_MouseMove(object sender, MouseEventArgs e)
 {
     var chart = (RadCartesianChart)sender;
     var series = chart.Series[0] as ScatterPointSeries;
     var pos = e.GetPosition(chart);

     foreach (DataPoint dataPoint in series.DataPoints)
     {
         var rect = dataPoint.LayoutSlot;
         if (rect.Contains(pos.X - chart.PanOffset.X, pos.Y - chart.PanOffset.Y))
         {
             ShowToolTip(chart, dataPoint);
             return;
         }
     }

     HideToolTip();
 }

Tags
ChartView
Asked by
Blaine
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or