This is a migrated thread and some comments may be shown as answers.

Lasso and selection issues

3 Answers 94 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 1
Steve asked on 18 Apr 2016, 05:09 AM

I am using a scatter chart now, and trying to allow the user to select multiple points to turn them on or off. Using the selection mode of "MultipleDataPoints" doesn't seem to work for scatter charts the way the "documentation" implies for the pie charts. When I get the "SelectedPointChanged" event, either I don't understand the purpose of the "NewSelectedPoint" and "OldSelectedPoint", or they aren't working. Basically if I have 5 points 1,2,3,4, and 5, if I click on point 2 and then 3 it gives me new point 3 and old point 2. I would expect not to get an old point called out until I "deselect" a point. Otherwise I don't see how to accomplish what the example shows, with two points offset from the center when the multiple points is selected. Rather than banging my head against the wall on this, I used the custom renderer and hit test method on mouse down method that you showed me to fix the multiple pie selection issue, so I have it been able to accomplish what I need but I would still like to know what I am supposed to do in that situation, or if multiple data point selection is just not supported for scatter charts.

 

My more pressing issue is that I am now trying to use the lasso selection. However I don't want to zoom. I would like to override the behavior to get the lasso but then do my own action on the lasso'd points (the selection I am doing above, actually). I tried inheriting the class but all of the obvious calls that I could override had no effect.

 

Alternatively, or perhaps in addition to, I would like to know how to determine what points are in the zoomed area once lasso'd. For double bonus, I would like to be able to lasso a circle with the radius emanating from the moused down point (the radius at the mouse up point).

3 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 18 Apr 2016, 03:36 PM
Hi Steve,

Thank you for writing.

The arguments in the SelectedPointChanged event always return the currently selected point and the previous one. If the SelectionMode property is set to MultipleDataPoints, the old data point will not be removed from the SelectedPoints collection unless it is deselected. You can always access this collection and get a reference to these data points.

Regarding your other question, you would indeed need to inherit the LassoZoomController. Then you can override the OnMouseDown, OnMouseMove and OnMouseUp methods with your custom logic. You are also going to need a class responsible for rendering the circle on the chart.

I am sending you attached a sample implementation for performing a circular lasso selection. In case you are not going to need to zoom in within the chart, you can remove the logic responsible for calculating the scale factors. I am also sending you a short video showing the result on my end.

I hope this helps. Should you have further questions please do not hesitate to write back.

Regards,
Hristo Merdjanov
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Steve
Top achievements
Rank 1
answered on 18 Apr 2016, 04:30 PM
Where is the SelectedPoints collection?
0
Hristo
Telerik team
answered on 20 Apr 2016, 11:30 AM
Hello Steve,

Thank you for writing back.

The SelectedDataPoints collection is defined on the Area object of the View. It can be accessed like this: 
ChartViewSelectedDataPointCollection points = this.radChartView1.View.Area.SelectedDataPoints;

I hope this information was useful. 

Regards,
Hristo Merdjanov
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
ChartView
Asked by
Steve
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Steve
Top achievements
Rank 1
Share this question
or