Click here to Skip to main content
15,888,253 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
My Requirement
I need to draw a second Y-Axis on a Scatter chart using C#.

My data pattern
Signal-1 Value
Signal-2 Value
Time Received.

Expected Chart
I need to draw the chart to have
Signal-1 value on the X-Axis
Signal-2 value on the Y-Axis
Time Received on the second Y-Axis.
Please let me know how to draw the secong Y-Axis to represent the time value.
I have searched in net, but the solution I get for having Y-Axis is to plot a another series -
Using secondary axis for chart cause x-axis and primary y-axis issue (Excel)

What I have tried:

My Current Code
var scatterChart =
workSheet.Drawings.AddChart("scatterChart", eChartType.XYScatterLines) as ExcelScatterChart;
scatterChart.Title.Text = GraphTitle;
var rangeLabel = workSheet.Cells["D2:D2571"];
var range1 = workSheet.Cells["C2:C2571"];
scatterChart.Series.Add(range1, rangeLabel);
scatterChart.Series[0].Header = workSheet.Cells["A1"].Value.ToString();
scatterChart.Legend.Position = eLegendPosition.Right;
scatterChart.SetSize(600, 300);
scatterChart.SetPosition(5, 0, 1, 0
Posted
Updated 2-Apr-18 0:13am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900