Skip to content

Styling Charts

Charts

EPPlus 5 and up supports over 100 new chart styles introduced in Excel 2016. These styles can be easily set by the new StyleManager and its method SetChartStyle - either using the ePresetChartStyle enum or Excel's internal chart style number (supplied to the method as an int).

Example

var chart = ws.Drawings.AddBarChart("column3dChart", eBarChartType.ColumnClustered3D);
var serie = chart.Series.Add(ws.Cells[2, 7, 26, 7], ws.Cells[2, 6, 26, 6]);
serie.Header = "Order Value";
chart.SetPosition(0, 0, 8, 0);
chart.SetSize(1000, 300);
chart.Title.Text = "Column Chart 3D";
//Set style 9 and Colorful Palette 3
chart.StyleManager.SetChartStyle(ePresetChartStyle.Bar3dChartStyle9, ePresetChartColors.ColorfulPalette3);
Dim chart = ws.Drawings.AddBarChart("column3dChart", eBarChartType.ColumnClustered3D)
Dim serie = chart.Series.Add(ws.Cells(2, 7, 26, 7), ws.Cells(2, 6, 26, 6))
serie.Header = "Order Value"
chart.SetPosition(0, 0, 8, 0)
chart.SetSize(1000, 300)
chart.Title.Text = "Column Chart 3D"
'Set style 9 and Colorful Palette 3
chart.StyleManager.SetChartStyle(ePresetChartStyle.Bar3dChartStyle9, ePresetChartColors.ColorfulPalette3)

See also