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

Can an additional y-axis share "0"

3 Answers 65 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 21 Jun 2012, 08:38 PM
Hello,
Can an additional y-axis on the right be set up so that it's 0 value lines up with the standard y-axis 0 on the left? On the standard axis I am plotting something like profit vs. expenses with the yellow line displaying the net difference. On the additional y-axis I am displaying a grand total on a significantly larger scale. Since the grand total is never negative the additional y-axis has 0 at the bottom but ideally I would like it's 0 to line up with the standard axis 0. Thanks much in advance!
Jason

3 Answers, 1 is accepted

Sort by
0
Rosko
Telerik team
answered on 22 Jun 2012, 08:25 AM
Hi Jason,

To achieve the desired effect you need to set to both axes the same minimum and maximum values. In order to do so you need to set a couple of properties. Please refer to the online help topic and the code snippet below.
additionalAxis.AutoRange = radChart.DefaultView.ChartArea.AxisY.AutoRange = false;
additionalAxis.MinValue = radChart.DefaultView.ChartArea.AxisY.MinValue = -120;
additionalAxis.MaxValue = radChart.DefaultView.ChartArea.AxisY.MaxValue = 120;
additionalAxis.Step = 10;
radChart.DefaultView.ChartArea.AxisY.Step = 10;

You have to set for both axes the AutoRange property to false. Then the MinValue and MaxValue properties have to be the same, as well, so that the values on both axes are aligned. Have in mind that when you disable AutoRange, RadChart requires you to set the Step property. For the two axes, two different values can be set.


Kind regards,
Rosko
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Jason
Top achievements
Rank 1
answered on 22 Jun 2012, 02:26 PM
Thanks for the reply Rosco!
The issue is that I do not want the the minimum, maximum, and step values for both axis to be the same, that would not require an additional axis if I'm understanding correctly. My additional axis is on a much larger scale (values are ~10x larger than the values displayed on the standard axis) so it's min/max/step values will be dramatically larger. What I'm after is that the two axis 'share' a 0 value rather than having a different 0 on the left axis vs the right axis..
0
Rosko
Telerik team
answered on 26 Jun 2012, 08:42 AM
Hello Jason,

What you are saying is true. If scaling is the case, you can scale the axis as well. If for the default axis you are having Min =-120, Max = 120 and Step = 10, for the additional axis you can have the same but multiplied by 10, 100 or even 10000, as much as you would like. What you will get, you can see in the image that I have attached. I hope this helps.
additionalAxis.AutoRange = radChart.DefaultView.ChartArea.AxisY.AutoRange = false;
radChart.DefaultView.ChartArea.AxisY.MinValue = -120;
radChart.DefaultView.ChartArea.AxisY.MaxValue = 120;
radChart.DefaultView.ChartArea.AxisY.Step = 10;
additionalAxis.MinValue = -12000;
additionalAxis.MaxValue = 12000;
additionalAxis.Step = 1000;


Greetings,
Rosko
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
Chart
Asked by
Jason
Top achievements
Rank 1
Answers by
Rosko
Telerik team
Jason
Top achievements
Rank 1
Share this question
or