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

Cartesian Chart without adding new axis for custom line

5 Answers 141 Views
Chart
This is a migrated thread and some comments may be shown as answers.
vikas
Top achievements
Rank 1
vikas asked on 16 Oct 2012, 02:39 PM

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.

5 Answers, 1 is accepted

Sort by
0
Petar Marchev
Telerik team
answered on 17 Oct 2012, 08:30 AM
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.

0
vikas
Top achievements
Rank 1
answered on 06 Nov 2012, 01:29 PM
Thanks for reply.

Updated my screen shot. i need to draw custom line (Reference line).
0
Petar Marchev
Telerik team
answered on 07 Nov 2012, 08:36 AM
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.

0
Iker
Top achievements
Rank 1
answered on 09 Jan 2013, 10:55 AM
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
0
Petar Marchev
Telerik team
answered on 11 Jan 2013, 07:39 AM
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.

Tags
Chart
Asked by
vikas
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
vikas
Top achievements
Rank 1
Iker
Top achievements
Rank 1
Share this question
or