From a9d03153e115ae015e48e2474b04fdc428b99e3c Mon Sep 17 00:00:00 2001 From: AtchayaSekar28 Date: Wed, 15 Jul 2026 17:58:44 +0530 Subject: [PATCH 1/5] Added the sample for clustered column chart --- .../.NET/Create-clustered-column-chart.sln | 25 ++++++ .../Create-clustered-column-chart.csproj | 19 ++++ .../Output/.gitkeep | 1 + .../Create-clustered-column-chart/Program.cs | 86 +++++++++++++++++++ 4 files changed, 131 insertions(+) create mode 100644 Charts/Create-clustered-column-chart/.NET/Create-clustered-column-chart.sln create mode 100644 Charts/Create-clustered-column-chart/.NET/Create-clustered-column-chart/Create-clustered-column-chart.csproj create mode 100644 Charts/Create-clustered-column-chart/.NET/Create-clustered-column-chart/Output/.gitkeep create mode 100644 Charts/Create-clustered-column-chart/.NET/Create-clustered-column-chart/Program.cs diff --git a/Charts/Create-clustered-column-chart/.NET/Create-clustered-column-chart.sln b/Charts/Create-clustered-column-chart/.NET/Create-clustered-column-chart.sln new file mode 100644 index 000000000..2719cde3e --- /dev/null +++ b/Charts/Create-clustered-column-chart/.NET/Create-clustered-column-chart.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31911.196 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Create-clustered-column-chart", "Create-clustered-column-chart\Create-clustered-column-chart.csproj", "{C17B90BC-F559-456B-B189-90B53FF6CDD4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C17B90BC-F559-456B-B189-90B53FF6CDD4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C17B90BC-F559-456B-B189-90B53FF6CDD4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C17B90BC-F559-456B-B189-90B53FF6CDD4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C17B90BC-F559-456B-B189-90B53FF6CDD4}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {EF357FC6-E9E5-4E3C-B932-43F727BE1DE4} + EndGlobalSection +EndGlobal diff --git a/Charts/Create-clustered-column-chart/.NET/Create-clustered-column-chart/Create-clustered-column-chart.csproj b/Charts/Create-clustered-column-chart/.NET/Create-clustered-column-chart/Create-clustered-column-chart.csproj new file mode 100644 index 000000000..9900d7662 --- /dev/null +++ b/Charts/Create-clustered-column-chart/.NET/Create-clustered-column-chart/Create-clustered-column-chart.csproj @@ -0,0 +1,19 @@ + + + + Exe + net8.0 + Create_clustered_bar_pyramid_chart + + + + + + + + + Always + + + + diff --git a/Charts/Create-clustered-column-chart/.NET/Create-clustered-column-chart/Output/.gitkeep b/Charts/Create-clustered-column-chart/.NET/Create-clustered-column-chart/Output/.gitkeep new file mode 100644 index 000000000..5f282702b --- /dev/null +++ b/Charts/Create-clustered-column-chart/.NET/Create-clustered-column-chart/Output/.gitkeep @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Charts/Create-clustered-column-chart/.NET/Create-clustered-column-chart/Program.cs b/Charts/Create-clustered-column-chart/.NET/Create-clustered-column-chart/Program.cs new file mode 100644 index 000000000..f905e4461 --- /dev/null +++ b/Charts/Create-clustered-column-chart/.NET/Create-clustered-column-chart/Program.cs @@ -0,0 +1,86 @@ +using Syncfusion.DocIO; +using Syncfusion.DocIO.DLS; +using Syncfusion.OfficeChart; +using System.IO; + +namespace Create_clustered_column_chart +{ + class Program + { + static void Main(string[] args) + { + //Loads the template document. + WordDocument document = new WordDocument(); + // Adds section to the document. + IWSection sec = document.AddSection(); + //Adds paragraph to the section. + IWParagraph paragraph = sec.AddParagraph(); + //Creates and Appends chart to the paragraph. + WChart chart = paragraph.AppendChart(446, 270); + chart.ChartType = OfficeChartType.Column_Clustered; + + //Assign data + AddChartData(chart); + chart.IsSeriesInRows = false; + //Apply chart elements + //Set chart title + chart.ChartTitle = "Sales Report in Clustered Column Chart"; + //Set Datalabels + IOfficeChartSerie serie1 = chart.Series.Add("Amount(in $)"); + //Sets the data range of chart series – start row, start column, end row, end column + serie1.Values = chart.ChartData[2, 2, 6, 2]; + IOfficeChartSerie serie2 = chart.Series.Add("Count"); + //Sets the data range of chart series start row, start column, end row, end column + serie2.Values = chart.ChartData[2, 3, 6, 3]; + //Sets the data range of the category axis + chart.PrimaryCategoryAxis.CategoryLabels = chart.ChartData[2, 1, 6, 1]; + serie1.DataPoints.DefaultDataPoint.DataLabels.IsValue = true; + serie2.DataPoints.DefaultDataPoint.DataLabels.IsValue = true; + serie1.DataPoints.DefaultDataPoint.DataLabels.Position = OfficeDataLabelPosition.Outside; + serie2.DataPoints.DefaultDataPoint.DataLabels.Position = OfficeDataLabelPosition.Outside; + //Set legend + chart.HasLegend = true; + chart.Legend.Position = OfficeLegendPosition.Bottom; + //Create a file stream. + //Create a file stream. + using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.docx"), FileMode.Create, FileAccess.ReadWrite)) + { + //Save the Word document to the file stream. + document.Save(outputFileStream, FormatType.Docx); + } + + } + /// + /// Set the values for the chart + /// + /// Represent the instance of the chart + + private static void AddChartData(WChart chart) + { + //Set the value for chart data + chart.ChartData.SetValue(1, 1, "Items"); + chart.ChartData.SetValue(1, 2, "Amount(in $)"); + chart.ChartData.SetValue(1, 3, "Count"); + + chart.ChartData.SetValue(2, 1, "Beverages"); + chart.ChartData.SetValue(2, 2, 2776); + chart.ChartData.SetValue(2, 3, 925); + + chart.ChartData.SetValue(3, 1, "Condiments"); + chart.ChartData.SetValue(3, 2, 1077); + chart.ChartData.SetValue(3, 3, 378); + + chart.ChartData.SetValue(4, 1, "Confections"); + chart.ChartData.SetValue(4, 2, 2287); + chart.ChartData.SetValue(4, 3, 880); + + chart.ChartData.SetValue(5, 1, "Dairy Products"); + chart.ChartData.SetValue(5, 2, 1368); + chart.ChartData.SetValue(5, 3, 581); + + chart.ChartData.SetValue(6, 1, "Grains/Cereals"); + chart.ChartData.SetValue(6, 2, 3325); + chart.ChartData.SetValue(6, 3, 189); + } + } +} From c6f1ac36c53beb43cb7ea7a88c33254cc2470e89 Mon Sep 17 00:00:00 2001 From: AtchayaSekar28 Date: Wed, 15 Jul 2026 18:03:21 +0530 Subject: [PATCH 2/5] renamed the name in cs proj --- .../Create-clustered-column-chart.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Charts/Create-clustered-column-chart/.NET/Create-clustered-column-chart/Create-clustered-column-chart.csproj b/Charts/Create-clustered-column-chart/.NET/Create-clustered-column-chart/Create-clustered-column-chart.csproj index 9900d7662..642ba3d61 100644 --- a/Charts/Create-clustered-column-chart/.NET/Create-clustered-column-chart/Create-clustered-column-chart.csproj +++ b/Charts/Create-clustered-column-chart/.NET/Create-clustered-column-chart/Create-clustered-column-chart.csproj @@ -3,7 +3,7 @@ Exe net8.0 - Create_clustered_bar_pyramid_chart + Create-clustered-column-chart From 6bfa579843d6f8ccbaf76ae4e04f4e20f52c8b7f Mon Sep 17 00:00:00 2001 From: AtchayaSekar28 Date: Wed, 15 Jul 2026 18:13:24 +0530 Subject: [PATCH 3/5] removed the namespace in Program.cs --- .../Create-clustered-column-chart/Program.cs | 136 +++++++++--------- 1 file changed, 64 insertions(+), 72 deletions(-) diff --git a/Charts/Create-clustered-column-chart/.NET/Create-clustered-column-chart/Program.cs b/Charts/Create-clustered-column-chart/.NET/Create-clustered-column-chart/Program.cs index f905e4461..b1ad27036 100644 --- a/Charts/Create-clustered-column-chart/.NET/Create-clustered-column-chart/Program.cs +++ b/Charts/Create-clustered-column-chart/.NET/Create-clustered-column-chart/Program.cs @@ -3,84 +3,76 @@ using Syncfusion.OfficeChart; using System.IO; -namespace Create_clustered_column_chart + +//Loads the template document. +WordDocument document = new WordDocument(); +// Adds section to the document. +IWSection sec = document.AddSection(); +//Adds paragraph to the section. +IWParagraph paragraph = sec.AddParagraph(); +//Creates and Appends chart to the paragraph. +WChart chart = paragraph.AppendChart(446, 270); +chart.ChartType = OfficeChartType.Column_Clustered; +//Assign data +AddChartData(chart); +chart.IsSeriesInRows = false; +//Apply chart elements +//Set chart title +chart.ChartTitle = "Sales Report in Clustered Column Chart"; +//Set Datalabels +IOfficeChartSerie serie1 = chart.Series.Add("Amount(in $)"); +//Sets the data range of chart series – start row, start column, end row, end column +serie1.Values = chart.ChartData[2, 2, 6, 2]; +IOfficeChartSerie serie2 = chart.Series.Add("Count"); +//Sets the data range of chart series start row, start column, end row, end column +serie2.Values = chart.ChartData[2, 3, 6, 3]; +//Sets the data range of the category axis +chart.PrimaryCategoryAxis.CategoryLabels = chart.ChartData[2, 1, 6, 1]; +serie1.DataPoints.DefaultDataPoint.DataLabels.IsValue = true; +serie2.DataPoints.DefaultDataPoint.DataLabels.IsValue = true; +serie1.DataPoints.DefaultDataPoint.DataLabels.Position = OfficeDataLabelPosition.Outside; +serie2.DataPoints.DefaultDataPoint.DataLabels.Position = OfficeDataLabelPosition.Outside; +//Set legend +chart.HasLegend = true; +chart.Legend.Position = OfficeLegendPosition.Bottom; +//Create a file stream. +//Create a file stream. +using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.docx"), FileMode.Create, FileAccess.ReadWrite)) { - class Program - { - static void Main(string[] args) - { - //Loads the template document. - WordDocument document = new WordDocument(); - // Adds section to the document. - IWSection sec = document.AddSection(); - //Adds paragraph to the section. - IWParagraph paragraph = sec.AddParagraph(); - //Creates and Appends chart to the paragraph. - WChart chart = paragraph.AppendChart(446, 270); - chart.ChartType = OfficeChartType.Column_Clustered; + //Save the Word document to the file stream. + document.Save(outputFileStream, FormatType.Docx); +} - //Assign data - AddChartData(chart); - chart.IsSeriesInRows = false; - //Apply chart elements - //Set chart title - chart.ChartTitle = "Sales Report in Clustered Column Chart"; - //Set Datalabels - IOfficeChartSerie serie1 = chart.Series.Add("Amount(in $)"); - //Sets the data range of chart series – start row, start column, end row, end column - serie1.Values = chart.ChartData[2, 2, 6, 2]; - IOfficeChartSerie serie2 = chart.Series.Add("Count"); - //Sets the data range of chart series start row, start column, end row, end column - serie2.Values = chart.ChartData[2, 3, 6, 3]; - //Sets the data range of the category axis - chart.PrimaryCategoryAxis.CategoryLabels = chart.ChartData[2, 1, 6, 1]; - serie1.DataPoints.DefaultDataPoint.DataLabels.IsValue = true; - serie2.DataPoints.DefaultDataPoint.DataLabels.IsValue = true; - serie1.DataPoints.DefaultDataPoint.DataLabels.Position = OfficeDataLabelPosition.Outside; - serie2.DataPoints.DefaultDataPoint.DataLabels.Position = OfficeDataLabelPosition.Outside; - //Set legend - chart.HasLegend = true; - chart.Legend.Position = OfficeLegendPosition.Bottom; - //Create a file stream. - //Create a file stream. - using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.docx"), FileMode.Create, FileAccess.ReadWrite)) - { - //Save the Word document to the file stream. - document.Save(outputFileStream, FormatType.Docx); - } - } - /// - /// Set the values for the chart - /// - /// Represent the instance of the chart +/// +/// Set the values for the chart +/// +/// Represent the instance of the chart - private static void AddChartData(WChart chart) - { - //Set the value for chart data - chart.ChartData.SetValue(1, 1, "Items"); - chart.ChartData.SetValue(1, 2, "Amount(in $)"); - chart.ChartData.SetValue(1, 3, "Count"); +static void AddChartData(WChart chart) +{ + //Set the value for chart data + chart.ChartData.SetValue(1, 1, "Items"); + chart.ChartData.SetValue(1, 2, "Amount(in $)"); + chart.ChartData.SetValue(1, 3, "Count"); - chart.ChartData.SetValue(2, 1, "Beverages"); - chart.ChartData.SetValue(2, 2, 2776); - chart.ChartData.SetValue(2, 3, 925); + chart.ChartData.SetValue(2, 1, "Beverages"); + chart.ChartData.SetValue(2, 2, 2776); + chart.ChartData.SetValue(2, 3, 925); - chart.ChartData.SetValue(3, 1, "Condiments"); - chart.ChartData.SetValue(3, 2, 1077); - chart.ChartData.SetValue(3, 3, 378); + chart.ChartData.SetValue(3, 1, "Condiments"); + chart.ChartData.SetValue(3, 2, 1077); + chart.ChartData.SetValue(3, 3, 378); - chart.ChartData.SetValue(4, 1, "Confections"); - chart.ChartData.SetValue(4, 2, 2287); - chart.ChartData.SetValue(4, 3, 880); + chart.ChartData.SetValue(4, 1, "Confections"); + chart.ChartData.SetValue(4, 2, 2287); + chart.ChartData.SetValue(4, 3, 880); - chart.ChartData.SetValue(5, 1, "Dairy Products"); - chart.ChartData.SetValue(5, 2, 1368); - chart.ChartData.SetValue(5, 3, 581); + chart.ChartData.SetValue(5, 1, "Dairy Products"); + chart.ChartData.SetValue(5, 2, 1368); + chart.ChartData.SetValue(5, 3, 581); - chart.ChartData.SetValue(6, 1, "Grains/Cereals"); - chart.ChartData.SetValue(6, 2, 3325); - chart.ChartData.SetValue(6, 3, 189); - } - } -} + chart.ChartData.SetValue(6, 1, "Grains/Cereals"); + chart.ChartData.SetValue(6, 2, 3325); + chart.ChartData.SetValue(6, 3, 189); +} \ No newline at end of file From 94db74e1ba5eb51b75f4fb3d099697c3d82f95bb Mon Sep 17 00:00:00 2001 From: AtchayaSekar28 Date: Wed, 15 Jul 2026 18:29:59 +0530 Subject: [PATCH 4/5] removed the file stream saving --- .../.NET/Create-clustered-column-chart/Program.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Charts/Create-clustered-column-chart/.NET/Create-clustered-column-chart/Program.cs b/Charts/Create-clustered-column-chart/.NET/Create-clustered-column-chart/Program.cs index b1ad27036..0211439c6 100644 --- a/Charts/Create-clustered-column-chart/.NET/Create-clustered-column-chart/Program.cs +++ b/Charts/Create-clustered-column-chart/.NET/Create-clustered-column-chart/Program.cs @@ -35,13 +35,8 @@ //Set legend chart.HasLegend = true; chart.Legend.Position = OfficeLegendPosition.Bottom; -//Create a file stream. -//Create a file stream. -using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.docx"), FileMode.Create, FileAccess.ReadWrite)) -{ - //Save the Word document to the file stream. - document.Save(outputFileStream, FormatType.Docx); -} +//Save the Word document +document.Save(Path.GetFullPath(@"Output/Output.docx"), FormatType.Docx); /// From f7b0c06a8ba685f4d1e6fb816fcd768369118610 Mon Sep 17 00:00:00 2001 From: AtchayaSekar28 Date: Wed, 15 Jul 2026 18:33:53 +0530 Subject: [PATCH 5/5] removed the file stream saving method --- .../.NET/Create-clustered-column-chart/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Charts/Create-clustered-column-chart/.NET/Create-clustered-column-chart/Program.cs b/Charts/Create-clustered-column-chart/.NET/Create-clustered-column-chart/Program.cs index 0211439c6..ff549e704 100644 --- a/Charts/Create-clustered-column-chart/.NET/Create-clustered-column-chart/Program.cs +++ b/Charts/Create-clustered-column-chart/.NET/Create-clustered-column-chart/Program.cs @@ -36,7 +36,7 @@ chart.HasLegend = true; chart.Legend.Position = OfficeLegendPosition.Bottom; //Save the Word document -document.Save(Path.GetFullPath(@"Output/Output.docx"), FormatType.Docx); +document.Save(Path.GetFullPath(@"Output/Output.docx")); ///