Q: How can I show the second Y-axis and add series for it. I am using the line chart tool?
A: If you want to show the Y2 axis you must set the properties that define it – Y2AxisSettings.MinValue, Y2AxisSettings.MaxValue and Y2AxisSettings.Interval. Here is how you do it:
lineChart1.Y2AxisSettings.MinValue = 0; lineChart1.Y2AxisSettings.MaxValue = 40; lineChart1.Y2AxisSettings.Interval = 10;
If you want to have a series that is bound to Y2, you must set its data with the Y2Data or Y2DataPath properties. For a line chart it will be:
LineSeries series1 = new LineSeries(); series1.Y2DataPath = "AsiaSales"; series1.XData = series0.XData; series1.Strokes.Add(Brushes.Red); lineChart1.Series.Add(series1);
Here we add a LineSeries that is drawn in red, has the same Data as the first line series and takes the data for its Y2-values from a property called AsiaSales in the data source.