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

CustomLineAnnotation with RadCartesianChart

4 Answers 200 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Keizo
Top achievements
Rank 1
Keizo asked on 06 Dec 2012, 01:16 PM
Hi,

In
RadChart, I've created a LineAnnotation own.
This is what is created by inheriting LineAnnotationBase, to draw a line between two points by dragging the mouse.
I want to create a LineAnnotation RadCartesianChart similar, is there any sample something?
Or suggestions, please, do I inherit any class.

thank you.

4 Answers, 1 is accepted

Sort by
0
Petar Kirov
Telerik team
answered on 11 Dec 2012, 11:02 AM
Hi Keizo,

I believe that the most simple and straightforward solution would be to place a transparent Canvas in front of the RadCartesianChart and draw standard XAML (System.Windows.Shapes.) Lines (or any other Shape) on it.

The ChartView provides CartesianGridLineAnnotation which is either horizontal or vertical line, but not line annotations from point to point. That's why I don't think that there is a suitable annotation class to inherit from.

I hope this helps.
 
All the best,
Petar Kirov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Keizo
Top achievements
Rank 1
answered on 11 Dec 2012, 12:41 PM
Thanks Petar

If I use the Canvas, to follow the Zooming and Scrolling of Chart.
and, I need clipping to fit the size of the Chart.
Please tell me whether the events of the Chart should be used.
Please provide if it is an example code.

Thank you
0
Accepted
Petar Kirov
Telerik team
answered on 14 Dec 2012, 02:28 PM
Hello Keizo,

If your scenario includes zooming and scrolling, the Canvas solution will no-longer be easy to implement. 

That's why I offer you another solution - represent the line annotations with LineSeries (or ScatterLineSeries, depending on the chart axes). This gives you the advantage of out-of-the-box zoom and scroll support.

To determine the values of the data points of the line series, you can use the RadCartesianChart.ConvertPointToData. For more information you check this help topic.

I have attached a sample project. The user can create a line, by clicking twice on the chart.

Let me know if you need further assistance in implementing this in your project.

Kind regards,
Petar Kirov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Keizo
Top achievements
Rank 1
answered on 15 Dec 2012, 12:35 AM
Thanks Petar

I did not notice and used as Annotation to ScatterLineSeries.
I thought it was a very good idea.
But I also need the ability to move with the mouse Annotation drawn once.
Continue to further my own prototype.
This question is therefore to close with this.

Thank you.
Tags
ChartView
Asked by
Keizo
Top achievements
Rank 1
Answers by
Petar Kirov
Telerik team
Keizo
Top achievements
Rank 1
Share this question
or