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

ChartView Plot Area

9 Answers 231 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Kurt
Top achievements
Rank 1
Kurt asked on 26 Jun 2013, 01:30 AM
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

9 Answers, 1 is accepted

Sort by
0
Ivan Petrov
Telerik team
answered on 28 Jun 2013, 03:49 PM
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 >>
0
Steve
Top achievements
Rank 1
answered on 16 Mar 2016, 09:00 PM
Was this ever resolved? I need to be able to do a similar thing.
0
Kurt
Top achievements
Rank 1
answered on 16 Mar 2016, 09:31 PM
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.
0
Steve
Top achievements
Rank 1
answered on 17 Mar 2016, 12:31 AM
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.
0
Hristo
Telerik team
answered on 17 Mar 2016, 03:32 PM
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.
0
Steve
Top achievements
Rank 1
answered on 17 Mar 2016, 06:07 PM
That doesn't seem to exist in the UI for WinForms ChartView...
0
Hristo
Telerik team
answered on 18 Mar 2016, 12:02 PM
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.
      
0
Steve
Top achievements
Rank 1
answered on 18 Mar 2016, 09:36 PM

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?

0
Hristo
Telerik team
answered on 21 Mar 2016, 01:36 PM
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.
Tags
ChartView
Asked by
Kurt
Top achievements
Rank 1
Answers by
Ivan Petrov
Telerik team
Steve
Top achievements
Rank 1
Kurt
Top achievements
Rank 1
Hristo
Telerik team
Share this question
or