Interface IOfficeChart
Represents a chart in a document
Namespace: Syncfusion.OfficeChart
Assembly: Syncfusion.OfficeChart.Base.dll
Syntax
public interface IOfficeChart
Properties
AutoScaling
Gets or sets whether chart has 3-D scaling. RightAngleAxes property must be true.
Declaration
bool AutoScaling { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Examples
//Create a presentation instance
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add chart to the slide with position and size
IPresentationChart chart = slide.Charts.AddChart(100, 10, 700, 500);
//Specify the chart title
chart.ChartTitle = "Sales Analysis";
//Specify the chart type
chart.ChartType = OfficeChartType.Column_Clustered;
//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, "2010");
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, "2011");
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, "2012");
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];
//Create a new chart series with the name
IOfficeChartSerie serieMarch = chart.Series.Add("March");
//Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData[2, 4, 4, 4];
//Set the data range of the category axis
chart.PrimaryCategoryAxis.CategoryLabels = chart.ChartData[2, 1, 4, 1];
//Set the right angle axes property of the chart
chart.RightAngleAxes = true;
//Set the auto scaling of chart
chart.AutoScaling = true;
//Save the presentation
presentation.Save("sample.pptx");
//Close the presentation
presentation.Close();
'Create a presentation instance
Dim presentation As IPresentation = Presentation.Create()
'Add a blank slide to the presentation
Dim slide As ISlide = presentation.Slides.Add(SlideLayoutType.Blank)
'Add chart to the slide with position and size
Dim chart As IPresentationChart = 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, "2010")
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, "2011")
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, "2012")
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
Dim serieJan As IOfficeChartSerie = 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
Dim serieFeb As IOfficeChartSerie = 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)
'Create a new chart series with the name
Dim serieMarch As IOfficeChartSerie = chart.Series.Add("March")
'Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData(2, 4, 4, 4)
'Set the right angle axes
chart.RightAngleAxes = True
'Set the auto scaling of chart
chart.AutoScaling = True
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
BackWall
Gets an object that allows to individually format the back wall of a 3-D chart. Read-only.
Declaration
IOfficeChartWallOrFloor BackWall { get; }
Property Value
Type | Description |
---|---|
IOfficeChartWallOrFloor |
Examples
//Create a presentation instance
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add chart to the slide with position and size
IPresentationChart chart = slide.Charts.AddChart(100, 10, 700, 500);
//Specify the chart title
chart.ChartTitle = "Sales Analysis";
//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, "2010");
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, "2011");
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, "2012");
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];
//Create a new chart series with the name
IOfficeChartSerie serieMarch = chart.Series.Add("March");
//Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData[2, 4, 4, 4];
//Set the data range of the category axis
chart.PrimaryCategoryAxis.CategoryLabels = chart.ChartData[2, 1, 4, 1];
//Specify the chart type
chart.ChartType = OfficeChartType.Surface_3D;
//Get the back wall of the chart
IOfficeChartWallOrFloor backWall = chart.BackWall;
//Set the line properties of the back wall
backWall.LineProperties.LineWeight = OfficeChartLineWeight.Narrow;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create a presentation instance
Dim presentation As IPresentation = Presentation.Create()
'Add a blank slide to the presentation
Dim slide As ISlide = presentation.Slides.Add(SlideLayoutType.Blank)
'Add chart to the slide with position and size
Dim chart As IPresentationChart = slide.Charts.AddChart(100, 10, 700, 500)
'Specify the chart title
chart.ChartTitle = "Sales Analysis"
'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, "2010")
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, "2011")
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, "2012")
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
Dim serieJan As IOfficeChartSerie = 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
Dim serieFeb As IOfficeChartSerie = 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)
'Create a new chart series with the name
Dim serieMarch As IOfficeChartSerie = chart.Series.Add("March")
'Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData(2, 4, 4, 4)
'Set the data range of the category axis
chart.PrimaryCategoryAxis.CategoryLabels = chart.ChartData(2, 1, 4, 1)
'Specify the chart type
chart.ChartType = OfficeChartType.Surface_3D
'Get the back wall of the chart
Dim backWall As IOfficeChartWallOrFloor = chart.BackWall
'Set the line properties of the back wall
backWall.LineProperties.LineWeight = OfficeChartLineWeight.Narrow
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
Categories
Gets the collection of the all categories of this chart. Read-only.
Declaration
IOfficeChartCategories Categories { get; }
Property Value
Type | Description |
---|---|
IOfficeChartCategories |
CategoryLabelLevel
Gets or sets an OfficeCategoriesLabelLevel constant that specifies the source level of the chart category labels.
Declaration
OfficeCategoriesLabelLevel CategoryLabelLevel { get; set; }
Property Value
Type | Description |
---|---|
OfficeCategoriesLabelLevel |
Examples
//Create a presentation instance
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add chart to the slide with position and size
IPresentationChart chart = slide.Charts.AddChart(100, 10, 700, 500);
//Specify the chart title
chart.ChartTitle = "Sales Analysis";
//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, "2010");
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, "2011");
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, "2012");
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];
//Create a new chart series with the name
IOfficeChartSerie serieMarch = chart.Series.Add("March");
//Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData[2, 4, 4, 4];
//Set the data range of the category axis
chart.PrimaryCategoryAxis.CategoryLabels = chart.ChartData[2, 1, 4, 1];
//Specify the chart type
chart.ChartType = OfficeChartType.Surface_3D;
//Set the category label level
chart.CategoryLabelLevel = OfficeCategoriesLabelLevel.CategoriesLabelLevelAll;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create a presentation instance
Dim presentation As IPresentation = Presentation.Create()
'Add a blank slide to the presentation
Dim slide As ISlide = presentation.Slides.Add(SlideLayoutType.Blank)
'Add chart to the slide with position and size
Dim chart As IPresentationChart = slide.Charts.AddChart(100, 10, 700, 500)
'Specify the chart title
chart.ChartTitle = "Sales Analysis"
'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, "2010")
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, "2011")
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, "2012")
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
Dim serieJan As IOfficeChartSerie = 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
Dim serieFeb As IOfficeChartSerie = 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)
'Create a new chart series with the name
Dim serieMarch As IOfficeChartSerie = chart.Series.Add("March")
'Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData(2, 4, 4, 4)
'Set the data range of the category axis
chart.PrimaryCategoryAxis.CategoryLabels = chart.ChartData(2, 1, 4, 1)
'Specify the chart type
chart.ChartType = OfficeChartType.Surface_3D
'Set the category label level
chart.CategoryLabelLevel = OfficeCategoriesLabelLevel.CategoriesLabelLevelAll
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
ChartArea
Gets an object that represents the complete chart area for the chart. Read-only.
Declaration
IOfficeChartFrameFormat ChartArea { get; }
Property Value
Type | Description |
---|---|
IOfficeChartFrameFormat |
Examples
//Create a new presentation
IPresentation presentation = Presentation.Create();
//Add slide to the presentation
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add chart to slide
IPresentationChart chart = slide.Shapes.AddChart(100, 100, 400, 300);
//Set the chart data value
chart.ChartData.SetValue(1, 2, "1");
chart.ChartData.SetValue(2, 1, "A");
chart.ChartData.SetValue(2, 2, 20);
//Set chart data range
chart.DataRange = chart.ChartData[2, 2, 4, 4];
//Set the chart type
chart.ChartType = OfficeChartType.Column_Clustered;
//Get the chart area
IOfficeChartFrameFormat chartArea = chart.ChartArea;
//Set the line pattern of chart border
chartArea.Border.LinePattern = OfficeChartLinePattern.DashDotDot;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation
Dim presentation As IPresentation = Presentation.Create()
'Add slide to the presentation
Dim slide As ISlide = presentation.Slides.Add(SlideLayoutType.Blank)
'Add chart to slide
Dim chart As IPresentationChart = slide.Shapes.AddChart(100, 100, 400, 300)
'Set the chart data value
chart.ChartData.SetValue(1, 2, "1")
chart.ChartData.SetValue(2, 1, "A")
chart.ChartData.SetValue(2, 2, 20)
'Set chart data range
chart.DataRange = chart.ChartData(2, 2, 4, 4)
'Set the chart type
chart.ChartType = OfficeChartType.Column_Clustered
'Get the chart area
Dim chartArea As IOfficeChartFrameFormat = chart.ChartArea
'Set the line pattern of chart border
chartArea.Border.LinePattern = OfficeChartLinePattern.DashDotDot
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
ChartData
Gets an information about the linked or embedded data associated with a chart. Read-only.
Declaration
IOfficeChartData ChartData { get; }
Property Value
Type | Description |
---|---|
IOfficeChartData |
Examples
//Create a presentation instance
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add chart to the slide with position and size
IPresentationChart chart = slide.Charts.AddChart(100, 10, 700, 500);
//Specify the chart title
chart.ChartTitle = "Sales Analysis";
//Specify the chart type
chart.ChartType = OfficeChartType.Column_Clustered;
//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, "2010");
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, "2011");
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, "2012");
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];
//Create a new chart series with the name
IOfficeChartSerie serieMarch = chart.Series.Add("March");
//Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData[2, 4, 4, 4];
//Set the data range of the category axis
chart.PrimaryCategoryAxis.CategoryLabels = chart.ChartData[2, 1, 4, 1];
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create a presentation instance
Dim presentation As IPresentation = Presentation.Create()
'Add a blank slide to the presentation
Dim slide As ISlide = presentation.Slides.Add(SlideLayoutType.Blank)
'Add chart to the slide with position and size
Dim chart As IPresentationChart = slide.Charts.AddChart(100, 10, 700, 500)
'Specify the chart title
chart.ChartTitle = "Sales Analysis"
'Specify the chart type
chart.ChartType = OfficeChartType.Column_Clustered
'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, "2010")
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, "2011")
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, "2012")
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
Dim serieJan As IOfficeChartSerie = 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
Dim serieFeb As IOfficeChartSerie = 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)
'Create a new chart series with the name
Dim serieMarch As IOfficeChartSerie = chart.Series.Add("March")
'Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData(2, 4, 4, 4)
'Set the data range of the category axis
chart.PrimaryCategoryAxis.CategoryLabels = chart.ChartData(2, 1, 4, 1)
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
ChartTitle
Gets or sets the Title of the chart.
Declaration
string ChartTitle { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Examples
//Create a presentation instance
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add chart to the slide with position and size
IPresentationChart chart = slide.Charts.AddChart(100, 10, 700, 500);
//Specify the chart title
chart.ChartTitle = "Sales Analysis";
//Specify the chart type
chart.ChartType = OfficeChartType.Column_Clustered;
//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, "2010");
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, "2011");
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, "2012");
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];
//Create a new chart series with the name
IOfficeChartSerie serieMarch = chart.Series.Add("March");
//Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData[2, 4, 4, 4];
//Set the data range of the category axis
chart.PrimaryCategoryAxis.CategoryLabels = chart.ChartData[2, 1, 4, 1];
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create a presentation instance
Dim presentation As IPresentation = Presentation.Create()
'Add a blank slide to the presentation
Dim slide As ISlide = presentation.Slides.Add(SlideLayoutType.Blank)
'Add chart to the slide with position and size
Dim chart As IPresentationChart = slide.Charts.AddChart(100, 10, 700, 500)
'Specify the chart title
chart.ChartTitle = "Sales Analysis"
'Specify the chart type
chart.ChartType = OfficeChartType.Column_Clustered
'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, "2010")
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, "2011")
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, "2012")
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
Dim serieJan As IOfficeChartSerie = 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
Dim serieFeb As IOfficeChartSerie = 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)
'Create a new chart series with the name
Dim serieMarch As IOfficeChartSerie = chart.Series.Add("March")
'Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData(2, 4, 4, 4)
'Set the data range of the category axis
chart.PrimaryCategoryAxis.CategoryLabels = chart.ChartData(2, 1, 4, 1)
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
ChartTitleArea
Gets an object that represents the title area for the chart. Read-only.
Declaration
IOfficeChartTextArea ChartTitleArea { get; }
Property Value
Type | Description |
---|---|
IOfficeChartTextArea |
Examples
//Create a presentation instance
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add chart to the slide with position and size
IPresentationChart chart = slide.Charts.AddChart(100, 10, 700, 500);
//Specify the chart title
chart.ChartTitle = "Sales Analysis";
//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, "2010");
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, "2011");
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, "2012");
chart.ChartData.SetValue(4, 2, "60");
chart.ChartData.SetValue(4, 3, "70");
chart.ChartData.SetValue(4, 4, "80");
//Specify the chart type
chart.ChartType = OfficeChartType.Surface_3D;
//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];
//Create a new chart series with the name
IOfficeChartSerie serieMarch = chart.Series.Add("March");
//Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData[2, 4, 4, 4];
//Set the data range of the category axis
chart.PrimaryCategoryAxis.CategoryLabels = chart.ChartData[2, 1, 4, 1];
//Get the chart title text area
IOfficeChartTextArea textArea = chart.ChartTitleArea;
//Set the background mode of the title area
textArea.BackgroundMode = OfficeChartBackgroundMode.Transparent;
//Set bold font style
textArea.Bold = true;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create a presentation instance
Dim presentation As IPresentation = Presentation.Create()
'Add a blank slide to the presentation
Dim slide As ISlide = presentation.Slides.Add(SlideLayoutType.Blank)
'Add chart to the slide with position and size
Dim chart As IPresentationChart = slide.Charts.AddChart(100, 10, 700, 500)
'Specify the chart title
chart.ChartTitle = "Sales Analysis"
'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, "2010")
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, "2011")
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, "2012")
chart.ChartData.SetValue(4, 2, "60")
chart.ChartData.SetValue(4, 3, "70")
chart.ChartData.SetValue(4, 4, "80")
'Specify the chart type
chart.ChartType = OfficeChartType.Surface_3D
'Create a new chart series with the name
Dim serieJan As IOfficeChartSerie = 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
Dim serieFeb As IOfficeChartSerie = 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)
'Create a new chart series with the name
Dim serieMarch As IOfficeChartSerie = chart.Series.Add("March")
'Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData(2, 4, 4, 4)
'Set the data range of the category axis
chart.PrimaryCategoryAxis.CategoryLabels = chart.ChartData(2, 1, 4, 1)
'Get the chart title text area
Dim textArea As IOfficeChartTextArea = chart.ChartTitleArea
'Set the background mode of the title area
textArea.BackgroundMode = OfficeChartBackgroundMode.Transparent
'Set bold font style
textArea.Bold = True
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
ChartType
Gets or sets the Chart Type.
Declaration
OfficeChartType ChartType { get; set; }
Property Value
Type | Description |
---|---|
OfficeChartType |
Examples
//Create a presentation instance
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add chart to the slide with position and size
IPresentationChart chart = slide.Charts.AddChart(100, 10, 700, 500);
//Specify the chart title
chart.ChartTitle = "Sales Analysis";
//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, "2010");
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, "2011");
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, "2012");
chart.ChartData.SetValue(4, 2, "60");
chart.ChartData.SetValue(4, 3, "70");
chart.ChartData.SetValue(4, 4, "80");
//Specify the chart type
chart.ChartType = OfficeChartType.Surface_3D;
//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];
//Create a new chart series with the name
IOfficeChartSerie serieMarch = chart.Series.Add("March");
//Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData[2, 4, 4, 4];
//Set the data range of the category axis
chart.PrimaryCategoryAxis.CategoryLabels = chart.ChartData[2, 1, 4, 1];
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create a presentation instance
Dim presentation As IPresentation = Presentation.Create()
'Add a blank slide to the presentation
Dim slide As ISlide = presentation.Slides.Add(SlideLayoutType.Blank)
'Add chart to the slide with position and size
Dim chart As IPresentationChart = slide.Charts.AddChart(100, 10, 700, 500)
'Specify the chart title
chart.ChartTitle = "Sales Analysis"
'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, "2010")
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, "2011")
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, "2012")
chart.ChartData.SetValue(4, 2, "60")
chart.ChartData.SetValue(4, 3, "70")
chart.ChartData.SetValue(4, 4, "80")
'Specify the chart type
chart.ChartType = OfficeChartType.Surface_3D
'Create a new chart series with the name
Dim serieJan As IOfficeChartSerie = 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
Dim serieFeb As IOfficeChartSerie = 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)
'Create a new chart series with the name
Dim serieMarch As IOfficeChartSerie = chart.Series.Add("March")
'Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData(2, 4, 4, 4)
'Set the data range of the category axis
chart.PrimaryCategoryAxis.CategoryLabels = chart.ChartData(2, 1, 4, 1)
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
DataRange
Gets or sets the DataRange for the chart series.
Declaration
IOfficeDataRange DataRange { get; set; }
Property Value
Type | Description |
---|---|
IOfficeDataRange |
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);
chart.ChartType = OfficeChartType.Area;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
Dim presentation As IPresentation = Presentation.Create()
Dim slide As ISlide = presentation.Slides.Add(SlideLayoutType.Blank)
'Add chart to slide
Dim chart As IPresentationChart = 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)
chart.ChartType = OfficeChartType.Area
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
DataTable
Gets the charts dataTable object.
Declaration
IOfficeChartDataTable DataTable { get; }
Property Value
Type | Description |
---|---|
IOfficeChartDataTable |
Examples
IPresentation presentation = Presentation.Open("Template.pptx");
ISlide slide = presentation.Slides[0];
//Get the chart from slide
IPresentationChart chart = slide.Shapes[0] as IPresentationChart;
//Set the chart with data table
chart.HasDataTable = true;
//Get the data table, read only
IOfficeChartDataTable dataTable = chart.DataTable;
//set borders for data table
dataTable.HasBorders = true;
//Set the show serie keys
dataTable.ShowSeriesKeys = true;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
Dim presentation As IPresentation = Presentation.Open("Template.pptx")
Dim slide As ISlide = presentation.Slides(0)
'Get the chart from slide
Dim chart As IPresentationChart = TryCast(slide.Shapes(0), IPresentationChart)
'Set the chart with data table
chart.HasDataTable = True
'Get the data table, read only
Dim dataTable As IOfficeChartDataTable = chart.DataTable
'set borders for data table
dataTable.HasBorders = True
'Set the show serie keys
dataTable.ShowSeriesKeys = True
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
DepthPercent
Gets or sets the depth of a 3-D chart as a percentage of the chart width (between 20 and 2000 percent).
Declaration
int DepthPercent { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Examples
IPresentation presentation = Presentation.Open("Template.pptx");
ISlide slide = presentation.Slides[0];
//Get the chart from slide
IPresentationChart chart = slide.Shapes[0] as IPresentationChart;
//set the chart type
chart.ChartType = OfficeChartType.Column_3D;
//Set the height percent
chart.HeightPercent = 400;
//Set the Depth percent
chart.DepthPercent = 200;
//Set the gap depth of data series
chart.GapDepth = 400;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
Dim presentation As IPresentation = Presentation.Open("Template.pptx")
Dim slide As ISlide = presentation.Slides(0)
'Get the chart from slide
Dim chart As IPresentationChart = TryCast(slide.Shapes(0), IPresentationChart)
'set the chart type
chart.ChartType = OfficeChartType.Column_3D
'Set the height percent
chart.HeightPercent = 400
'Set the Depth percent
chart.DepthPercent = 200
'Set the gap depth of data series
chart.GapDepth = 400
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
DisplayBlanksAs
Gets or sets the way that blank cells are plotted on a chart.
Declaration
OfficeChartPlotEmpty DisplayBlanksAs { get; set; }
Property Value
Type | Description |
---|---|
OfficeChartPlotEmpty |
Examples
IPresentation presentation = Presentation.Open("Template.pptx");
ISlide slide = presentation.Slides[0];
//Get the chart from slide
IPresentationChart chart = slide.Shapes[0] as IPresentationChart;
//set the chart type
chart.ChartType = OfficeChartType.Column_3D;
//Set the way blank cells to be plotted
chart.DisplayBlanksAs = OfficeChartPlotEmpty.Interpolated;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
Dim presentation As IPresentation = Presentation.Open("Template.pptx")
Dim slide As ISlide = presentation.Slides(0)
'Get the chart from slide
Dim chart As IPresentationChart = TryCast(slide.Shapes(0), IPresentationChart)
'set the chart type
chart.ChartType = OfficeChartType.Column_3D
'Set the way blank cells to be plotted
chart.DisplayBlanksAs = OfficeChartPlotEmpty.Interpolated
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
Elevation
Gets or sets the elevation of the 3-D chart view, in degrees (�90 to +90 degrees).
Declaration
int Elevation { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Examples
//Create a presentation instance
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation
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, "2010");
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, "2011");
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, "2012");
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];
//Create a new chart series with the name
IOfficeChartSerie serieMarch = chart.Series.Add("March");
//Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData[2, 4, 4, 4];
//set the chart type
chart.ChartType = OfficeChartType.Column_3D;
//Set the elevation of chart
chart.Elevation = -50;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create a presentation instance
Dim presentation As IPresentation = Presentation.Create()
'Add a blank slide to the presentation
Dim slide As ISlide = presentation.Slides.Add(SlideLayoutType.Blank)
'Add chart to the slide with position and size
Dim chart As IPresentationChart = 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, "2010")
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, "2011")
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, "2012")
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
Dim serieJan As IOfficeChartSerie = 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
Dim serieFeb As IOfficeChartSerie = 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)
'Create a new chart series with the name
Dim serieMarch As IOfficeChartSerie = chart.Series.Add("March")
'Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData(2, 4, 4, 4)
'set the chart type
chart.ChartType = OfficeChartType.Column_3D
'Set the elevation of chart
chart.Elevation = -50
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
Floor
Gets the floor of the 3-D chart. Read-only.
Declaration
IOfficeChartWallOrFloor Floor { get; }
Property Value
Type | Description |
---|---|
IOfficeChartWallOrFloor |
Examples
//Create a presentation instance
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation
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, "2010");
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, "2011");
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, "2012");
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];
//Create a new chart series with the name
IOfficeChartSerie serieMarch = chart.Series.Add("March");
//Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData[2, 4, 4, 4];
//Set the chart type
chart.ChartType = OfficeChartType.Column_3D;
//Get the floor of chart
IOfficeChartWallOrFloor floor = chart.Floor;
//Set the filltype of floor as pattern fill
floor.Fill.FillType = OfficeFillType.Pattern;
//Set the back and fore color of the pattern fill
floor.Fill.BackColor = Color.Blue;
floor.Fill.ForeColor = Color.Brown;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create a presentation instance
Dim presentation As IPresentation = Presentation.Create()
'Add a blank slide to the presentation
Dim slide As ISlide = presentation.Slides.Add(SlideLayoutType.Blank)
'Add chart to the slide with position and size
Dim chart As IPresentationChart = 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, "2010")
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, "2011")
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, "2012")
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
Dim serieJan As IOfficeChartSerie = 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
Dim serieFeb As IOfficeChartSerie = 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)
'Create a new chart series with the name
Dim serieMarch As IOfficeChartSerie = chart.Series.Add("March")
'Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData(2, 4, 4, 4)
'Set the chart type
chart.ChartType = OfficeChartType.Column_3D
'Get the floor of chart
Dim floor As IOfficeChartWallOrFloor = chart.Floor
'Set the filltype of floor as pattern fill
floor.Fill.FillType = OfficeFillType.Pattern
'Set the back and fore color of the pattern fill
floor.Fill.BackColor = Color.Blue
floor.Fill.ForeColor = Color.Brown
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
GapDepth
Gets or sets the distance between the data series in a 3-D chart, as a percentage of the marker width.( 0 - 500 )
Declaration
int GapDepth { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Examples
IPresentation presentation = Presentation.Open("Template.pptx");
ISlide slide = presentation.Slides[0];
//Get the chart from slide
IPresentationChart chart = slide.Shapes[0] as IPresentationChart;
//set the chart type
chart.ChartType = OfficeChartType.Column_3D;
//Set the height percent
chart.HeightPercent = 400;
//Set the Depth percent
chart.DepthPercent = 200;
//Set the gap depth of data series
chart.GapDepth = 400;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
Dim presentation As IPresentation = Presentation.Open("Template.pptx")
Dim slide As ISlide = presentation.Slides(0)
'Get the chart from slide
Dim chart As IPresentationChart = TryCast(slide.Shapes(0), IPresentationChart)
'set the chart type
chart.ChartType = OfficeChartType.Column_3D
'Set the height percent
chart.HeightPercent = 400
'Set the Depth percent
chart.DepthPercent = 200
'Set the gap depth of data series
chart.GapDepth = 400
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
HasDataTable
Gets or sets whether the chart has data table.
Declaration
bool HasDataTable { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Examples
//Open the presentation
IPresentation presentation = Presentation.Open("Sample.pptx");
//Get the first slide
ISlide slide = presentation.Slides[0];
//Get the chart in slide
IPresentationChart chart = slide.Shapes[0] as IPresentationChart;
//Modify the chart height
chart.Height = 500;
//Modify the chart width
chart.Width = 700;
//Change the title
chart.ChartTitle = "New title";
//Change the serie name of first chart serie
chart.Series[0].Name = "Modified serie name";
//Hiding the category labels
chart.CategoryLabelLevel = OfficeCategoriesLabelLevel.CategoriesLabelLevelNone;
//Show Data Table.
chart.HasDataTable = true;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Open the presentation
Dim presentation As IPresentation = Presentation.Open("Sample.pptx")
'Get the first slide
Dim slide As ISlide = presentation.Slides(0)
'Get the chart in slide
Dim chart As IPresentationChart = TryCast(slide.Shapes(0), IPresentationChart)
'Modify the chart height
chart.Height = 500
'Modify the chart width
chart.Width = 700
'Change the title
chart.ChartTitle = "New title"
'Change the serie name of first chart serie
chart.Series(0).Name = "Modified serie name"
'Hiding the category labels
chart.CategoryLabelLevel = OfficeCategoriesLabelLevel.CategoriesLabelLevelNone
'Show Data Table.
chart.HasDataTable = True
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
HasLegend
Gets or sets whether the chart has legends.
Declaration
bool HasLegend { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Examples
//Create a presentation instance
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation
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, "2010");
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, "2011");
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, "2012");
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];
//Create a new chart series with the name
IOfficeChartSerie serieMarch = chart.Series.Add("March");
//Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData[2, 4, 4, 4];
//Hide the legend
chart.HasLegend = false;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create a presentation instance
Dim presentation As IPresentation = Presentation.Create()
'Add a blank slide to the presentation
Dim slide As ISlide = presentation.Slides.Add(SlideLayoutType.Blank)
'Add chart to the slide with position and size
Dim chart As IPresentationChart = 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, "2010")
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, "2011")
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, "2012")
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
Dim serieJan As IOfficeChartSerie = 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
Dim serieFeb As IOfficeChartSerie = 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)
'Create a new chart series with the name
Dim serieMarch As IOfficeChartSerie = chart.Series.Add("March")
'Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData(2, 4, 4, 4)
'Hide the legend
chart.HasLegend = False
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
HasPlotArea
Gets or sets a value that indicates chart has plot area.
Declaration
bool HasPlotArea { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
HasTitle
Gets or sets whether the chart has title.
Declaration
bool HasTitle { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Examples
//Create a presentation instance
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation
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, "2010");
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, "2011");
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, "2012");
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];
//Create a new chart series with the name
IOfficeChartSerie serieMarch = chart.Series.Add("March");
//Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData[2, 4, 4, 4];
//Hide the chart title
chart.HasTitle = false;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create a presentation instance
Dim presentation As IPresentation = Presentation.Create()
'Add a blank slide to the presentation
Dim slide As ISlide = presentation.Slides.Add(SlideLayoutType.Blank)
'Add chart to the slide with position and size
Dim chart As IPresentationChart = 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, "2010")
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, "2011")
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, "2012")
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
Dim serieJan As IOfficeChartSerie = 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
Dim serieFeb As IOfficeChartSerie = 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)
'Create a new chart series with the name
Dim serieMarch As IOfficeChartSerie = chart.Series.Add("March")
'Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData(2, 4, 4, 4)
'Hide the chart title
chart.HasTitle = False
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
Height
Gets or sets the Height of the chart in points (1/72 inch).
Declaration
double Height { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Examples
//Open the presentation
IPresentation presentation = Presentation.Open("Sample.pptx");
//Get the first slide
ISlide slide = presentation.Slides[0];
//Get the chart in slide
IPresentationChart chart = slide.Shapes[0] as IPresentationChart;
//Modify the chart height
chart.Height = 500;
//Modify the chart width
chart.Width = 700;
//Change the title
chart.ChartTitle = "New title";
//Change the serie name of first chart serie
chart.Series[0].Name = "Modified serie name";
//Hiding the category labels
chart.CategoryLabelLevel = OfficeCategoriesLabelLevel.CategoriesLabelLevelNone;
//Show Data Table.
chart.HasDataTable = true;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Open the presentation
Dim presentation As IPresentation = Presentation.Open("Sample.pptx")
'Get the first slide
Dim slide As ISlide = presentation.Slides(0)
'Get the chart in slide
Dim chart As IPresentationChart = TryCast(slide.Shapes(0), IPresentationChart)
'Modify the chart height
chart.Height = 500
'Modify the chart width
chart.Width = 700
'Change the title
chart.ChartTitle = "New title"
'Change the serie name of first chart serie
chart.Series(0).Name = "Modified serie name"
'Hiding the category labels
chart.CategoryLabelLevel = OfficeCategoriesLabelLevel.CategoriesLabelLevelNone
'Show Data Table.
chart.HasDataTable = True
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
HeightPercent
Gets or sets the height of a 3-D chart as a percentage of the chart width (between 5 and 500 percent).
Declaration
int HeightPercent { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Examples
IPresentation presentation = Presentation.Open("Template.pptx");
ISlide slide = presentation.Slides[0];
//Get the chart from slide
IPresentationChart chart = slide.Shapes[0] as IPresentationChart;
//set the chart type
chart.ChartType = OfficeChartType.Column_3D;
//Set the height percent
chart.HeightPercent = 400;
//Set the Depth percent
chart.DepthPercent = 200;
//Set the gap depth of data series
chart.GapDepth = 400;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
Dim presentation As IPresentation = Presentation.Open("Template.pptx")
Dim slide As ISlide = presentation.Slides(0)
'Get the chart from slide
Dim chart As IPresentationChart = TryCast(slide.Shapes(0), IPresentationChart)
'set the chart type
chart.ChartType = OfficeChartType.Column_3D
'Set the height percent
chart.HeightPercent = 400
'Set the Depth percent
chart.DepthPercent = 200
'Set the gap depth of data series
chart.GapDepth = 400
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
IsSeriesInRows
Gets or sets whether series in rows or not. True if series are in rows in DataRange; False otherwise.
Declaration
bool IsSeriesInRows { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Legend
Gets the legend for the chart. Read-only.
Declaration
IOfficeChartLegend Legend { get; }
Property Value
Type | Description |
---|---|
IOfficeChartLegend |
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);
chart.ChartType = OfficeChartType.Area;
//Edge: Specifies that the width or Height will be interpreted as right or bottom of the chart element
//Factor: Specifies that the width or Height will be interpreted as the width or height of the chart element
chart.PlotArea.Layout.LeftMode = LayoutModes.auto;
chart.PlotArea.Layout.TopMode = LayoutModes.factor;
//Value in points should not be a negative value if LayoutMode is Edge
//It can be a negative value if the LayoutMode is Factor.
chart.ChartTitleArea.Layout.Left = 10;
chart.ChartTitleArea.Layout.Top = 100;
//Manually positioning chart plot area
chart.PlotArea.Layout.LayoutTarget = LayoutTargets.outer;
chart.PlotArea.Layout.LeftMode = LayoutModes.edge;
chart.PlotArea.Layout.TopMode = LayoutModes.edge;
//Manually positioning chart legend
chart.Legend.Layout.LeftMode = LayoutModes.factor;
chart.Legend.Layout.TopMode = LayoutModes.factor;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
Dim presentation As IPresentation = Presentation.Create()
Dim slide As ISlide = presentation.Slides.Add(SlideLayoutType.Blank)
'Add chart to slide
Dim chart As IPresentationChart = 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)
chart.ChartType = OfficeChartType.Area
'Edge: Specifies that the width or Height will be interpreted as right or bottom of the chart element
'Factor: Specifies that the width or Height will be interpreted as the width or height of the chart element
chart.PlotArea.Layout.LeftMode = LayoutModes.auto
chart.PlotArea.Layout.TopMode = LayoutModes.factor
'Value in points should not be a negative value if LayoutMode is Edge
'It can be a negative value if the LayoutMode is Factor.
chart.ChartTitleArea.Layout.Left = 10
chart.ChartTitleArea.Layout.Top = 100
'Manually positioning chart plot area
chart.PlotArea.Layout.LayoutTarget = LayoutTargets.outer
chart.PlotArea.Layout.LeftMode = LayoutModes.edge
chart.PlotArea.Layout.TopMode = LayoutModes.edge
'Manually positioning chart legend
chart.Legend.Layout.LeftMode = LayoutModes.factor
chart.Legend.Layout.TopMode = LayoutModes.factor
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
Perspective
Gets or sets the perspective for the 3-D chart view (0 to 100).
Declaration
int Perspective { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Examples
//Create a presentation instance
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation
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, "2010");
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, "2011");
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, "2012");
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];
//Create a new chart series with the name
IOfficeChartSerie serieMarch = chart.Series.Add("March");
//Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData[2, 4, 4, 4];
//set the chart type
chart.ChartType = OfficeChartType.Column_3D;
//Set the perspective
chart.Perspective = 100;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create a presentation instance
Dim presentation As IPresentation = Presentation.Create()
'Add a blank slide to the presentation
Dim slide As ISlide = presentation.Slides.Add(SlideLayoutType.Blank)
'Add chart to the slide with position and size
Dim chart As IPresentationChart = 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, "2010")
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, "2011")
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, "2012")
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
Dim serieJan As IOfficeChartSerie = 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
Dim serieFeb As IOfficeChartSerie = 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)
'Create a new chart series with the name
Dim serieMarch As IOfficeChartSerie = chart.Series.Add("March")
'Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData(2, 4, 4, 4)
'set the chart type
chart.ChartType = OfficeChartType.Column_3D
'Set the perspective of chart
chart.Perspective = 100
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
PlotArea
Declaration
IOfficeChartFrameFormat PlotArea { get; }
Property Value
Type | Description |
---|---|
IOfficeChartFrameFormat |
PlotVisibleOnly
Gets or sets a value that indicates the visible/hidden cells are plotted.
Declaration
bool PlotVisibleOnly { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Examples
IPresentation presentation = Presentation.Open("Template.pptx");
ISlide slide = presentation.Slides[0];
//Get the chart from slide
IPresentationChart chart = slide.Shapes[0] as IPresentationChart;
//set the chart type
chart.ChartType = OfficeChartType.Column_3D;
//Hide the plot visiblity of cells
chart.PlotVisibleOnly = false;
//Hide the chart size with sheet window
chart.SizeWithWindow = false;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
Dim presentation As IPresentation = Presentation.Open("Template.pptx")
Dim slide As ISlide = presentation.Slides(0)
'Get the chart from slide
Dim chart As IPresentationChart = TryCast(slide.Shapes(0), IPresentationChart)
'set the chart type
chart.ChartType = OfficeChartType.Column_3D
'Hide the plot visiblity of cells
chart.PlotVisibleOnly = False
'Hide the chart size with sheet window
chart.SizeWithWindow = False
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
PrimaryCategoryAxis
Gets the primary category axis for the chart. Read-only.
Declaration
IOfficeChartCategoryAxis PrimaryCategoryAxis { get; }
Property Value
Type | Description |
---|---|
IOfficeChartCategoryAxis |
Examples
//Create a presentation instance
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation
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, "2010");
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, "2011");
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, "2012");
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];
//Create a new chart series with the name
IOfficeChartSerie serieMarch = chart.Series.Add("March");
//Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData[2, 4, 4, 4];
//Get the primary category axis
IOfficeChartCategoryAxis primaryCategoryAxis = chart.PrimaryCategoryAxis;
//Set the data range of the category axis
primaryCategoryAxis.CategoryLabels = chart.ChartData[2, 1, 4, 1];
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create a presentation instance
Dim presentation As IPresentation = Presentation.Create()
'Add a blank slide to the presentation
Dim slide As ISlide = presentation.Slides.Add(SlideLayoutType.Blank)
'Add chart to the slide with position and size
Dim chart As IPresentationChart = 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, "2010")
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, "2011")
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, "2012")
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
Dim serieJan As IOfficeChartSerie = 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
Dim serieFeb As IOfficeChartSerie = 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)
'Create a new chart series with the name
Dim serieMarch As IOfficeChartSerie = chart.Series.Add("March")
'Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData(2, 4, 4, 4)
'Get the primary category axis
Dim primaryCategoryAxis As IOfficeChartCategoryAxis = chart.PrimaryCategoryAxis
'Set the data range of the category axis
primaryCategoryAxis.CategoryLabels = chart.ChartData(2, 1, 4, 1)
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
PrimarySerieAxis
Gets the primary series axis for the chart. Read-only.
Declaration
IOfficeChartSeriesAxis PrimarySerieAxis { get; }
Property Value
Type | Description |
---|---|
IOfficeChartSeriesAxis |
Examples
//Create a presentation instance
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation
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, "2010");
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, "2011");
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, "2012");
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];
//Create a new chart series with the name
IOfficeChartSerie serieMarch = chart.Series.Add("March");
//Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData[2, 4, 4, 4];
//Set the chart type
chart.ChartType = OfficeChartType.Column_3D;
//Get the primary serie axis
IOfficeChartSeriesAxis primarySerieAxis = chart.PrimarySerieAxis;
//Set the font style of serie axis
primarySerieAxis.Font.Italic = true;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create a presentation instance
Dim presentation As IPresentation = Presentation.Create()
'Add a blank slide to the presentation
Dim slide As ISlide = presentation.Slides.Add(SlideLayoutType.Blank)
'Add chart to the slide with position and size
Dim chart As IPresentationChart = 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, "2010")
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, "2011")
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, "2012")
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
Dim serieJan As IOfficeChartSerie = 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
Dim serieFeb As IOfficeChartSerie = 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)
'Create a new chart series with the name
Dim serieMarch As IOfficeChartSerie = chart.Series.Add("March")
'Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData(2, 4, 4, 4)
'Set the chart type
chart.ChartType = OfficeChartType.Column_3D
'Get the primary serie axis
Dim primarySerieAxis As IOfficeChartSeriesAxis = chart.PrimarySerieAxis
'Set the font style of serie axis
primarySerieAxis.Font.Italic = True
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
PrimaryValueAxis
Gets the primary value axis for the chart. Read-only.
Declaration
IOfficeChartValueAxis PrimaryValueAxis { get; }
Property Value
Type | Description |
---|---|
IOfficeChartValueAxis |
Examples
//Create a presentation instance
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation
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, "2010");
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, "2011");
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, "2012");
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];
//Create a new chart series with the name
IOfficeChartSerie serieMarch = chart.Series.Add("March");
//Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData[2, 4, 4, 4];
//Get the primary value axis
IOfficeChartValueAxis primaryValueAxis = chart.PrimaryValueAxis;
//Set bold font style
primaryValueAxis.Font.Bold = true;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create a presentation instance
Dim presentation As IPresentation = Presentation.Create()
'Add a blank slide to the presentation
Dim slide As ISlide = presentation.Slides.Add(SlideLayoutType.Blank)
'Add chart to the slide with position and size
Dim chart As IPresentationChart = 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, "2010")
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, "2011")
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, "2012")
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
Dim serieJan As IOfficeChartSerie = 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
Dim serieFeb As IOfficeChartSerie = 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)
'Create a new chart series with the name
Dim serieMarch As IOfficeChartSerie = chart.Series.Add("March")
'Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData(2, 4, 4, 4)
'Get the primary value axis
Dim primaryValueAxis As IOfficeChartValueAxis = chart.PrimaryValueAxis
'Set bold font style
primaryValueAxis.Font.Bold = True
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
RightAngleAxes
Gets or sets a value that indicates the chart axes are at right angles, independent of chart rotation or elevation.
Declaration
bool RightAngleAxes { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Examples
//Create a presentation instance
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation
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, "2010");
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, "2011");
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, "2012");
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];
//Create a new chart series with the name
IOfficeChartSerie serieMarch = chart.Series.Add("March");
//Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData[2, 4, 4, 4];
//Set the right angle axes
chart.RightAngleAxes = true;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create a presentation instance
Dim presentation As IPresentation = Presentation.Create()
'Add a blank slide to the presentation
Dim slide As ISlide = presentation.Slides.Add(SlideLayoutType.Blank)
'Add chart to the slide with position and size
Dim chart As IPresentationChart = 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, "2010")
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, "2011")
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, "2012")
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
Dim serieJan As IOfficeChartSerie = 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
Dim serieFeb As IOfficeChartSerie = 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)
'Create a new chart series with the name
Dim serieMarch As IOfficeChartSerie = chart.Series.Add("March")
'Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData(2, 4, 4, 4)
'Set the right angle axes
chart.RightAngleAxes = True
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
Rotation
Gets or sets the rotation of the 3-D chart view (the rotation of the plot area around the z-axis, in degrees).(0 to 360 degrees).
Declaration
int Rotation { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Examples
//Open the presentation
IPresentation presentation = Presentation.Open("Sample.pptx");
//Get the first slide
ISlide slide = presentation.Slides[0];
//Get the chart in slide
IPresentationChart chart = slide.Shapes[0] as IPresentationChart;
//Change the chart type to 3D
chart.ChartType = OfficeChartType.Bar_Clustered_3D;
//Set the rotation
chart.Rotation = 80;
//Set the shadow angle
chart.SideWall.Shadow.Angle = 60;
//Set the backwall border weight
chart.BackWall.Border.LineWeight = OfficeChartLineWeight.Narrow;
//Save the presentation
presentation.Save("output.pptx");
//Close the presentation
presentation.Close();
'Open the presentation
Dim presentation As IPresentation = Presentation.Open("Sample.pptx")
'Get the first slide
Dim slide As ISlide = presentation.Slides(0)
'Get the chart in slide
Dim chart As IPresentationChart = TryCast(slide.Shapes(0), IPresentationChart)
'Change the chart type to 3D
chart.ChartType = OfficeChartType.Bar_Clustered_3D
'Set the rotation
chart.Rotation = 80
'Set the shadow angle
chart.SideWall.Shadow.Angle = 60
'Set the backwall border weight
chart.BackWall.Border.LineWeight = OfficeChartLineWeight.Narrow
'Save the presentation
presentation.Save("output.pptx")
'Close the presentation
presentation.Close()
SecondaryCategoryAxis
Gets the secondary category axis for the chart. Read-only.
Declaration
IOfficeChartCategoryAxis SecondaryCategoryAxis { get; }
Property Value
Type | Description |
---|---|
IOfficeChartCategoryAxis |
Examples
//Open a presentation with Combinational chart type
IPresentation presentation = Presentation.Open("Template.pptx");
ISlide slide = presentation.Slides[0];
//Get the chart from slide
IPresentationChart chart = slide.Shapes[0] as IPresentationChart;
//Get the secondary category axis
IOfficeChartCategoryAxis secondaryCategoryAxis = chart.PrimaryCategoryAxis;
//Set the minor grid lines
secondaryCategoryAxis.HasMinorGridLines = true;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Open a presentation with Combinational chart type
Dim presentation As IPresentation = Presentation.Open("Template.pptx")
Dim slide As ISlide = presentation.Slides(0)
'Get the chart from slide
Dim chart As IPresentationChart = TryCast(slide.Shapes(0), IPresentationChart)
'Get the secondary category axis
Dim secondaryCategoryAxis As IOfficeChartCategoryAxis = chart.PrimaryCategoryAxis
'Set the minor grid lines
secondaryCategoryAxis.HasMinorGridLines = True
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
SecondaryValueAxis
Gets the secondary value axis for the chart. Read-only.
Declaration
IOfficeChartValueAxis SecondaryValueAxis { get; }
Property Value
Type | Description |
---|---|
IOfficeChartValueAxis |
Examples
//Open a presentation with Combinational chart type
IPresentation presentation = Presentation.Open("Template.pptx");
ISlide slide = presentation.Slides[0];
//Get the chart from slide
IPresentationChart chart = slide.Shapes[0] as IPresentationChart;
//Get the secondary value axis
IOfficeChartValueAxis secondaryValueAxis = chart.SecondaryValueAxis;
//Set the tick label position
secondaryValueAxis.TickLabelPosition = OfficeTickLabelPosition.TickLabelPosition_NextToAxis;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Open a presentation with Combinational chart type
Dim presentation As IPresentation = Presentation.Open("Template.pptx")
Dim slide As ISlide = presentation.Slides(0)
'Get the chart from slide
Dim chart As IPresentationChart = TryCast(slide.Shapes(0), IPresentationChart)
'Get the secondary value axis
Dim secondaryValueAxis As IOfficeChartValueAxis = chart.SecondaryValueAxis
'Set the tick label position
secondaryValueAxis.TickLabelPosition = OfficeTickLabelPosition.TickLabelPosition_NextToAxis
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
Series
Gets the collection of the all series of this chart. Read-only.
Declaration
IOfficeChartSeries Series { get; }
Property Value
Type | Description |
---|---|
IOfficeChartSeries |
Examples
//Open the presentation
IPresentation presentation = Presentation.Open("Sample.pptx");
//Get the first slide
ISlide slide = presentation.Slides[0];
//Get the chart in slide
IPresentationChart chart = slide.Shapes[0] as IPresentationChart;
//Modify the chart height
chart.Height = 500;
//Modify the chart width
chart.Width = 700;
//Change the title
chart.ChartTitle = "New title";
//Change the serie name of first chart serie
chart.Series[0].Name = "Modified serie name";
//Hiding the category labels
chart.CategoryLabelLevel = OfficeCategoriesLabelLevel.CategoriesLabelLevelNone;
//Show Data Table.
chart.HasDataTable = true;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Open the presentation
Dim presentation As IPresentation = Presentation.Open("Sample.pptx")
'Get the first slide
Dim slide As ISlide = presentation.Slides(0)
'Get the chart in slide
Dim chart As IPresentationChart = TryCast(slide.Shapes(0), IPresentationChart)
'Modify the chart height
chart.Height = 500
'Modify the chart width
chart.Width = 700
'Change the title
chart.ChartTitle = "New title"
'Change the serie name of first chart serie
chart.Series(0).Name = "Modified serie name"
'Hiding the category labels
chart.CategoryLabelLevel = OfficeCategoriesLabelLevel.CategoriesLabelLevelNone
'Show Data Table.
chart.HasDataTable = True
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
SeriesNameLevel
Gets or sets an OfficeSeriesNameLevel constant that specifies the source level of the series names.
Declaration
OfficeSeriesNameLevel SeriesNameLevel { get; set; }
Property Value
Type | Description |
---|---|
OfficeSeriesNameLevel |
Examples
//Create a presentation instance
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation
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, "2010");
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, "2011");
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, "2012");
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];
//Create a new chart series with the name
IOfficeChartSerie serieMarch = chart.Series.Add("March");
//Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData[2, 4, 4, 4];
//set the serie name level
chart.SeriesNameLevel = OfficeSeriesNameLevel.SeriesNameLevelNone;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create a presentation instance
Dim presentation As IPresentation = Presentation.Create()
'Add a blank slide to the presentation
Dim slide As ISlide = presentation.Slides.Add(SlideLayoutType.Blank)
'Add chart to the slide with position and size
Dim chart As IPresentationChart = 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, "2010")
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, "2011")
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, "2012")
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
Dim serieJan As IOfficeChartSerie = 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
Dim serieFeb As IOfficeChartSerie = 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)
'Create a new chart series with the name
Dim serieMarch As IOfficeChartSerie = chart.Series.Add("March")
'Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData(2, 4, 4, 4)
'set the serie name level
chart.SeriesNameLevel = OfficeSeriesNameLevel.SeriesNameLevelNone
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
SideWall
Gets an object that allows to individually format the side wall of a 3-D chart. Read-only.
Declaration
IOfficeChartWallOrFloor SideWall { get; }
Property Value
Type | Description |
---|---|
IOfficeChartWallOrFloor |
Examples
//Open the presentation
IPresentation presentation = Presentation.Open("Sample.pptx");
//Get the first slide
ISlide slide = presentation.Slides[0];
//Get the chart in slide
IPresentationChart chart = slide.Shapes[0] as IPresentationChart;
//Change the chart type to 3D
chart.ChartType = OfficeChartType.Bar_Clustered_3D;
//Set the rotation
chart.Rotation = 80;
//Set the shadow angle
chart.SideWall.Shadow.Angle = 60;
//Set the backwall border weight
chart.BackWall.Border.LineWeight = OfficeChartLineWeight.Narrow;
//Save the presentation
presentation.Save("output.pptx");
//Close the presentation
presentation.Close();
'Open the presentation
Dim presentation As IPresentation = Presentation.Open("Sample.pptx")
'Get the first slide
Dim slide As ISlide = presentation.Slides(0)
'Get the chart in slide
Dim chart As IPresentationChart = TryCast(slide.Shapes(0), IPresentationChart)
'Change the chart type to 3D
chart.ChartType = OfficeChartType.Bar_Clustered_3D
'Set the rotation
chart.Rotation = 80
'Set the shadow angle
chart.SideWall.Shadow.Angle = 60
'Set the backwall border weight
chart.BackWall.Border.LineWeight = OfficeChartLineWeight.Narrow
'Save the presentation
presentation.Save("output.pptx")
'Close the presentation
presentation.Close()
SizeWithWindow
Gets or sets whether the chart size matches with the chart sheet window. True if Microsoft Excel resizes the chart to match the size of the chart sheet window. False if the chart size isn't attached to the window size. Applies only to chart sheets.
Declaration
bool SizeWithWindow { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Examples
IPresentation presentation = Presentation.Open("Template.pptx");
ISlide slide = presentation.Slides[0];
//Get the chart from slide
IPresentationChart chart = slide.Shapes[0] as IPresentationChart;
//set the chart type
chart.ChartType = OfficeChartType.Column_3D;
//Hide the plot visiblity of cells
chart.PlotVisibleOnly = false;
//Hide the chart size with sheet window
chart.SizeWithWindow = false;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
Dim presentation As IPresentation = Presentation.Open("Template.pptx")
Dim slide As ISlide = presentation.Slides(0)
'Get the chart from slide
Dim chart As IPresentationChart = TryCast(slide.Shapes(0), IPresentationChart)
'set the chart type
chart.ChartType = OfficeChartType.Column_3D
'Hide the plot visiblity of cells
chart.PlotVisibleOnly = False
'Hide the chart size with sheet window
chart.SizeWithWindow = False
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
Style
Gets or sets a style value for the chart.
Declaration
int Style { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Examples
By default Style is set to 0. Here for example, we set Style property for style change.
//Create a presentation instance
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation
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, "2010");
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, "2011");
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, "2012");
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];
//Create a new chart series with the name
IOfficeChartSerie serieMarch = chart.Series.Add("March");
//Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData[2, 4, 4, 4];
//set the chart style
chart.Style = 14;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create a presentation instance
Dim presentation As IPresentation = Presentation.Create()
'Add a blank slide to the presentation
Dim slide As ISlide = presentation.Slides.Add(SlideLayoutType.Blank)
'Add chart to the slide with position and size
Dim chart As IPresentationChart = 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, "2010")
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, "2011")
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, "2012")
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
Dim serieJan As IOfficeChartSerie = 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
Dim serieFeb As IOfficeChartSerie = 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)
'Create a new chart series with the name
Dim serieMarch As IOfficeChartSerie = chart.Series.Add("March")
'Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData(2, 4, 4, 4)
'set the chart style
chart.Style = 14
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
Walls
Gets the walls of the 3-D chart. Read-only.
Declaration
IOfficeChartWallOrFloor Walls { get; }
Property Value
Type | Description |
---|---|
IOfficeChartWallOrFloor |
Examples
//Create a presentation instance
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation
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, "2010");
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, "2011");
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, "2012");
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];
//Create a new chart series with the name
IOfficeChartSerie serieMarch = chart.Series.Add("March");
//Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData[2, 4, 4, 4];
//Set the chart type
chart.ChartType = OfficeChartType.Column_3D;
//Set the fill type of wall as pattern
chart.Walls.Fill.FillType = OfficeFillType.Pattern;
//set the back color of the pattern fill
chart.Walls.Fill.BackColor = Color.AliceBlue;
//Set the fore color of the pattern fill
chart.Walls.Fill.ForeColor = Color.Brown;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create a presentation instance
Dim presentation As IPresentation = Presentation.Create()
'Add a blank slide to the presentation
Dim slide As ISlide = presentation.Slides.Add(SlideLayoutType.Blank)
'Add chart to the slide with position and size
Dim chart As IPresentationChart = 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, "2010")
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, "2011")
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, "2012")
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
Dim serieJan As IOfficeChartSerie = 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
Dim serieFeb As IOfficeChartSerie = 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)
'Create a new chart series with the name
Dim serieMarch As IOfficeChartSerie = chart.Series.Add("March")
'Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData(2, 4, 4, 4)
'Set the chart type
chart.ChartType = OfficeChartType.Column_3D
'Set the fill type of wall as pattern
chart.Walls.Fill.FillType = OfficeFillType.Pattern
'set the back color of the pattern fill
chart.Walls.Fill.BackColor = Color.AliceBlue
'Set the fore color of the pattern fill
chart.Walls.Fill.ForeColor = Color.Brown
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
WallsAndGridlines2D
Gets or sets if gridlines are drawn two-dimensionally on a 3-D chart.
Declaration
bool WallsAndGridlines2D { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Examples
//Create a presentation instance
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation
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, "2010");
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, "2011");
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, "2012");
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];
//Create a new chart series with the name
IOfficeChartSerie serieMarch = chart.Series.Add("March");
//Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData[2, 4, 4, 4];
//set the chart type
chart.ChartType = OfficeChartType.Column_3D;
//Set the 2D gridlines for chart
chart.WallsAndGridlines2D = true;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create a presentation instance
Dim presentation As IPresentation = Presentation.Create()
'Add a blank slide to the presentation
Dim slide As ISlide = presentation.Slides.Add(SlideLayoutType.Blank)
'Add chart to the slide with position and size
Dim chart As IPresentationChart = 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, "2010")
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, "2011")
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, "2012")
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
Dim serieJan As IOfficeChartSerie = 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
Dim serieFeb As IOfficeChartSerie = 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)
'Create a new chart series with the name
Dim serieMarch As IOfficeChartSerie = chart.Series.Add("March")
'Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData(2, 4, 4, 4)
'set the chart type
chart.ChartType = OfficeChartType.Column_3D
'Set the 2D gridlines for chart
chart.WallsAndGridlines2D = True
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
Width
Gets or sets the Width of the chart in points (1/72 inch).
Declaration
double Width { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Examples
//Open the presentation
IPresentation presentation = Presentation.Open("Sample.pptx");
//Get the first slide
ISlide slide = presentation.Slides[0];
//Get the chart in slide
IPresentationChart chart = slide.Shapes[0] as IPresentationChart;
//Modify the chart height
chart.Height = 500;
//Modify the chart width
chart.Width = 700;
//Change the title
chart.ChartTitle = "New title";
//Change the serie name of first chart serie
chart.Series[0].Name = "Modified serie name";
//Hiding the category labels
chart.CategoryLabelLevel = OfficeCategoriesLabelLevel.CategoriesLabelLevelNone;
//Show Data Table.
chart.HasDataTable = true;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Open the presentation
Dim presentation As IPresentation = Presentation.Open("Sample.pptx")
'Get the first slide
Dim slide As ISlide = presentation.Slides(0)
'Get the chart in slide
Dim chart As IPresentationChart = TryCast(slide.Shapes(0), IPresentationChart)
'Modify the chart height
chart.Height = 500
'Modify the chart width
chart.Width = 700
'Change the title
chart.ChartTitle = "New title"
'Change the serie name of first chart serie
chart.Series(0).Name = "Modified serie name"
'Hiding the category labels
chart.CategoryLabelLevel = OfficeCategoriesLabelLevel.CategoriesLabelLevelNone
'Show Data Table.
chart.HasDataTable = True
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
XPos
Gets or sets the X coordinate of the upper-left corner of the chart in points (1/72 inch).
Declaration
double XPos { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Examples
//Create a presentation instance
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation
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, "2010");
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, "2011");
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, "2012");
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];
//Create a new chart series with the name
IOfficeChartSerie serieMarch = chart.Series.Add("March");
//Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData[2, 4, 4, 4];
//Set the x - position of the chart
chart.XPos = 300;
//Set the y - position of the chart
chart.YPos = 140;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create a presentation instance
Dim presentation As IPresentation = Presentation.Create()
'Add a blank slide to the presentation
Dim slide As ISlide = presentation.Slides.Add(SlideLayoutType.Blank)
'Add chart to the slide with position and size
Dim chart As IPresentationChart = 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, "2010")
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, "2011")
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, "2012")
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
Dim serieJan As IOfficeChartSerie = 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
Dim serieFeb As IOfficeChartSerie = 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)
'Create a new chart series with the name
Dim serieMarch As IOfficeChartSerie = chart.Series.Add("March")
'Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData(2, 4, 4, 4)
'Set the x - position of the chart
chart.XPos = 300
'Set the y - position of the chart
chart.YPos = 140
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
YPos
Gets or sets the Y coordinate of the upper-left corner of the chart in points (1/72 inch).
Declaration
double YPos { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Examples
//Create a presentation instance
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation
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, "2010");
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, "2011");
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, "2012");
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];
//Create a new chart series with the name
IOfficeChartSerie serieMarch = chart.Series.Add("March");
//Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData[2, 4, 4, 4];
//Set the x - position of the chart
chart.XPos = 300;
//Set the y - position of the chart
chart.YPos = 140;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create a presentation instance
Dim presentation As IPresentation = Presentation.Create()
'Add a blank slide to the presentation
Dim slide As ISlide = presentation.Slides.Add(SlideLayoutType.Blank)
'Add chart to the slide with position and size
Dim chart As IPresentationChart = 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, "2010")
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, "2011")
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, "2012")
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
Dim serieJan As IOfficeChartSerie = 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
Dim serieFeb As IOfficeChartSerie = 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)
'Create a new chart series with the name
Dim serieMarch As IOfficeChartSerie = chart.Series.Add("March")
'Set the data range of chart series � start row, start column, end row, end column
serieMarch.Values = chart.ChartData(2, 4, 4, 4)
'Set the x - position of the chart
chart.XPos = 300
'Set the y - position of the chart
chart.YPos = 140
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
Methods
Refresh()
Refreshes the chart with the modified excel data.
Declaration
void Refresh()
Examples
//Open a presentation containing charts
IPresentation presentation = Presentation.Open("Template.pptx");
//Get the slide from presentation
ISlide slide = presentation.Slides[0];
//Get the chart from slide
IPresentationChart chart = slide.Charts[0];
//Refresh the chart to set worksheet data to current chart
chart.Refresh();
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Open a presentation containing charts
Dim presentation As IPresentation = Presentation.Open("Template.pptx")
'Get the slide from presentation
Dim slide As ISlide = presentation.Slides(0)
'Get the chart from slide
Dim chart As IPresentationChart = slide.Charts(0)
'Refresh the chart to set worksheet data to current chart
chart.Refresh()
'Save the presentation
presentation.Save("Sample.pptx")
'Close the presentation
presentation.Close()
SaveAsImage(Stream)
Converts the chart to image and saves the image in the specified stream.
Declaration
void SaveAsImage(Stream imageAsStream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | imageAsStream | The stream to save the image. |
Examples
//Open the presentation
IPresentation presentation = Presentation.Open("Template.pptx");
//Initialize the ChartToImageConverter class; this is mandatory
presentation.ChartToImageConverter = new ChartToImageConverter();
//Set the scaling mode for quality
presentation.ChartToImageConverter.ScalingMode = Syncfusion.OfficeChart.ScalingMode.Best;
//Get the first slide
ISlide slide = presentation.Slides[0];
//Get the chart in slide
IPresentationChart chart = slide.Shapes[0] as IPresentationChart;
//Create a stream instance to store the image
MemoryStream stream = new MemoryStream();
//Save the image to stream
chart.SaveAsImage(stream);
//Save the stream to a file
using (FileStream fileStream = File.Create("ChartImage.png", (int)stream.Length))
fileStream.Write(stream.ToArray(), 0, stream.ToArray().Length);
//Close the stream
stream.Close();
//Save the Presentation
presentation.Save("output.pptx");
//Close the presentation
presentation.Close();
'Open the presentation
Dim presentation As IPresentation = Presentation.Open("Template.pptx")
'Initialize the ChartToImageConverter class; this is mandatory
presentation.ChartToImageConverter = New ChartToImageConverter()
'Set the scaling mode for quality
presentation.ChartToImageConverter.ScalingMode = Syncfusion.OfficeChart.ScalingMode.Best
'Get the first slide
Dim slide As ISlide = presentation.Slides(0)
'Get the chart in slide
Dim chart As IPresentationChart = TryCast(slide.Shapes(0), IPresentationChart)
'Create a stream instance to store the image
Dim stream As New MemoryStream()
'Save the image to stream
chart.SaveAsImage(stream)
'Save the stream to a file
Using fileStream As FileStream = File.Create("ChartImage.png", CInt(stream.Length))
fileStream.Write(stream.ToArray(), 0, stream.ToArray().Length)
End Using
'Close the stream
stream.Close()
'Save the Presentation
presentation.Save("output.pptx")
'Close the presentation
presentation.Close()
SetChartData(Object[][])
Sets the chart data with the specified two dimensional object array.
Declaration
void SetChartData(object[][] data)
Parameters
Type | Name | Description |
---|---|---|
System.Object[][] | data | Represents the two dimensional chart data |
Examples
//Create a new PowerPoint presentation
IPresentation presentation = Presentation.Create();
//Add slide to the presentation
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add chart to slide
IPresentationChart chart = slide.Charts.AddChart(100, 100, 300, 200);
//Create an instance of object array
object[][] chartData = { new object[3], new object[4] };
//Invoke setChartData method by passing object array
chart.SetChartData(chartData);
//Set the chart title
chart.ChartTitle = "Chart";
//Save the Presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create a new PowerPoint presentation
Dim presentation As IPresentation = Presentation.Create()
'Add slide to the presentation
Dim slide As ISlide = presentation.Slides.Add(SlideLayoutType.Blank)
'Add chart to slide
Dim chart As IPresentationChart = slide.Charts.AddChart(100, 100, 300, 200)
'Create an instance of object array
Dim chartData As Object()() = {New Object(2) {}, New Object(3) {}}
'Invoke setChartData method by passing object array
chart.SetChartData(chartData)
'Set the chart title
chart.ChartTitle = "Chart"
'Save the Presentation
presentation.Save("Output.pptx")
'Close the presentation
presentation.Close()
SetDataRange(IEnumerable, Int32, Int32)
Sets the chart data with the specified enumerable, row index and column index.
Declaration
void SetDataRange(IEnumerable enumerable, int rowIndex, int columnIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.IEnumerable | enumerable | IEnumerable object with desired data |
System.Int32 | rowIndex | Row of the first cell where array should be imported. |
System.Int32 | columnIndex | Column of the first cell where array should be imported. |
SetDataRange(Object[][], Int32, Int32)
Sets the chart data with the specified two dimensional object array, row index and column index.
Declaration
void SetDataRange(object[][] data, int rowIndex, int columnIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Object[][] | data | Represents the two dimensional chart data |
System.Int32 | rowIndex | Row of the first cell where array should be imported. |
System.Int32 | columnIndex | Column of the first cell where array should be imported. |
Examples
//Create a new PowerPoint presentation
IPresentation presentation = Presentation.Create();
//Add slide to the presentation
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add chart to slide
IPresentationChart chart = slide.Charts.AddChart(100, 100, 300, 300);
//Create an instance of object array
object[][] dataRange = { new object[5], new object[5] };
//Invoke set data Range method
chart.SetDataRange(dataRange, 1, 3);
//Save the Presentation
presentation.Save("output.pptx");
//Close the presentation
presentation.Close();
'Create a new PowerPoint presentation
Dim presentation As IPresentation = Presentation.Create()
'Add slide to the presentation
Dim slide As ISlide = presentation.Slides.Add(SlideLayoutType.Blank)
'Add chart to slide
Dim chart As IPresentationChart= slide.Charts.AddChart(100, 100, 300, 300)
'Create an instance of object array
Dim dataRange As Object()() = {New Object(4) {}, New Object(4) {}}
'Invoke set data Range method
chart.SetDataRange(dataRange, 1, 3)
'Save the Presentation
presentation.Save("output.pptx")
'Close the presentation
presentation.Close()