ChartView Plot Area

10 posts, 0 answers
  1. Kurt
    Kurt avatar
    11 posts
    Member since:
    Dec 2007

    Posted 25 Jun 2013 Link to this post

    Hi there,

    I am building a custom pan/zoom lasso control and am looking at how to find out the exact coordinates of the rectangle relative to the plotted grid area, also be handy for a mouse location based pan/zoom control via the mouse wheel.

    It seems to some combination of the ChartviewArea minus the various sizes and marigns for the Chart and the title and the legend plis their sizes.

    I haven't had any luck finding them and I haven't had any luck finding the Axes Length and Width.

    This will be useful for also adding my own annotations.

    Also plan to add a view dataset which will change the number of records displayed depending on the pan zoom controls for my datasets which are from 1 to 16000 dtapoints.

    Hopefully if I solve all this I can post up  a demo project which handles these various circumstances for complex chart data analysis.

    Alternatively would I be better off embedding the Chart control from Reporting to achieve these various features, (probably need to anyway to achieve vector graphic charts for the pdf exports).

    Best regards,

    Kurt Scholz
    LogTag Recorders Ltd
    Lead Software Developer
    DevCraft Complete
  2. Ivan Petrov
    Admin
    Ivan Petrov avatar
    701 posts

    Posted 28 Jun 2013 Link to this post

    Hello Kurt,

    Thank you for writing.

    Currently there is no way to get the bounding rectangles of the axes or the plot area itself. We are aware of this limitation and will consider some method to address it. At this point in time, I cannot engage with any specific time frame as to when this will happen.

    Feel free to write back with any further questions.

    Regards,
    Ivan Petrov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Steve
    Steve avatar
    43 posts
    Member since:
    May 2014

    Posted 16 Mar in reply to Ivan Petrov Link to this post

    Was this ever resolved? I need to be able to do a similar thing.
  5. Kurt
    Kurt avatar
    11 posts
    Member since:
    Dec 2007

    Posted 16 Mar Link to this post

    I actually ended up going with the Microsoft chart control and using this MSChart Extension project to add the required functionality - http://www.codeproject.com/Articles/357817/MSChart-Extension-Zoom-and-Pan-Control.
  6. Steve
    Steve avatar
    43 posts
    Member since:
    May 2014

    Posted 16 Mar in reply to Kurt Link to this post

    Thanks, I don't actually need to do the zoom/pan stuff, I just need to get the bounding rectangle so I can translate screen coordinates into my chart data space and vice versa. Hopefully in the intervening 3 years they have added this functionality.
  7. Hristo
    Admin
    Hristo avatar
    714 posts

    Posted 17 Mar Link to this post

    Hello guys, 

    Thank you for writing.

    I believe that the rectangle defined by the LayoutSlot property can fit your setup:
    RadRect rect = this.radChartView1.View.Area.AreaModel.PlotArea.LayoutSlot;

    I hope this helps. Please do not hesitate to write back.

    Regards,
    Hristo Merdjanov
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  8. Steve
    Steve avatar
    43 posts
    Member since:
    May 2014

    Posted 17 Mar in reply to Hristo Link to this post

    That doesn't seem to exist in the UI for WinForms ChartView...
  9. Hristo
    Admin
    Hristo avatar
    714 posts

    Posted 18 Mar Link to this post

    Hello Steve,

    Thank you for writing back.

    The LayoutSlot property is defined in the abstract ChartNode class, and you can generally access it as per the snippet I sent you before.

    Now I am attaching to this thread a sample project in which I am zooming and panning the different quadrants of the chart using the value of this property.

    I hope this helps. Should you have further questions please do not hesitate to write back.

    Regards,
    Hristo Merdjanov
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
          
  10. Steve
    Steve avatar
    43 posts
    Member since:
    May 2014

    Posted 18 Mar in reply to Hristo Link to this post

    I wasn't able to access the AreaModel previously because I was referencing the wrong version. I switched to 2015 Q3, and I can access the AreaModel and get the PlotArea's LayoutSlot, BUT it's not quite what I need. I need to get the area inside the axes, that corresponds to the actual plotting space of the chart, so I can calculate where on the screen a data point is, and where a data point should be for a screen coordinate. Looking at the children of the AreaModel, there appears to be a Grid property that returns a "CartesianChartGridModel", but it's a property of a derived "CartesianChartAreaModel" class that I can't get a reference to other than through the debugger. I guess it doesn't matter because the LayoutSlot that I can view with the debugger does not have its properties set.

    I also looked at the Model.LayoutSlot property of the Axis, but its properties were not set either.

    Is there any other way to get the position of the actual plotting space inside the axes, or get the screen coordinates of data points?

  11. Hristo
    Admin
    Hristo avatar
    714 posts

    Posted 21 Mar Link to this post

    Hi Steve,

    Thank you for writing back.

    The rectangle inside the axes is defined by the LayoutSlot property plus the offset of the viewport. You can calculate it this way: 
    RadRect layouSlot = this.radChartView1.View.Area.AreaModel.PlotArea.LayoutSlot;
    RectangleF plotArea = RectangleF.Empty;
     
    plotArea.X = (float)layouSlot.X + (float)this.radChartView1.View.Viewport.X;
    plotArea.Y = (float)layouSlot.Y + (float)this.radChartView1.View.Viewport.Y;
    plotArea.Width = (float)layouSlot.Width;
    plotArea.Height = (float)layouSlot.Height;

    I hope this information is useful. Please let me know if you need further assistance.

    Regards,
    Hristo Merdjanov
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top
UI for WinForms is Visual Studio 2017 Ready