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

Selecting a Line series

4 Answers 97 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Earnest
Top achievements
Rank 1
Earnest asked on 20 Jul 2010, 09:28 PM
Is there an event that I can register for (similiar to ItemClick) that would fire when a user clicks along a line series (i.e. along the interpolated line)? I have a chart with a line series that is in a zoomable and scrollable chart. When the user clicks the line series I would like to show some properties for it. I am not showing pointmarks so the user would more naturally click on the line segments as oppose to at a particular data point.

4 Answers, 1 is accepted

Sort by
0
Dwight
Telerik team
answered on 23 Jul 2010, 07:22 AM
Hello Earnest,

We do have such an event, it is in the ChartArea:
this.radChart1.DefaultView.ChartArea.ItemClick += new EventHandler<ChartItemClickEventArgs>(ChartArea_ItemClick);

Best,
Joshua
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Earnest
Top achievements
Rank 1
answered on 23 Jul 2010, 02:43 PM
I can get the ItemClick event if I click on a point mark, but I want an event when I click along the line stroke as in the attached image. 

I don't have point marks visible (furthermore I have removed them with a style to improve performance per this post ) so clicking the point marks is not possible nor would it make any since in my application (I am showing scientific data).

I want to be able to identify when a user clicks the series so I can grab it and change its properties such as stroke color etc.

Thanks
0
Earnest
Top achievements
Rank 1
answered on 27 Jul 2010, 03:07 PM
I understand that most of what I want to accomplish is now built in but...

I modified the Interactivity example provided. The thing that was tripping me up is that I thought that the interactivity would still work if I turned on zooming and scrolling. I have pasted the modified code below. Notice that if you uncomment the two lines in the constructor you no longer get the selection behavior. (You can still toggle selection using the legend). Is there any plan to allow the interactivity with zoom and scroll enabled?

Also, how can I get a list of currently selected series?

Can we have the ability to set the selectionscope for the series as well, meaning, allow the option to have a single series selected at one time or multiple. I can seem to do it for items but not series.

Thanks

public Example()
        {
            InitializeComponent();
 
            RadChart1.DefaultView.ChartTitle.Content = "Sales Report";
            RadChart1.DefaultView.ChartLegend.Header = "Northwind";
 
            // if you uncomment these lines, you no longer get interactivity from the chart
            //////////RadChart1.DefaultView.ChartArea.ZoomScrollSettingsX.ScrollMode = ScrollMode.ScrollAndZoom;
            //////////RadChart1.DefaultView.ChartArea.ZoomScrollSettingsY.ScrollMode = ScrollMode.ScrollAndZoom;
 
            SeriesMapping sm = new SeriesMapping();
            sm.LegendLabel = "Beverages";
            sm.ItemMappings.Add(new ItemMapping("Y4", DataPointMember.YValue));
            SeriesDefinition definition = new LineSeriesDefinition();
 
            //definition.InteractivitySettings.HoverScope = InteractivityScope.Series;
            definition.InteractivitySettings.SelectionScope = InteractivityScope.Series;
            sm.SeriesDefinition = definition;
            RadChart1.SeriesMappings.Add(sm);
 
            SeriesMapping sm2 = new SeriesMapping();
            sm2.LegendLabel = "Dairy Products";
            sm2.ItemMappings.Add(new ItemMapping("Y5", DataPointMember.YValue));
            SeriesDefinition definition2 = new LineSeriesDefinition();
            //definition2.InteractivitySettings.HoverScope = InteractivityScope.Series;
            definition2.InteractivitySettings.SelectionScope = InteractivityScope.Series;
            sm2.SeriesDefinition = definition2;
            RadChart1.SeriesMappings.Add(sm2);
                        
 
            RadChart1.ItemsSource = DataObject.GetData();
        }
0
Dwight
Telerik team
answered on 29 Jul 2010, 06:29 AM
Hello Earnest,

Thank you for contacting us. We are aware of the issue with Zooming & Scrolling. The fix is under development.

With the SP1 release we plan on extending the interactions API to allow further flexibility and ease of use.

In the official release, however, such an API is missing.

Best,
Joshua
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Chart
Asked by
Earnest
Top achievements
Rank 1
Answers by
Dwight
Telerik team
Earnest
Top achievements
Rank 1
Share this question
or