multiple Y axis on line chart

ejleiss

Active member
Joined
Oct 1, 2012
Messages
37
Programming Experience
1-3
Hello,

Could anyone tell me how you could get two Y axis on a single line chart and assign them to a specific Series in that chart area?
Thank you.
 
Hi,

You can turn on the Secondary Y Axis in a chart using:-

Chart.ChartAreas("YourChartArea").AxisY2.Enabled = AxisEnabled.True

You can then determine which Y Axis your data series uses by setting its Y Axis type:-

Chart.Series("YourSeries").YAxisType = AxisType.Primary

or

Chart.Series("YourSeries").YAxisType = AxisType. Secondary

Hope that helps.

Cheers,

Ian
 
Thank you for the reply,

I tried this and I believe it is scaling correctly, however, neither Y axis have any numbers displaying the scale. They are both blank at the moment. I think they are default to autoscale, but I would like to be able to add hard min and maximum values and be able to see the scale on the sides of the graph. Any ideas?
 
Hi,

Try this:-

VB.NET:
With Chart.ChartAreas(0).AxisY
  .Minimum = 15
  .Maximum = 50
  .LabelStyle.Interval = 10
End With
With Chart.ChartAreas(0).AxisY2
  .Minimum = 200
  .Maximum = 1200
  .LabelStyle.Interval = 200
End With

You will need to play around with the values until you get what you want, but this should do the trick.

Hope that helps.

Cheers,

Ian
 
Back
Top