@@ -27,26 +27,35 @@ The **FormulaChartData** type is abstract and it is implemented by the **Workboo
2727- Workbook ** Workbook** : Gets the workbook that the formula refers to get the chart data.
2828
2929#### [ C#] Example 1: Using IChartData
30+
3031{{region radspreadprocessing-features-charts-chart-data_0}}
3132
32- BarSeriesGroup barSeriesGroup = new BarSeriesGroup();
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");
3355
34- StringChartData barCategoryData = new StringChartData(new List<string> { "category 1", "category 2", "category 3" });
35- NumericChartData barValueData = new NumericChartData(new List<double> { 1, 2, 3 });
36- FormulaChartData barSeriesTitle = new WorkbookFormulaChartData(workbook, "Sheet1!A1");
56+ {{endregion}}
3757
38- barSeriesGroup.Series.Add(barCategoryData, barValueData, new FormulaTitle(barSeriesTitle));
58+ > caption Using Chart Data in RadSpreadProcessing
3959
40- DocumentChart chart = new DocumentChart();
41- chart.SeriesGroups.Add(barSeriesGroup);
42-
43- // Add the chart to the worksheet
44- Worksheet worksheet = workbook.ActiveWorksheet;
45- FloatingChartShape chartShape = new FloatingChartShape(worksheet, new CellIndex(6, 4), new CellRange(1, 1, 5, 2), ChartType.Column)
46- {
47- Width = 460,
48- Height = 250
49- };
60+ ![ Spread Chart Data] ( images/spread-chart-data.png )
5061
51- worksheet.Charts.Add(chartShape);
52- {{endregion}}
0 commit comments