Documents for Excel .NET Edition | GCDocuments
Features / Chart / Chart Types / Bar Chart
In This Topic
    Bar Chart
    In This Topic

    Bar charts compare categorical data through horizontal bars, where length of each bar represents the value of the corresponding category. In bar charts, categories are organized along the vertical axis and data values along the horizontal axis. For example, sales of various product categories can be presented through a bar chart.

    GcExcel supports the following types of bar charts.

    Chart Type Chart Snapshot Use Case
    BarClustered chart

    BarClustered chart

    BarClustered Chart can be used to display the comparisons of values across different categories.
    BarClustered3D chart

    BarClustered3D chart

    BarClustered3D chart is used to display the chart demonstration in 3D,which is a modification of 2DBarClustered chart. It does not have a third dimension, it only looks volumetric in appearance.
    BarStacked chart

    BarStacked chart

    BarStacked chart is used to display the relationship of each item/category to the whole in two-dimensional and three-dimensional rectangles.
    BarStacked3D chart

    BarStacked3D chart

    BarStacked3D chart is used to represent the BarStacked chart demonstration in 3D,which looks volumetric in appearance.
    BarStacked100 chart

    BarStacked100 chart

    BarStacked100 chart is used to display the comparisons of percentage that each of the values contribute to the total across different categories.

    BarStacked1003D chart

    BarStacked1003D chart

    BarStacked1003D chart is used to represent the BarStacked100 chart demonstration in 3D, which is a modification of 2D chart in appearance.

    Using Code

    Refer to the following example code to add Bar Stacked Chart:

    Copy Code
      public void BarCharts()
          // Initialize workbook
          Workbook workbook = new Workbook();
          // Fetch default worksheet 
          IWorksheet worksheet = workbook.Worksheets[0];
          // Prepare data for chart
          worksheet.Range["A1:D4"].Value = new object[,]
         {null, "Q1", "Q2", "Q3"},
         {"Mobile Phones", 1330, 2345, 3493},
         {"Laptops", 2032, 3632, 2197},
         {"Tablets", 6233, 3270, 2030}
          // Add BarStacked Chart
          IShape barChartshape = worksheet.Shapes.AddChart(ChartType.BarStacked, 250, 20, 360, 230);
          // Adding series to SeriesCollection
          barChartshape.Chart.SeriesCollection.Add(worksheet.Range["A1:D4"], RowCol.Columns, true, true);
          // Configure Chart Title 
          barChartshape.Chart.ChartTitle.TextFrame.TextRange.Paragraphs.Add("Annual Sales Record");
          // Saving workbook to Xlsx
          workbook.Save(@"19-BarChart.xlsx", SaveFileFormat.Xlsx);