Zoom begin and end

4 posts, 0 answers
  1. Dwight
    Dwight avatar
    12 posts
    Member since:
    Feb 2013

    Posted 26 Apr 2013 Link to this post

    Hi all,

    I am looking for a way to know which datapoints (or screen coordinates) are in range of my current zoom level.
    I'm drawing specific stuff above the graph and don't want to change anything if the user clicks outside the graph.

    Any ideas?

    Kind regards,
    Dwight
  2. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 01 May 2013 Link to this post

    Hi Dwight,

    You can use a combination of our conversion API and the ActualRange property of the char axis. For example:

    private void RadCartesianChart_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
    {
        Point mousePosition = e.GetPosition(radCartesianChart1);
        DataTuple tuple = radCartesianChart1.ConvertPointToData(mousePosition);
     
        double xValue = (double)tuple.FirstlValue;
     
        LinearAxis xAxis = radCartesianChart1.HorizontalAxis as LinearAxis;
        double minimum = xAxis.ActualRange.Minimum;
        double maximum = xAxis.ActualRange.Maximum;
     
        if (xValue < minimum || xValue > maximum)
        {
        }
    }

    All the best,
    Tsvetie
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Dwight
    Dwight avatar
    12 posts
    Member since:
    Feb 2013

    Posted 02 May 2013 Link to this post

    Hi Tsvetie,

    It seems not to be working, when zoomed in the min & max property of the ActualRange property don't change.
    In my example unzoomed the min & max are from 0 to 9. When zoomed in (say from 2 to 3) and clicking outside the chart, they still are 0 and 9.

    Kind regards,
    Dwight
  5. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 06 May 2013 Link to this post

    Hello Dwight,

    Indeed, the actual range property returns the actual minimum and maximum of the entire axis. If you know the current zoom you can easily calculate the visible range of the axis. I have attached a simple application demonstrating the approach that you can use.

    Kind regards,
    Tsvetie
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top