This question is locked. New answers and comments are not allowed.
I draw chart,the x-axis is always at the bottom (that is, if y is the negative that the horizontal axis is negative too ),how to set the x-axis in the middle(means y=0 is the x-axis),no matter y value is positive or negative number?
3 Answers, 1 is accepted
0
Hello Peiyang,
You can achieve the desired effect by setting the Minimum and Maximum properties of the Vertical Axis. If you want to have 0 right in the middle make sure that you have equal number of units from the zero to the minimum and maximum.
Greetings,
You can achieve the desired effect by setting the Minimum and Maximum properties of the Vertical Axis. If you want to have 0 right in the middle make sure that you have equal number of units from the zero to the minimum and maximum.
<
telerik:RadCartesianChart.VerticalAxis
>
<
telerik:LinearAxis
Minimum
=
"-100"
Maximum
=
"100"
/>
</
telerik:RadCartesianChart.VerticalAxis
>
Greetings,
Rosko
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0

Michael
Top achievements
Rank 2
answered on 12 Dec 2012, 11:45 AM
Hi Rosko,
I am having the same problem. But setting the Minimum and Maximum values does not solve my problem.
Here is my code:
I have attached the resulting chart as an image.
Best regards,
Michael Hilus
// Edit:
Sorry, the picture of the chart is the second one.
I am having the same problem. But setting the Minimum and Maximum values does not solve my problem.
Here is my code:
<
telerik:RadCartesianChart
>
<
telerik:LineSeries
ItemsSource
=
"{Binding MyItems}"
ValueBinding
=
"Value"
CategoryBinding
=
"Date"
/>
<
telerik:RadCartesianChart.HorizontalAxis
>
<
telerik:CategoricalAxis
ShowLabels
=
"false"
/>
</
telerik:RadCartesianChart.HorizontalAxis
>
<
telerik:RadCartesianChart.VerticalAxis
>
<
telerik:LinearAxis
Minimum
=
"-100"
Maximum
=
"100"
/>
</
telerik:RadCartesianChart.VerticalAxis
>
</
telerik:RadCartesianChart
>
I have attached the resulting chart as an image.
Best regards,
Michael Hilus
// Edit:
Sorry, the picture of the chart is the second one.
0
Hi Michael,
If I fully understand the requirements, you need to show the horizontal axis always at the position of the 0 in the VerticalAxis. We do not offer such a functionality, the horizontal axis has a property VerticalLocation and you can chose either Top or Bottom. Perhaps you can take advantage of the annotations and show a line at the zero:
This would produce result as in the attached image. Hope this helps.
Regards,
Petar Marchev
the Telerik team
If I fully understand the requirements, you need to show the horizontal axis always at the position of the 0 in the VerticalAxis. We do not offer such a functionality, the horizontal axis has a property VerticalLocation and you can chose either Top or Bottom. Perhaps you can take advantage of the annotations and show a line at the zero:
<
telerik:RadCartesianChart.Annotations
>
<
telerik:CartesianGridLineAnnotation
Axis
=
"{Binding VerticalAxis, ElementName=cartesianChart1}"
Value
=
"0"
/>
This would produce result as in the attached image. Hope this helps.
Regards,
Petar Marchev
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.