J Antoni

J Antoni

  • NA
  • 81
  • 35.8k

EPPlus - Scatter chart - Draw a secondary Y-Axis

Apr 2 2018 2:52 AM
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 second 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) -( https://stackoverflow.com/questions/28540458/using-secondary-axis-for-chart-cause-x-axis-and-primary-y-axis-issue-excel)
 
My Current Code
  1. var scatterChart =  
  2. workSheet.Drawings.AddChart("scatterChart", eChartType.XYScatterLines) as ExcelScatterChart;  
  3. scatterChart.Title.Text = GraphTitle;  
  4. var rangeLabel = workSheet.Cells["D2:D2571"];  
  5. var range1 = workSheet.Cells["C2:C2571"];  
  6. scatterChart.Series.Add(range1, rangeLabel);  
  7. scatterChart.Series[0].Header = workSheet.Cells["A1"].Value.ToString();  
  8. scatterChart.Legend.Position = eLegendPosition.Right;  
  9. scatterChart.SetSize(600, 300);  
  10. scatterChart.SetPosition(5, 0, 1, 0