multiple series on second Y axis

How can I, in code, place multiple series on an additional second Y axis? From the documentation and sample code, it is not obvious to me how to do so.

Bill

3 Replies

PI Poorani Idhaya Bala M.A Syncfusion Team September 24, 2009 06:39 AM UTC

Hi,

Thanks for choosing Syncfusion products.
As per your requirement we have prepared a simple sample.

The below code will show How to add the multiple series for second Y Axis.

C#:
//Creating second YAxis for Chart
ChartAxis secondYAxis = new ChartAxis();
secondaryAxis.IsAutoSetRange = false;
secondaryAxis.Range = new DoubleRange(1, 20);
secondYAxis.Orientation = Orientation.Vertical;
secondYAxis.OpposedPosition = true;
secondYAxis.Header = "Second Y Axis";

//adding second series
ChartSeries series2 = new ChartSeries();
series2.DataSource = new Details(2);
series2.Type = ChartTypes.Line;
series2.Label = "Price";
series2.BindingPathX = "ProdId";
series2.BindingPathsY = new string[] { "Price" };
series2.Interior = Brushes.Blue;
//Set the second Yaxis as secondry axis of the series
series2.YAxis = secondYAxis;

chart1.Areas[0].Series.Add(series2);

//Adding third series
series2 = new ChartSeries();
series2.DataSource = new Details(3);
series2.Type = ChartTypes.Line;
series2.Label = "Price";
series2.BindingPathX = "ProdId";
series2.BindingPathsY = new string[] { "Price" };
series2.Interior = Brushes.Green;
//Set the second Yaxis as secondry axis of the series
series2.YAxis = secondYAxis;

chart1.Areas[0].Series.Add(series2);

Please find the attached sample. Hope this will resolve your problem.
Please let us know if you have any questions about this.

Thanks,
Poorani



MultipleSeriesOnYAxis_6c67c5ff.zip


KE Kevin December 2, 2016 02:39 AM UTC

Hi,

I saw this question and this is exactly what I wanted to do but on Mobile: iOS and Android.

May I know if this is supported in iOS and Android as well?

//Thank you


PS Parthiban Sundaram Syncfusion Team December 2, 2016 12:58 PM UTC

Hi Bill Swartz,

Thanks for contacting Syncfusion support.

You can achieve your requirement in Xamarin.Forms using the below code snippet.
 
  series.YAxis = new NumericalAxis(); 
 

We have also prepared a sample based on your recruitment. Please download the sample from following location.

Please get back to us if you need further assistance.

Regards,
Parthiban S
 


Loader.
Up arrow icon