Interface IOfficeDataRange
Represents a range of values of the chart.
Namespace: Syncfusion.OfficeChart
Assembly: Syncfusion.OfficeChart.Portable.dll
Syntax
public interface IOfficeDataRange
Properties
FirstColumn
Gets a first column of the range. Read-only.
Declaration
int FirstColumn { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Examples
IPresentation presentation = Presentation.Create();
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add chart to slide
IPresentationChart chart = slide.Shapes.AddChart(100, 120, 500, 300);
//Sets the data range of chart
chart.DataRange = chart.ChartData[1, 2, 4, 3];
//Set data to the chart- RowIndex, columnIndex and data
chart.ChartData.SetValue(1, 2, "2012");
chart.ChartData.SetValue(2, 2, 330);
chart.ChartData.SetValue(3, 2, 490);
chart.ChartData.SetValue(4, 2, 700);
//Set the chart type
chart.ChartType = OfficeChartType.Area;
//Get the first and last row
int _firstRow = chart.DataRange.FirstRow;
int _lastRow = chart.DataRange.LastRow;
//Get the first and last column
int _firstColumn = chart.DataRange.FirstColumn;
int _lastColumn = chart.DataRange.LastColumn;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
FirstRow
Gets a first row of the range. Read-only.
Declaration
int FirstRow { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Examples
IPresentation presentation = Presentation.Create();
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add chart to slide
IPresentationChart chart = slide.Shapes.AddChart(100, 120, 500, 300);
//Sets the data range of chart
chart.DataRange = chart.ChartData[1, 2, 4, 3];
//Set data to the chart- RowIndex, columnIndex and data
chart.ChartData.SetValue(1, 2, "2012");
chart.ChartData.SetValue(2, 2, 330);
chart.ChartData.SetValue(3, 2, 490);
chart.ChartData.SetValue(4, 2, 700);
//Set the chart type
chart.ChartType = OfficeChartType.Area;
//Get the first and last row
int _firstRow = chart.DataRange.FirstRow;
int _lastRow = chart.DataRange.LastRow;
//Get the first and last column
int _firstColumn = chart.DataRange.FirstColumn;
int _lastColumn = chart.DataRange.LastColumn;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
LastColumn
Gets a last column of the range. Read-only.
Declaration
int LastColumn { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Examples
IPresentation presentation = Presentation.Create();
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add chart to slide
IPresentationChart chart = slide.Shapes.AddChart(100, 120, 500, 300);
//Sets the data range of chart
chart.DataRange = chart.ChartData[1, 2, 4, 3];
//Set data to the chart- RowIndex, columnIndex and data
chart.ChartData.SetValue(1, 2, "2012");
chart.ChartData.SetValue(2, 2, 330);
chart.ChartData.SetValue(3, 2, 490);
chart.ChartData.SetValue(4, 2, 700);
//Set the chart type
chart.ChartType = OfficeChartType.Area;
//Get the first and last row
int _firstRow = chart.DataRange.FirstRow;
int _lastRow = chart.DataRange.LastRow;
//Get the first and last column
int _firstColumn = chart.DataRange.FirstColumn;
int _lastColumn = chart.DataRange.LastColumn;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
LastRow
Gets a last row of the range. Read-only.
Declaration
int LastRow { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Examples
IPresentation presentation = Presentation.Create();
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add chart to slide
IPresentationChart chart = slide.Shapes.AddChart(100, 120, 500, 300);
//Sets the data range of chart
chart.DataRange = chart.ChartData[1, 2, 4, 3];
//Set data to the chart- RowIndex, columnIndex and data
chart.ChartData.SetValue(1, 2, "2012");
chart.ChartData.SetValue(2, 2, 330);
chart.ChartData.SetValue(3, 2, 490);
chart.ChartData.SetValue(4, 2, 700);
//Set the chart type
chart.ChartType = OfficeChartType.Area;
//Get the first and last row
int _firstRow = chart.DataRange.FirstRow;
int _lastRow = chart.DataRange.LastRow;
//Get the first and last column
int _firstColumn = chart.DataRange.FirstColumn;
int _lastColumn = chart.DataRange.LastColumn;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
Methods
GetValue(Int32, Int32)
Returns the cell value.
Declaration
object GetValue(int rowIndex, int columnIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | One-based row index of the cell to get value from. |
System.Int32 | columnIndex | One-based column index of the cell to get value from. |
Returns
Type | Description |
---|---|
System.Object | Returns value corresponding to the cell. |
Examples
IPresentation presentation = Presentation.Create();
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add chart to the slide with position and size
IPresentationChart chart = slide.Charts.AddChart(100, 10, 500, 300);
//Set chart data - Row1
chart.ChartData.SetValue(1, 2, "Jan");
chart.ChartData.SetValue(1, 3, "Feb");
chart.ChartData.SetValue(1, 4, "March");
//Set chart data - Row2
chart.ChartData.SetValue(2, 1, "2011");
chart.ChartData.SetValue(2, 2, "60");
chart.ChartData.SetValue(2, 3, "70");
chart.ChartData.SetValue(2, 4, "80");
//Set chart data - Row3
chart.ChartData.SetValue(3, 1, "2009");
chart.ChartData.SetValue(3, 2, "80");
chart.ChartData.SetValue(3, 3, "70");
chart.ChartData.SetValue(3, 4, "60");
//Set chart data - Row4
chart.ChartData.SetValue(4, 1, "2010");
chart.ChartData.SetValue(4, 2, "60");
chart.ChartData.SetValue(4, 3, "70");
chart.ChartData.SetValue(4, 4, "80");
//Create a new chart series with the name
IOfficeChartSerie serieJan = chart.Series.Add("Jan");
//Set the data range of chart serie – start row, start column, end row, end column
serieJan.Values = chart.ChartData[2, 2, 4, 2];
//Create a new chart series with the name
IOfficeChartSerie serieFeb = chart.Series.Add("Feb");
//Set the data range of chart serie – start row, start column, end row, end column
serieFeb.Values = chart.ChartData[2, 3, 4, 3];
//Get data from the chart using specific RowIndex and columnIndex
object value = chart.DataRange.GetValue(2, 3);
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
SetValue(Int32, Int32, Double)
Sets the value in the specified cell.
Declaration
void SetValue(int rowIndex, int columnIndex, double value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | One-based row index of the cell to set value. |
System.Int32 | columnIndex | One-based column index of the cell to set value. |
System.Double | value | Value to set. |
SetValue(Int32, Int32, Int32)
Sets the value in the specified cell.
Declaration
void SetValue(int rowIndex, int columnIndex, int value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | One-based row index of the cell to set value. |
System.Int32 | columnIndex | One-based column index of the cell to set value. |
System.Int32 | value | Value to set. |
SetValue(Int32, Int32, Object)
Sets the value in the specified cell.
Declaration
void SetValue(int rowIndex, int columnIndex, object value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | One-based row index of the cell to set value. |
System.Int32 | columnIndex | One-based column index of the cell to set value. |
System.Object | value | Value to set. |
SetValue(Int32, Int32, String)
Sets the value in the specified cell.
Declaration
void SetValue(int rowIndex, int columnIndex, string value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | One-based row index of the cell to set value. |
System.Int32 | columnIndex | One-based column index of the cell to set value. |
System.String | value | Value to set. |