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

When is the ActualRange set?

1 Answer 151 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Kornelije
Top achievements
Rank 1
Kornelije asked on 24 Jul 2012, 01:42 PM

I have a specific AxisLabelManager class that sets the labels for the axis depending on some factors.

One of the things needed to determine the labels is the Range of the visible data. Since the X-Axis shows the time, the needed values are the time of the first point and the time of the last point currently visible on the chart.

However, I can't find a moment where both the Data that is bound to the Chart and the ActualRange are set to the correct values.

After setting the ItemSource, I test the ActualMinValue and ActualMaxValue values in an event handler for the DataBound event. However, both values are incorrect (see before.png) and not what is shown on the chart (see chart.png).

I have a button on the page that I can click and the event handler does nothing except check these values (ActualMinValue and ActualMaxValue). When Chart's DataBound event is completed and the chart is shown to the user, I click the button to check these values. They are what they should be (the same as shown on the chart): 0.025 and 0.075.

When does this change occur? How can I react on the Range change, whether it is caused by the data being bound to the chart or the zoom/scroll bar's size/position is being changed? (Subscribing to AxisY.PropertyChanged did nothing as PropertyChanged event is not raised at all for those properties).

1 Answer, 1 is accepted

Sort by
0
Rosko
Telerik team
answered on 27 Jul 2012, 08:22 AM
Hello Kornelije,

According to my tests, the values do get updated. Nevertheless, there is a special event to reflect this change. Each of the axes have an event named: RangeChanged, which is fired when the minimum and maximum for the axis are changed. I have applied the sample test project. I hope this will help you to achieve the desired results.
radChart.DefaultView.ChartArea.AxisX.RangeChanged
radChart.DefaultView.ChartArea.AxisY.RangeChanged

All the best,
Rosko
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
Chart
Asked by
Kornelije
Top achievements
Rank 1
Answers by
Rosko
Telerik team
Share this question
or