CustomLineAnnotation with RadCartesianChart

5 posts, 1 answers
  1. Keizo
    Keizo avatar
    18 posts
    Member since:
    Apr 2012

    Posted 06 Dec 2012 Link to this post

    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.
  2. Petar Kirov
    Admin
    Petar Kirov avatar
    425 posts

    Posted 11 Dec 2012 Link to this post

    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.

  3. DevCraft banner
  4. Keizo
    Keizo avatar
    18 posts
    Member since:
    Apr 2012

    Posted 11 Dec 2012 Link to this post

    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
  5. Answer
    Petar Kirov
    Admin
    Petar Kirov avatar
    425 posts

    Posted 14 Dec 2012 Link to this post

    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.

  6. Keizo
    Keizo avatar
    18 posts
    Member since:
    Apr 2012

    Posted 14 Dec 2012 Link to this post

    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.
Back to Top
DevCraft banner