diff --git a/Charts/Create-box-and-whisker-chart/.NET/Create-box-and-whisker-chart.sln b/Charts/Create-box-and-whisker-chart/.NET/Create-box-and-whisker-chart.sln new file mode 100644 index 000000000..868859e9f --- /dev/null +++ b/Charts/Create-box-and-whisker-chart/.NET/Create-box-and-whisker-chart.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30804.86 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Create-box-and-whisker-chart", "Create-box-and-whisker-chart\Create-box-and-whisker-chart.csproj", "{E214E65C-980A-46F5-8207-6D02212A49F5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E214E65C-980A-46F5-8207-6D02212A49F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E214E65C-980A-46F5-8207-6D02212A49F5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E214E65C-980A-46F5-8207-6D02212A49F5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E214E65C-980A-46F5-8207-6D02212A49F5}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {404A7F36-0167-4219-AE4D-2B0626CEB7E3} + EndGlobalSection +EndGlobal diff --git a/Charts/Create-box-and-whisker-chart/.NET/Create-box-and-whisker-chart/Create-box-and-whisker-chart.csproj b/Charts/Create-box-and-whisker-chart/.NET/Create-box-and-whisker-chart/Create-box-and-whisker-chart.csproj new file mode 100644 index 000000000..3e13032f5 --- /dev/null +++ b/Charts/Create-box-and-whisker-chart/.NET/Create-box-and-whisker-chart/Create-box-and-whisker-chart.csproj @@ -0,0 +1,19 @@ + + + + Exe + net8.0 + Create-box-and-whisker-chart + + + + + + + + + Always + + + + diff --git a/Charts/Create-box-and-whisker-chart/.NET/Create-box-and-whisker-chart/Output/.gitkeep b/Charts/Create-box-and-whisker-chart/.NET/Create-box-and-whisker-chart/Output/.gitkeep new file mode 100644 index 000000000..5f282702b --- /dev/null +++ b/Charts/Create-box-and-whisker-chart/.NET/Create-box-and-whisker-chart/Output/.gitkeep @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Charts/Create-box-and-whisker-chart/.NET/Create-box-and-whisker-chart/Program.cs b/Charts/Create-box-and-whisker-chart/.NET/Create-box-and-whisker-chart/Program.cs new file mode 100644 index 000000000..a7e129ac0 --- /dev/null +++ b/Charts/Create-box-and-whisker-chart/.NET/Create-box-and-whisker-chart/Program.cs @@ -0,0 +1,85 @@ +using System.IO; +using Syncfusion.DocIO; +using Syncfusion.DocIO.DLS; +using Syncfusion.OfficeChart; + +namespace Create_box_and_whisker_chart +{ + class Program + { + static void Main(string[] args) + { + using (WordDocument document = new WordDocument()) + { + IWSection section = document.AddSection(); + IWParagraph paragraph = section.AddParagraph(); + + WChart chart = paragraph.AppendChart(500f, 300f); + chart.ChartType = OfficeChartType.BoxAndWhisker; + chart.ChartTitle = "Academic Score - Box & Whisker Chart"; + + // Set headers + chart.ChartData.SetValue(1, 1, "Course"); + chart.ChartData.SetValue(1, 2, "School A"); + chart.ChartData.SetValue(1, 3, "School B"); + chart.ChartData.SetValue(1, 4, "School C"); + + // Add data rows + string[,] data = { + {"English", "63", "53", "45"}, + {"Physics", "61", "55", "65"}, + {"English", "63", "50", "65"}, + {"Math", "62", "51", "64"}, + {"English", "46", "53", "66"}, + {"English", "58", "56", "67"}, + {"Math", "60", "51", "67"}, + {"Math", "62", "53", "66"}, + {"English", "63", "54", "64"}, + {"English", "63", "52", "67"}, + {"Physics", "60", "56", "64"}, + {"English", "60", "56", "67"}, + {"Math", "61", "56", "45"}, + {"Math", "63", "58", "64"}, + {"English", "59", "54", "65"} + }; + + for (int i = 0; i < data.GetLength(0); i++) + { + chart.ChartData.SetValue(i + 2, 1, data[i, 0]); // Course name + chart.ChartData.SetValue(i + 2, 2, int.Parse(data[i, 1])); // School A + chart.ChartData.SetValue(i + 2, 3, int.Parse(data[i, 2])); // School B + chart.ChartData.SetValue(i + 2, 4, int.Parse(data[i, 3])); // School C + } + + // Set data range and chart properties + chart.DataRange = chart.ChartData[2, 1, data.GetLength(0) + 1, 4]; + + chart.PrimaryCategoryAxis.Title = "Subjects"; + chart.PrimaryValueAxis.Title = "Scores"; + chart.PrimaryValueAxis.MinimumValue = 0; + chart.PrimaryValueAxis.MaximumValue = 70; + + IOfficeChartSerie series = chart.Series[0]; + series.SerieFormat.ShowOutlierPoints = true; + series.SerieFormat.ShowMeanMarkers = true; + + series = chart.Series[1]; + series.SerieFormat.ShowOutlierPoints = true; + series.SerieFormat.ShowMeanMarkers = true; + + series = chart.Series[2]; + series.SerieFormat.ShowOutlierPoints = true; + series.SerieFormat.ShowMeanMarkers = true; + + // Set legend. + chart.HasLegend = true; + chart.Legend.Position = OfficeLegendPosition.Bottom; + + using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.docx"), FileMode.Create, FileAccess.ReadWrite)) + { + document.Save(outputFileStream, FormatType.Docx); + } + } + } + } +} diff --git a/Charts/Create-funnel-chart/.NET/Create-funnel-chart.sln b/Charts/Create-funnel-chart/.NET/Create-funnel-chart.sln new file mode 100644 index 000000000..cadec1d7a --- /dev/null +++ b/Charts/Create-funnel-chart/.NET/Create-funnel-chart.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30804.86 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Create-funnel-chart", "Create-funnel-chart\Create-funnel-chart.csproj", "{E214E65C-980A-46F5-8207-6D02212A49F5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E214E65C-980A-46F5-8207-6D02212A49F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E214E65C-980A-46F5-8207-6D02212A49F5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E214E65C-980A-46F5-8207-6D02212A49F5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E214E65C-980A-46F5-8207-6D02212A49F5}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {404A7F36-0167-4219-AE4D-2B0626CEB7E3} + EndGlobalSection +EndGlobal diff --git a/Charts/Create-funnel-chart/.NET/Create-funnel-chart/Create-funnel-chart.csproj b/Charts/Create-funnel-chart/.NET/Create-funnel-chart/Create-funnel-chart.csproj new file mode 100644 index 000000000..005186301 --- /dev/null +++ b/Charts/Create-funnel-chart/.NET/Create-funnel-chart/Create-funnel-chart.csproj @@ -0,0 +1,19 @@ + + + + Exe + net8.0 + Create_funnel_chart + + + + + + + + + Always + + + + diff --git a/Charts/Create-funnel-chart/.NET/Create-funnel-chart/Output/.gitkeep b/Charts/Create-funnel-chart/.NET/Create-funnel-chart/Output/.gitkeep new file mode 100644 index 000000000..5f282702b --- /dev/null +++ b/Charts/Create-funnel-chart/.NET/Create-funnel-chart/Output/.gitkeep @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Charts/Create-funnel-chart/.NET/Create-funnel-chart/Program.cs b/Charts/Create-funnel-chart/.NET/Create-funnel-chart/Program.cs new file mode 100644 index 000000000..e9f65627e --- /dev/null +++ b/Charts/Create-funnel-chart/.NET/Create-funnel-chart/Program.cs @@ -0,0 +1,67 @@ +using System.IO; +using Syncfusion.DocIO; +using Syncfusion.DocIO.DLS; +using Syncfusion.OfficeChart; + +namespace Create_funnel_chart +{ + class Program + { + static void Main(string[] args) + { + // Create a new Word document. + using (WordDocument document = new WordDocument()) + { + // Add a section and a paragraph. + IWSection section = document.AddSection(); + // Add a paragraph to the section. + IWParagraph paragraph = section.AddParagraph(); + + // Create and append the chart to the paragraph. + WChart chart = paragraph.AppendChart(446, 270); + // Set chart type. + chart.ChartType = OfficeChartType.Funnel; + + // Set chart title. + chart.ChartTitle = "Sales Stages - Funnel Chart"; + + // Set headers. + chart.ChartData.SetValue(1, 1, "Stage"); + chart.ChartData.SetValue(1, 2, "Amount"); + + // Add data rows. + string[,] data = { + {"Prospects", "500"}, + {"Qualified prospects", "425"}, + {"Needs analysis", "200"}, + {"Price quotes", "150"}, + {"Negotiations", "100"}, + {"Closed sales", "90"} + }; + + for (int i = 0; i < data.GetLength(0); i++) + { + chart.ChartData.SetValue(i + 2, 1, data[i, 0]); + chart.ChartData.SetValue(i + 2, 2, int.Parse(data[i, 1])); + } + + // Set data range. + chart.DataRange = chart.ChartData[2, 1, 7, 2]; + + IOfficeChartSerie series = chart.Series[0]; + series.DataPoints.DefaultDataPoint.DataLabels.IsValue = true; + series.DataPoints.DefaultDataPoint.DataLabels.Position = OfficeDataLabelPosition.Inside; + + // Set legend. + chart.HasLegend = true; + chart.Legend.Position = OfficeLegendPosition.Bottom; + + // Save the document. + using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.docx"), FileMode.Create, FileAccess.ReadWrite)) + { + document.Save(outputFileStream, FormatType.Docx); + } + } + } + } +} diff --git a/Charts/Create-histogram-chart/.NET/Create-histogram-chart.sln b/Charts/Create-histogram-chart/.NET/Create-histogram-chart.sln new file mode 100644 index 000000000..64aae0cf5 --- /dev/null +++ b/Charts/Create-histogram-chart/.NET/Create-histogram-chart.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30804.86 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Create-histogram-chart", "Create-histogram-chart\Create-histogram-chart.csproj", "{E214E65C-980A-46F5-8207-6D02212A49F5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E214E65C-980A-46F5-8207-6D02212A49F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E214E65C-980A-46F5-8207-6D02212A49F5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E214E65C-980A-46F5-8207-6D02212A49F5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E214E65C-980A-46F5-8207-6D02212A49F5}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {404A7F36-0167-4219-AE4D-2B0626CEB7E3} + EndGlobalSection +EndGlobal diff --git a/Charts/Create-histogram-chart/.NET/Create-histogram-chart/Create-histogram-chart.csproj b/Charts/Create-histogram-chart/.NET/Create-histogram-chart/Create-histogram-chart.csproj new file mode 100644 index 000000000..fc14c2a3a --- /dev/null +++ b/Charts/Create-histogram-chart/.NET/Create-histogram-chart/Create-histogram-chart.csproj @@ -0,0 +1,19 @@ + + + + Exe + net8.0 + Create_histogram_chart + + + + + + + + + Always + + + + diff --git a/Charts/Create-histogram-chart/.NET/Create-histogram-chart/Output/.gitkeep b/Charts/Create-histogram-chart/.NET/Create-histogram-chart/Output/.gitkeep new file mode 100644 index 000000000..5f282702b --- /dev/null +++ b/Charts/Create-histogram-chart/.NET/Create-histogram-chart/Output/.gitkeep @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Charts/Create-histogram-chart/.NET/Create-histogram-chart/Program.cs b/Charts/Create-histogram-chart/.NET/Create-histogram-chart/Program.cs new file mode 100644 index 000000000..52aec0344 --- /dev/null +++ b/Charts/Create-histogram-chart/.NET/Create-histogram-chart/Program.cs @@ -0,0 +1,60 @@ +using System.IO; +using Syncfusion.DocIO; +using Syncfusion.DocIO.DLS; +using Syncfusion.OfficeChart; + +namespace Create_histogram_chart +{ + class Program + { + static void Main(string[] args) + { + // Create a new Word document. + using (WordDocument document = new WordDocument()) + { + IWSection sec = document.AddSection(); + IWParagraph paragraph = sec.AddParagraph(); + + // Create and append chart + WChart chart = paragraph.AppendChart(446, 270); + chart.ChartType = OfficeChartType.Histogram; + + // Set chart title + chart.ChartTitle = "Test Scores - Histogram Chart"; + chart.ChartTitleArea.FontName = "Calibri"; + chart.ChartTitleArea.Size = 14; + + // Set chart data + chart.ChartData.SetValue(1, 1, "Test Score"); + int[] scores = { 20, 35, 40, 55, 80, 60, 61, 85, 80, 64, 80, 75 }; + for (int i = 0; i < scores.Length; i++) + { + chart.ChartData.SetValue(i + 2, 1, scores[i]); + } + // Set region of chart data. + chart.DataRange = chart.ChartData[2, 1, 13, 1]; + + // Set DataLabels. + IOfficeChartSerie series = chart.Series[0]; + series.DataPoints.DefaultDataPoint.DataLabels.IsValue = true; + series.Name = "Score"; + series.SerieFormat.CommonSerieOptions.GapWidth = 3; + + // Set legend. + chart.HasLegend = true; + chart.Legend.Position = OfficeLegendPosition.Bottom; + + //Set x-axis and y-axis title + chart.PrimaryCategoryAxis.Title = "Score Range"; + chart.PrimaryValueAxis.Title = "Number Of Candidates"; + + // 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); + } + } + } + } +} diff --git a/Charts/Create-pareto-chart/.NET/Create-pareto-chart.sln b/Charts/Create-pareto-chart/.NET/Create-pareto-chart.sln new file mode 100644 index 000000000..40dcafab4 --- /dev/null +++ b/Charts/Create-pareto-chart/.NET/Create-pareto-chart.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30804.86 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Create-pareto-chart", "Create-pareto-chart\Create-pareto-chart.csproj", "{E214E65C-980A-46F5-8207-6D02212A49F5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E214E65C-980A-46F5-8207-6D02212A49F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E214E65C-980A-46F5-8207-6D02212A49F5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E214E65C-980A-46F5-8207-6D02212A49F5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E214E65C-980A-46F5-8207-6D02212A49F5}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {404A7F36-0167-4219-AE4D-2B0626CEB7E3} + EndGlobalSection +EndGlobal diff --git a/Charts/Create-pareto-chart/.NET/Create-pareto-chart/Create-pareto-chart.csproj b/Charts/Create-pareto-chart/.NET/Create-pareto-chart/Create-pareto-chart.csproj new file mode 100644 index 000000000..6ccae06e6 --- /dev/null +++ b/Charts/Create-pareto-chart/.NET/Create-pareto-chart/Create-pareto-chart.csproj @@ -0,0 +1,19 @@ + + + + Exe + net8.0 + Create_pareto_chart + + + + + + + + + Always + + + + diff --git a/Charts/Create-pareto-chart/.NET/Create-pareto-chart/Output/.gitkeep b/Charts/Create-pareto-chart/.NET/Create-pareto-chart/Output/.gitkeep new file mode 100644 index 000000000..5f282702b --- /dev/null +++ b/Charts/Create-pareto-chart/.NET/Create-pareto-chart/Output/.gitkeep @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Charts/Create-pareto-chart/.NET/Create-pareto-chart/Program.cs b/Charts/Create-pareto-chart/.NET/Create-pareto-chart/Program.cs new file mode 100644 index 000000000..7b19382f0 --- /dev/null +++ b/Charts/Create-pareto-chart/.NET/Create-pareto-chart/Program.cs @@ -0,0 +1,74 @@ +using System.IO; +using Syncfusion.DocIO; +using Syncfusion.DocIO.DLS; +using Syncfusion.OfficeChart; + +namespace Create_pareto_chart +{ + class Program + { + static void Main(string[] args) + { + // Create a new Word document. + using (WordDocument document = new WordDocument()) + { + // Add a section and a paragraph. + IWSection section = document.AddSection(); + IWParagraph paragraph = section.AddParagraph(); + // Create and append a Pareto chart. + WChart chart = paragraph.AppendChart(446, 270); + chart.ChartType = OfficeChartType.Pareto; + chart.ChartTitle = "Monthly Expenses - Pareto Chart"; + chart.ChartTitleArea.FontName = "Calibri"; + chart.ChartTitleArea.Size = 14; + + // Populate chart data in the internal worksheet. + chart.ChartData.SetValue(1, 1, "Expenses"); + chart.ChartData.SetValue(1, 2, "Amount"); + + chart.ChartData.SetValue(2, 1, "Rent"); + chart.ChartData.SetValue(2, 2, 2300); + + chart.ChartData.SetValue(3, 1, "Car payment"); + chart.ChartData.SetValue(3, 2, 1200); + + chart.ChartData.SetValue(4, 1, "Groceries"); + chart.ChartData.SetValue(4, 2, 900); + + chart.ChartData.SetValue(5, 1, "Electricity"); + chart.ChartData.SetValue(5, 2, 600); + + chart.ChartData.SetValue(6, 1, "Gas"); + chart.ChartData.SetValue(6, 2, 500); + + chart.ChartData.SetValue(7, 1, "House loan"); + chart.ChartData.SetValue(7, 2, 300); + + chart.ChartData.SetValue(8, 1, "Wifi bill"); + chart.ChartData.SetValue(8, 2, 200); + + // Define the data range for the chart. + chart.DataRange = chart.ChartData[1, 1, 8, 2]; + + // Format the right Y-axis to show percentage. + IOfficeChartAxis rightAxis = chart.SecondaryValueAxis; + rightAxis.Title = "Cumulative Percentage"; + + // Set gap width for the first series (bars) + IOfficeChartSerie series = chart.Series[0]; + series.SerieFormat.CommonSerieOptions.GapWidth = 3; + series.DataPoints.DefaultDataPoint.DataLabels.IsValue = true; + + // Set legend. + chart.HasLegend = true; + chart.Legend.Position = OfficeLegendPosition.Bottom; + + // Save the document. + using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.docx"), FileMode.Create, FileAccess.ReadWrite)) + { + document.Save(outputFileStream, FormatType.Docx); + } + } + } + } +} diff --git a/Charts/Create-sunburst-chart/.NET/Create-sunburst-chart.sln b/Charts/Create-sunburst-chart/.NET/Create-sunburst-chart.sln new file mode 100644 index 000000000..d4328a193 --- /dev/null +++ b/Charts/Create-sunburst-chart/.NET/Create-sunburst-chart.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30804.86 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Create-sunburst-chart", "Create-sunburst-chart\Create-sunburst-chart.csproj", "{E214E65C-980A-46F5-8207-6D02212A49F5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E214E65C-980A-46F5-8207-6D02212A49F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E214E65C-980A-46F5-8207-6D02212A49F5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E214E65C-980A-46F5-8207-6D02212A49F5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E214E65C-980A-46F5-8207-6D02212A49F5}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {404A7F36-0167-4219-AE4D-2B0626CEB7E3} + EndGlobalSection +EndGlobal diff --git a/Charts/Create-sunburst-chart/.NET/Create-sunburst-chart/Create-sunburst-chart.csproj b/Charts/Create-sunburst-chart/.NET/Create-sunburst-chart/Create-sunburst-chart.csproj new file mode 100644 index 000000000..2db3ece5e --- /dev/null +++ b/Charts/Create-sunburst-chart/.NET/Create-sunburst-chart/Create-sunburst-chart.csproj @@ -0,0 +1,19 @@ + + + + Exe + net8.0 + Create_sunburst_chart + + + + + + + + + Always + + + + diff --git a/Charts/Create-sunburst-chart/.NET/Create-sunburst-chart/Output/.gitkeep b/Charts/Create-sunburst-chart/.NET/Create-sunburst-chart/Output/.gitkeep new file mode 100644 index 000000000..5f282702b --- /dev/null +++ b/Charts/Create-sunburst-chart/.NET/Create-sunburst-chart/Output/.gitkeep @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Charts/Create-sunburst-chart/.NET/Create-sunburst-chart/Program.cs b/Charts/Create-sunburst-chart/.NET/Create-sunburst-chart/Program.cs new file mode 100644 index 000000000..04c4c0faf --- /dev/null +++ b/Charts/Create-sunburst-chart/.NET/Create-sunburst-chart/Program.cs @@ -0,0 +1,78 @@ +using System.IO; +using Syncfusion.DocIO; +using Syncfusion.DocIO.DLS; +using Syncfusion.OfficeChart; + +namespace Create_pie_chart +{ + class Program + { + static void Main(string[] args) + { + //Create a new Word document. + using (WordDocument document = new WordDocument()) + { + // Add a section & a paragraph to the document. + IWSection section = document.AddSection(); + IWParagraph paragraph = section.AddParagraph(); + + // Create and append Sunburst chart to the paragraph. + WChart chart = paragraph.AppendChart(446, 270); + chart.ChartType = OfficeChartType.SunBurst; + + // Set chart title. + chart.ChartTitle = "Sales by Annual - Sunburst Chart"; + + // Set headers. + chart.ChartData.SetValue(1, 1, "Quarter"); + chart.ChartData.SetValue(1, 2, "Month"); + chart.ChartData.SetValue(1, 3, "Week"); + chart.ChartData.SetValue(1, 4, "Sales"); + + // Add data rows. + string[,] data = { + {"1st", "Jan", "", "3.5"}, + {"1st", "Feb", "Week 1", "1.2"}, + {"1st", "Feb", "Week 2", "0.8"}, + {"1st", "Feb", "Week 3", "0.6"}, + {"1st", "Feb", "Week 4", "0.5"}, + {"1st", "Mar", "", "1.7"}, + {"2nd", "Apr", "", "1.1"}, + {"2nd", "May", "", "0.8"}, + {"2nd", "Jun", "", "0.8"}, + {"3rd", "Jul", "", "1"}, + {"3rd", "Aug", "", "0.7"}, + {"3rd", "Sep", "", "0.9"}, + {"4th", "Oct", "", "2"}, + {"4th", "Nov", "", "2"}, + {"4th", "Dec", "", "2"} + }; + + for (int i = 0; i < data.GetLength(0); i++) + { + chart.ChartData.SetValue(i + 2, 1, data[i, 0]); + chart.ChartData.SetValue(i + 2, 2, data[i, 1]); + chart.ChartData.SetValue(i + 2, 3, data[i, 2]); + chart.ChartData.SetValue(i + 2, 4, float.Parse(data[i, 3])); + } + + // Set data range and hierarchy. + chart.DataRange = chart.ChartData[2, 1, data.GetLength(0) + 1, 4]; + // Set DataLabels. + IOfficeChartSerie serie = chart.Series[0]; + serie.DataPoints.DefaultDataPoint.DataLabels.IsValue = true; + + // Set legend. + chart.HasLegend = true; + chart.Legend.Position = OfficeLegendPosition.Bottom; + + //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); + } + } + } + } +} diff --git a/Charts/Create-treemap-chart/.NET/Create-treemap-chart.sln b/Charts/Create-treemap-chart/.NET/Create-treemap-chart.sln new file mode 100644 index 000000000..bd08c9a8c --- /dev/null +++ b/Charts/Create-treemap-chart/.NET/Create-treemap-chart.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30804.86 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Create-treemap-chart", "Create-treemap-chart\Create-treemap-chart.csproj", "{E214E65C-980A-46F5-8207-6D02212A49F5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E214E65C-980A-46F5-8207-6D02212A49F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E214E65C-980A-46F5-8207-6D02212A49F5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E214E65C-980A-46F5-8207-6D02212A49F5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E214E65C-980A-46F5-8207-6D02212A49F5}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {404A7F36-0167-4219-AE4D-2B0626CEB7E3} + EndGlobalSection +EndGlobal diff --git a/Charts/Create-treemap-chart/.NET/Create-treemap-chart/Create-treemap-chart.csproj b/Charts/Create-treemap-chart/.NET/Create-treemap-chart/Create-treemap-chart.csproj new file mode 100644 index 000000000..1529ea875 --- /dev/null +++ b/Charts/Create-treemap-chart/.NET/Create-treemap-chart/Create-treemap-chart.csproj @@ -0,0 +1,19 @@ + + + + Exe + net8.0 + Create_treemap_chart + + + + + + + + + Always + + + + diff --git a/Charts/Create-treemap-chart/.NET/Create-treemap-chart/Output/.gitkeep b/Charts/Create-treemap-chart/.NET/Create-treemap-chart/Output/.gitkeep new file mode 100644 index 000000000..5f282702b --- /dev/null +++ b/Charts/Create-treemap-chart/.NET/Create-treemap-chart/Output/.gitkeep @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Charts/Create-treemap-chart/.NET/Create-treemap-chart/Program.cs b/Charts/Create-treemap-chart/.NET/Create-treemap-chart/Program.cs new file mode 100644 index 000000000..ab7a33e72 --- /dev/null +++ b/Charts/Create-treemap-chart/.NET/Create-treemap-chart/Program.cs @@ -0,0 +1,73 @@ +using System.IO; +using Syncfusion.DocIO; +using Syncfusion.DocIO.DLS; +using Syncfusion.OfficeChart; + +namespace Create_pie_chart +{ + class Program + { + static void Main(string[] args) + { + //Create a new Word document. + using (WordDocument document = new WordDocument()) + { + // Add a section & a paragraph to the document. + IWSection section = document.AddSection(); + IWParagraph paragraph = section.AddParagraph(); + + // Create and append TreeMap chart to the paragraph. + WChart chart = paragraph.AppendChart(446, 270); + chart.ChartType = OfficeChartType.TreeMap; + + // Set chart title. + chart.ChartTitle = "Food Sales - Treemap Chart"; + + // Set headers. + chart.ChartData.SetValue(1, 1, "Meal"); + chart.ChartData.SetValue(1, 2, "Category"); + chart.ChartData.SetValue(1, 3, "Item"); + chart.ChartData.SetValue(1, 4, "Sales"); + + // Add data rows. + string[,] data = { + {"Breakfast", "Beverage", "coffee", "20"}, + {"Breakfast", "Beverage", "tea", "9"}, + {"Breakfast", "Food", "waffles", "12"}, + {"Breakfast", "Food", "pancakes", "35"}, + {"Breakfast", "Food", "eggs", "24"}, + {"Lunch", "Beverage", "coffee", "10"}, + {"Lunch", "Beverage", "iced tea", "45"}, + {"Lunch", "Food", "soup", "16"}, + {"Lunch", "Food", "sandwich", "36"}, + {"Lunch", "Food", "salad", "70"}, + {"Lunch", "Food", "pie", "45"}, + {"Lunch", "Food", "cookie", "25"} + }; + + for (int i = 0; i < data.GetLength(0); i++) + { + chart.ChartData.SetValue(i + 2, 1, data[i, 0]); + chart.ChartData.SetValue(i + 2, 2, data[i, 1]); + chart.ChartData.SetValue(i + 2, 3, data[i, 2]); + chart.ChartData.SetValue(i + 2, 4, int.Parse(data[i, 3])); + } + + chart.DataRange = chart.ChartData[2, 1, 13, 4]; + // Set DataLabels. + IOfficeChartSerie serie = chart.Series[0]; + serie.DataPoints.DefaultDataPoint.DataLabels.IsValue = true; + + // Set legend. + chart.HasLegend = true; + chart.Legend.Position = OfficeLegendPosition.Bottom; + + 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); + } + } + } + } +}