• DR-IT Software
  • Products
  • Documentation
  • Product page
  • Examples
  • API reference
  • Support

Add Up Bars and Down Bars

Add Up Bars and set its fill color to light green. Add Down Bars and set its fill color to orange.

Output: UpDownBarsFormat.xlsx

var workbook = new Workbook();
var worksheet = workbook.Worksheets[0];

worksheet.GetRange("J1:L1").SetValue(new[] { "Series 1", "Series 2", "Series 3" });
worksheet.GetRange("I2:I5").SetValue(new[] { "Point 1", "Point 2", "Point 3", "Point 4" });
worksheet.GetRange("J2:J5").SetValue(new[] { 2, 6, 4, 8 });
worksheet.GetRange("K2:K5").SetValue(new[] { 4, 2, 3, 1 });
worksheet.GetRange("L2:L5").SetValue(new[] { 1, 2, -1, -2 });

var chart1 = worksheet.Charts.Add<LineChart>("A1");
chart1.Grouping = Grouping.Stacked;
chart1.Size.HeightInches = 2.5;
chart1.Size.WidthInches = 3.5;
chart1.DataSource = "Sheet1!$I$1:$L$5";

chart1.UpDownBars = new UpDownBars();
chart1.UpDownBars.GapWidth = 150;
chart1.UpDownBars.UpBars.Fill.Type = FillType.SolidFill;
chart1.UpDownBars.UpBars.Fill.SolidDrawingColor = DrawingColor.LightGreen;
chart1.UpDownBars.DownBars.Fill.Type = FillType.SolidFill;
chart1.UpDownBars.DownBars.Fill.SolidDrawingColor = DrawingColor.Orange;

workbook.SaveAs("UpDownBarsFormat.xlsx");
  • Improve this Doc
Back to top

DR-IT Software documentation

DR-IT Software · Products · Documentation index · Product page · Downloads · Support · Licensing

Generated by DocFX