CellPosition Struct
Specifies a cell location as zero-based column and row indexes in chart data.
Namespace: DevExpress.Docs.Office
Assembly: DevExpress.Docs.Core.v26.1.dll
Declaration
Related API Members
The following members return CellPosition objects:
Remarks
The following code snippet uses the CellPosition structure to specify chart data for a series in a chart:
using DevExpress.Docs.Office;
using DevExpress.Docs.Presentation;
namespace PresentationApiSample;
public class Program {
public static async Task Main(string[] _) {
Presentation presentation = new Presentation();
presentation.Slides.Clear();
Slide slide = new Slide(SlideLayoutType.Blank);
presentation.Slides.Add(slide);
Chart chart = new Chart();
slide.Shapes.Add(chart);
chart.Width = presentation.SlideSize.Width;
chart.Height = presentation.SlideSize.Height;
// Specify data for the chart.
chart.Data[0, "A1"].NumericValue = 120;
chart.Data[0, "A2"].NumericValue = 95;
chart.Data[0, "A3"].NumericValue = 140;
chart.Data[0, "A4"].NumericValue = 100;
chart.Data[0, "A5"].NumericValue = 80;
chart.Data[0, "B1"].NumericValue = 10;
chart.Data[0, "B2"].NumericValue = 20;
chart.Data[0, "B3"].NumericValue = 30;
chart.Data[0, "B4"].NumericValue = 40;
chart.Data[0, "B5"].NumericValue = 50;
// Add the first series to the chart.
LineSeries series1 = new LineSeries();
series1.Values = new ChartDataReference(new CellPosition(0,0), new CellPosition(0,4));
series1.Arguments = new ChartDataReference(new CellPosition(1, 0), new CellPosition(1, 4));
chart.Series.Add(series1);
// Remove the legend.
chart.Legend = null;
// Save the presentation to a file or export it to another format.
// ...
}
}
See Also