How to build 2 types of diagrams on one diagram, use EPPlus

I want to draw two different series of types (e.g. Column and Line) on the same chart in EPPlus (COM helps export an Excel file). Does anyone know how to do this. Thanks in advance.

+7
source share
2 answers
Finally, I found my answer. Ref link: http://epplus.codeplex.com/wikipage?title=FAQ

How to add a series with a different type of chart to a chart?

Here's how you do it ...

ExcelChart chart = worksheet.Drawings.AddChart("chtLine", eChartType.LineMarkers); var serie1= chart.Series.Add(Worksheet.Cells["B1:B4"],Worksheet.Cells["A1:A4"]); //Now for the second chart type we use the chart.PlotArea.ChartTypes collection... var chartType2 = chart.PlotArea.ChartTypes.Add(eChartType.ColumnClustered); var serie2 = chartType2.Series.Add(Worksheet.Cells["C1:C4"],Worksheet.Cells["A1:A4"]); 
+8
source

You can do it like this:

 var chartType2 = chart.PlotArea.ChartTypes.Add(eChartType.ColumnClustered)as ExcelBarChart; (ExcelBarChartSerie) serie2 = (ExcelBarChartSerie) chartType2.Series.Add(Worksheet.Cells["C1:C4"],Worksheet.Cells["A1:A4"]); serie2.DataLabel.ShowValue = true; 
+1
source

All Articles