When is the ActualRange set?

2 posts, 0 answers
  1. Kornelije
    Kornelije avatar
    28 posts
    Member since:
    May 2011

    Posted 24 Jul 2012 Link to this post

    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).

  2. Rosko
    Admin
    Rosko avatar
    137 posts

    Posted 27 Jul 2012 Link to this post

    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.

  3. DevCraft banner
Back to Top