Skip to content

Commit 7814785

Browse files
added comment
1 parent 88c7a77 commit 7814785

File tree

1 file changed

+0
-11
lines changed
  • Charts/Set-text-right-to-stacked-bar-chart/.NET/Set-text-right-to-stacked-bar-chart

1 file changed

+0
-11
lines changed

Charts/Set-text-right-to-stacked-bar-chart/.NET/Set-text-right-to-stacked-bar-chart/Program.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,47 +5,36 @@
55
{
66
// Adds a section to the document.
77
IWSection sec = document.AddSection();
8-
98
// Adds a paragraph to the section.
109
IWParagraph paragraph = sec.AddParagraph();
11-
1210
// Loads the Excel file as a stream.
1311
Stream excelStream = File.OpenRead(Path.GetFullPath("Data/InputTemplate.xlsx"));
14-
1512
// Creates and appends a chart to the paragraph with the Excel stream as a parameter.
1613
// The chart is created based on the data from the Excel file (range A1:D6), with specified width and height.
1714
WChart chart = paragraph.AppendChart(excelStream, 1, "A1:D6", 470, 300);
18-
1915
// Sets the chart type to Stacked Bar Chart.
2016
chart.ChartType = Syncfusion.OfficeChart.OfficeChartType.Bar_Stacked;
21-
2217
// Apply chart elements.
2318
// Sets the chart title.
2419
chart.ChartTitle = "Stacked Bar Chart";
25-
2620
// Displays data labels for the third series (Series 2).
2721
chart.Series[2].DataPoints.DefaultDataPoint.DataLabels.IsValue = true;
2822

2923
// Manually positions the data labels for each data point in the third series.
3024
chart.Series[2].DataPoints[0].DataLabels.Text = "Label 1";
3125
chart.Series[2].DataPoints[0].DataLabels.Layout.ManualLayout.Left = 0.1;
32-
3326
chart.Series[2].DataPoints[1].DataLabels.Text = "Label 2";
3427
chart.Series[2].DataPoints[1].DataLabels.Layout.ManualLayout.Left = 0.1;
35-
3628
chart.Series[2].DataPoints[2].DataLabels.Text = "Label 3";
3729
chart.Series[2].DataPoints[2].DataLabels.Layout.ManualLayout.Left = 0.13;
38-
3930
chart.Series[2].DataPoints[3].DataLabels.Text = "Label 4";
4031
chart.Series[2].DataPoints[3].DataLabels.Layout.ManualLayout.Left = 0.18;
41-
4232
chart.Series[2].DataPoints[4].DataLabels.Text = "Label 5";
4333
chart.Series[2].DataPoints[4].DataLabels.Layout.ManualLayout.Left = 0.20;
4434

4535
// Sets the chart legend and positions it at the bottom of the chart.
4636
chart.HasLegend = true;
4737
chart.Legend.Position = Syncfusion.OfficeChart.OfficeLegendPosition.Bottom;
48-
4938
using (FileStream outputStream = new FileStream(Path.GetFullPath("Output/Result.docx"), FileMode.Create, FileAccess.Write))
5039
{
5140
// Saves the generated Word document to the specified file stream in DOCX format.

0 commit comments

Comments
 (0)