The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
C# excel bar chart
1. How to Use C# Create Excel bar Chart
Why Create Excel Bar Chart?
For numerical comparisons, bar chart is a classic solution. Bar chart (graph) is a chart with
rectangular bars with lengths proportional to the values that they represent. The bars can be plotted
vertically or horizontally. A bar chart is very useful if you are trying to record certain information
whether it is continuous or not continuous data. In bar charts, a class or group can have a single
category of data, or they can be broken down further into multiple categories for greater depth of
analysis. And in Microsoft Excel, it is the same useful!
How to Use C# Create Excel Bar Chart?
Spire.XLS for .NET allows user to use C# create Excel bar chart. Use C# to create Excel bar chart
could be as easy as in Microsoft Excel. The whole process is almost the same such as write chart
data, set region/position of chart, Write chart title, chart data information, etc. The difference is we
need fill these data in C# application with codes around. Below is a sample for C# code used to
create Excel bar charts. Download Spire.XLS (or Spire.Office) with .NET framework 2.0 (or
above) together and use the code to create Excel Bar Chart right now.
C# Excel Bar Chart:
using Spire.Xls;
using Spire.Xls.Charts;
namespace Spire.Xls.Sample
{
class program
{
static void Main()
{
Application.Run(new Form1());
}
private void btnRun_Click(object sender, System.EventArgs e)
{
Workbook workbook = new Workbook();
//Initailize worksheet
workbook.CreateEmptySheets(1);
Worksheet sheet = workbook.Worksheets[0];
sheet.Name = "Chart data";
sheet.GridLinesVisible = false;
//Writes chart data
CreateChartData(sheet);
//Add a new chart worsheet to workbook