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

Changing MinValue on AdditionalYAxes

1 Answer 40 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Annie
Top achievements
Rank 1
Annie asked on 27 Jul 2011, 02:51 AM
I would like to have the ability for end user to changing MinValue, MaxValue & Step for Y Axis in Line Chart. I am able to apply it to my Primary Y Axis, but unable to my Secondary Y Axis. Below is the code snippets I am currently using for my user to changing MinValue & MaxValue on primary Y Axis.
this.RadChart1.DefaultView.ChartArea.AxisY.MinValue = Min1;
this.RadChart1.DefaultView.ChartArea.AxisY.MaxValue = Max1;

Please point me the way to have it on Secondary Y Axis.
All the changes is upon user request/on runtime.


Many thanks.

1 Answer, 1 is accepted

Sort by
0
Peshito
Telerik team
answered on 29 Jul 2011, 11:25 AM
Hello Annie,

In order to define the secondary Axis min, max and step values you should first create new instance of AxisY class, define its object properties and then add it as AdditionalYaxes to the chart. You should also set your SeriesDefinition.AxisName a name and then set the same name to the second Axis you've already created.

It can be achieved like this:
SeriesMapping secondSeriesMapping = new SeriesMapping();
secondSeriesMapping.SeriesDefinition = new BarSeriesDefinition();
secondSeriesMapping.SeriesDefinition.AxisName = "secondary";
secondSeriesMapping.ItemMappings.Add(new ItemMapping("Title", DataPointMember.XCategory));
secondSeriesMapping.ItemMappings.Add(new ItemMapping("Value2", DataPointMember.YValue));
 
AxisY axisY1 = new AxisY();
axisY1.AxisName = "secondary";
axisY1.AutoRange = false;
axisY1.MinValue = 0;
axisY1.MaxValue = 100;
axisY1.Step = 5;
 
radChart.DefaultView.ChartArea.AdditionalYAxes.Add(axisY1);
radChart.SeriesMappings.Add(secondSeriesMapping);
Hope that helps.

Best wishes,
Peshito
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Chart
Asked by
Annie
Top achievements
Rank 1
Answers by
Peshito
Telerik team
Share this question
or