We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

2 axis

Can you create a scatter chart using 2 axis?

Hi,


Please see the sample code below for your reference on how to create Scatter chart having two vertical value axis, you may refer to it and create your desired Scatter chart for your needs:
e.g
Sample code:

Workbook wb = new Workbook();
Worksheet worksheet = wb.Worksheets[0];
int chartIndex = worksheet.Charts.Add(ChartType.ScatterConnectedByLinesWithDataMarker, 5, 0, 20, 8);
Chart chart = worksheet.Charts[chartIndex];

chart.ValueAxis.MinValue = 0;
chart.ValueAxis.MaxValue = 80;
chart.ValueAxis.MajorUnit = 10;

chart.SecondValueAxis.IsVisible = true;
chart.SecondValueAxis.MinValue = 0;
chart.SecondValueAxis.MaxValue = 1.4;
chart.SecondValueAxis.MajorUnit = 0.2;


chart.NSeries.Add("{50, 70, 20}", true);
chart.NSeries.Add("{30,40,20}", true);
chart.NSeries.Add("{0.6, 0.8, 1}", true);
chart.NSeries.Add("{0.4,0.2,1.2}", true);


chart.NSeries[2].PlotOnSecondAxis = true;
chart.NSeries[3].PlotOnSecondAxis = true;

chart.NSeries[0].Name = “A”;

chart.NSeries[1].Name = “B”;

chart.NSeries[2].Name = “C”;

chart.NSeries[3].Name = “D”;


wb.Save(“e:\test2\out1.xlsx”);

Thank you.