Skip to content

Commit 989dbee

Browse files
Update chart-data.md
1 parent 9b8e85c commit 989dbee

File tree

1 file changed

+30
-22
lines changed

1 file changed

+30
-22
lines changed

libraries/radspreadprocessing/features/charts/chart-data.md

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,28 +30,36 @@ The **FormulaChartData** type is abstract and it is implemented by the **Workboo
3030

3131
{{region radspreadprocessing-features-charts-chart-data_0}}
3232

33-
Workbook workbook = new Workbook();
34-
Worksheet worksheet = workbook.Worksheets.Add();
35-
FloatingChartShape chartShape = new FloatingChartShape(worksheet, new CellIndex(1, 1), new CellRange(1, 1, 1, 1), ChartType.Column)
36-
{
37-
Width = 400,
38-
Height = 200
39-
};
40-
41-
DocumentChart chart = chartShape.Chart;
42-
BarSeriesGroup barSeriesGroup = chart.SeriesGroups.First() as BarSeriesGroup;
43-
barSeriesGroup.BarDirection = BarDirection.Column;
44-
45-
StringChartData barCategoryData = new StringChartData(new List<string> { "New", "In Progress", "Ready for Test", "Done", "Declined" });
46-
NumericChartData barValueScore1Data = new NumericChartData(new List<double> { 75.31, 66.3, 62.78, 61.72, 63.9 });
47-
NumericChartData barValueScore2Data = new NumericChartData(new List<double> { 78.56, 70.7, 67.63, 66.71, 63.9 });
48-
barSeriesGroup.Series.Remove(barSeriesGroup.Series.First());
49-
barSeriesGroup.Series.Add(barCategoryData, barValueScore1Data);
50-
barSeriesGroup.Series.Add(barCategoryData, barValueScore2Data);
51-
worksheet.Charts.Add(chartShape);
52-
53-
worksheet.Charts[0].Chart.SeriesGroups.First().Series.First().Title = new TextTitle("Team 1");
54-
worksheet.Charts[0].Chart.SeriesGroups.First().Series.Last().Title = new TextTitle("Team 2");
33+
FloatingChartShape chartShape = new FloatingChartShape(worksheet, new CellIndex(1, 1), new CellRange(1, 1, 1, 1), ChartType.Column)
34+
{
35+
Width = 460,
36+
Height = 250
37+
};
38+
39+
DocumentChart chart = new DocumentChart();
40+
BarSeriesGroup barSeriesGroup = new BarSeriesGroup();
41+
barSeriesGroup.BarDirection = BarDirection.Column;
42+
43+
StringChartData barCategoryData = new StringChartData(new List<string> { "New", "In Progress", "Ready for Test", "Done", "Declined" });
44+
NumericChartData barValueScore1Data = new NumericChartData(new List<double> { 75.31, 66.3, 62.78, 61.72, 63.9 });
45+
NumericChartData barValueScore2Data = new NumericChartData(new List<double> { 78.56, 70.7, 67.63, 66.71, 63.9 });
46+
barSeriesGroup.Series.Add(barCategoryData, barValueScore1Data);
47+
barSeriesGroup.Series.Add(barCategoryData, barValueScore2Data);
48+
chart.SeriesGroups.Add(barSeriesGroup);
49+
ValueAxis valueAxis = new ValueAxis();
50+
valueAxis.Outline.Fill = new SolidFill(new ThemableColor(ThemeColorType.Text1, 0.85));
51+
valueAxis.Outline.Width = 0.75;
52+
53+
CategoryAxis categoryAxis = new CategoryAxis();
54+
categoryAxis.Outline.Fill = new SolidFill(new ThemableColor(ThemeColorType.Text1, 0.85));
55+
categoryAxis.Outline.Width = 0.75;
56+
57+
chart.PrimaryAxes = new AxisGroup(categoryAxis, valueAxis);
58+
worksheet.Charts.Add(chartShape);
59+
60+
worksheet.Charts[0].Chart.SeriesGroups.First().Series.First().Title = new TextTitle("Team 1");
61+
worksheet.Charts[0].Chart.SeriesGroups.First().Series.Last().Title = new TextTitle("Team 2");
62+
chartShape.Chart = chart;
5563

5664
{{endregion}}
5765

0 commit comments

Comments
 (0)