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

Zooming and Scrolling event

8 Answers 208 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Chris Thierry
Top achievements
Rank 1
Chris Thierry asked on 02 Jul 2010, 09:41 PM
Hi, is there any event that is executed when scrolling or zooming in a RadChart for Silverlight 4?
Thank you.

8 Answers, 1 is accepted

Sort by
0
Vladimir Milev
Telerik team
answered on 07 Jul 2010, 08:33 AM
Hello Chris Thierry,

ChartArea.ZoomScrollSettingsX / ZoomScrollSettingsY are both implementing INotifyPropertyChanged, so you can handle the PropertyChanged event to do your stuff.

Sincerely yours,
Vladimir Milev
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
Chris Thierry
Top achievements
Rank 1
answered on 08 Jul 2010, 05:22 PM
Hi, I tried to do it, but I'm lost, I don't know how to implements this interface when I'm changing my zooming and scrolling bar, do you please have and example of how to do it?

How can I loop my series?

I can do this:
foreach (DataSeries series in chart_Months.DefaultView.ChartArea.DataSeries)  {
}

but I don't know how to get my series. If for example using the scrolling bar I selected a minimum range 2/10 series, is possible to loop just the two selected series by the scrolling bar??

Thank you.

Could you please help me on this issue?
Thank you
0
Chris Thierry
Top achievements
Rank 1
answered on 13 Jul 2010, 04:15 PM
Hi,
Could you please help me with this?
Thank you.
0
Vladimir Milev
Telerik team
answered on 14 Jul 2010, 02:45 PM
Hello Chris Thierry,

Just take a look at this example. In it we are subscribing to the PropertyChanged event and are changing the XAxis format strings to match the appropriate zoom range.

The code in question is:
RadChart1.DefaultView.ChartArea.ZoomScrollSettingsX.PropertyChanged += ZoomScrollSettingsX_PropertyChanged;
and
private void ZoomScrollSettingsX_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
    double range = (sender as ZoomScrollSettings).Range;
 
    if (range > 0.7d)
    {
        RadChart1.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "yyyy";
        RadChart1.DefaultView.ChartArea.AxisX.StepLabelLevelCount = 1;
    }
    else if (range > 1d / 12d)
    {
        RadChart1.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "MMMM yyyy";
        RadChart1.DefaultView.ChartArea.AxisX.StepLabelLevelCount = 2;
    }
    else if (range > 1d / 12d / 30d)
    {
        RadChart1.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "dd MMM yyyy";
        RadChart1.DefaultView.ChartArea.AxisX.StepLabelLevelCount = 2;
    }
    else
    {
        RadChart1.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "dd-MMM (HH:mm)";
        RadChart1.DefaultView.ChartArea.AxisX.StepLabelLevelCount = 2;
    }
}


Hope this helps.

Sincerely yours,
Vladimir Milev
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
Chris Thierry
Top achievements
Rank 1
answered on 19 Jul 2010, 06:33 PM
Hi, I'm trying to apply this logic, but I don't know why my method ZoomScrollSettingsX_PropertyChanged is executed more than one time, in my case 3 times, is there any reason?, I'm using the Q2 version of RadControls for Silverlight. I have 3 charts in the same silverlight page, is maybe this the reason?. Just to let you know...I'm just creating my propertychanged event in one of them
Thank you.
0
Accepted
Ves
Telerik team
answered on 21 Jul 2010, 01:55 PM
Hello Chris,

PropertyChanged event is fired for every property which is changed for the given object. You can check the value of e.PropertyName and execute your code only for RangeStart and RangeEnd properties.

Kind regards,
Ves
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
Xie
Top achievements
Rank 1
answered on 31 Mar 2012, 03:19 PM
I have the same problem, and the selected range is also inaccurate.
0
Ves
Telerik team
answered on 04 Apr 2012, 04:37 PM
Hi Xie,

I believe Vladimir has described how to achieve the desired result and I have explained why the event would be triggered multiple times. As for the inaccurate selection -- please, feel free to open a support ticket and provide us with all the details about your setup, so that we can review it and get back to you. Thank you.

Best regards,
Ves
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
Chart
Asked by
Chris Thierry
Top achievements
Rank 1
Answers by
Vladimir Milev
Telerik team
Chris Thierry
Top achievements
Rank 1
Ves
Telerik team
Xie
Top achievements
Rank 1
Share this question
or