Cartesian Chart without adding new axis for custom line

6 posts, 0 answers
  1. vikas
    vikas avatar
    2 posts
    Member since:
    Apr 2011

    Posted 16 Oct 2012 Link to this post

    We are using Cartesian Chart and we need Custom line in that without adding new axis.

    Please provide demo example custom line with Cartesian Chart without adding new axis for custom line.

  2. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 17 Oct 2012 Link to this post

    Hi vikas,

    I am unsure what the code that produces this output (in the attached snapshot) is. May be the simplest solution is to set the Height of the axis to 0.

    With the new Q release, which is this week, the RadCartesianChart introduces annotations, so may be you can use these annotations (custom line) instead of what you are currently doing. Let us know if you have further inquiries.

    All the best,
    Petar Marchev
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
  4. vikas
    vikas avatar
    2 posts
    Member since:
    Apr 2011

    Posted 06 Nov 2012 Link to this post

    Thanks for reply.

    Updated my screen shot. i need to draw custom line (Reference line).
  5. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 07 Nov 2012 Link to this post

    Hi Vikas,

    I believe I did not understand your question the first time and I did not provide you with a good-enough answer. I think what you need is to use annotations, specifically a CartesianGridLineAnnotation. You do not need to create a new Axis for it, you can just set its Axis property to the already existing axis:
    <telerik:RadCartesianChart x:Name="chart">
     <telerik:RadCartesianChart.VerticalAxis>
      <telerik:LinearAxis />
     </telerik:RadCartesianChart.VerticalAxis>
     <telerik:RadCartesianChart.Annotations>
      <telerik:CartesianGridLineAnnotation Axis="{Binding ElementName=chart, Path=VerticalAxis}"  Value="25" />

    Let us know how it goes.

    Regards,
    Petar Marchev
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  6. Iker
    Iker avatar
    2 posts
    Member since:
    Jan 2013

    Posted 09 Jan 2013 Link to this post

    Hi,

    it is possible to add a 'CastersianGridLineAnnotation' or 'CartesianCustomAnnotation' in a horizontal 'CategoricalAxis' ?

    Something like this:
    <telerik:RadCartesianChart.HorizontalAxis>
        <telerik:CategoricalAxis />
    </telerik:RadCartesianChart.HorizontalAxis>
     
    <telerik:RadCartesianChart.VerticalAxis>
        <telerik:LinearAxis />
    </telerik:RadCartesianChart.VerticalAxis>
     
    <telerik:RadCartesianChart.Annotations>                      
        <telerik:CartesianGridLineAnnotation  Value="18"
                               Axis="{Binding ElementName=chart, Path=HorizontalAxis}">
        </telerik:CartesianGridLineAnnotation>-->
    </telerik:RadCartesianChart.Annotations>
     
    <telerik:RadCartesianChart.Series>
     
        <telerik:BarSeries ItemsSource="{Binding PriceDiference24h}" ValueBinding="Intra1"  />
     
    </telerik:RadCartesianChart.Series>


    Thanks,

    Iker
  7. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 11 Jan 2013 Link to this post

    Hi Iker,

    Yes, you can use the annotations with all axes. However I think that your example might not work if the categories from your items source are numbers. This is only because the Value="18" is being parsed as a string and not as an integer by the XAML parses. The Value property of the CartesianGridLineAnnotation  is of type object so that it can work with all axes. Later when the chart is looking to place the annotation at "18" - it fails to find such a category (because the "18" string differs from the 18 integer).

    I hope this helps.

    Regards,
    Petar Marchev
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top
DevCraft banner