Interface IPresentationChart
Represents the charts in the presentation
Namespace: Syncfusion.Presentation
Assembly: Syncfusion.Presentation.Base.dll
Syntax
public interface IPresentationChart
Properties
AutoScaling
Gets or sets whether if Microsoft Excel scales a 3-D chart so that it's closer in size to the equivalent 2-D chart.
Declaration
bool AutoScaling { get; set; }
Property Value
Type |
---|
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 the chart BackWall. Read-only.
Declaration
IOfficeChartWallOrFloor BackWall { get; }
Property Value
Type |
---|
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 |
---|
IOfficeChartCategories |
Examples
//Creates a Presentation instance
IPresentation pptxDoc = Presentation.Create();
//Adds a blank slide to the Presentation
ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank);
//Adds chart to the slide with position and size
IPresentationChart chart = slide.Charts.AddChart(100, 10, 700, 500);
//Specifies the chart title
chart.ChartTitle = "Sales Analysis";
//Sets chart data - Row1
chart.ChartData.SetValue(1, 2, "Jan");
chart.ChartData.SetValue(1, 3, "Feb");
chart.ChartData.SetValue(1, 4, "March");
//Sets 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);
//Sets 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);
//Sets 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);
//Creates a new chart series with the name
IOfficeChartSerie seriesJan = chart.Series.Add("Jan");
//Sets the data range of chart series – start row, start column, end row, end column
seriesJan.Values = chart.ChartData[2, 2, 4, 2];
//Creates a new chart series with the name
IOfficeChartSerie seriesFeb = chart.Series.Add("Feb");
//Sets the data range of chart series – start row, start column, end row, end column
seriesFeb.Values = chart.ChartData[2, 3, 4, 3];
//Creates a new chart series with the name
IOfficeChartSerie seriesMarch = chart.Series.Add("March");
//Sets the data range of chart series – start row, start column, end row, end column
seriesMarch.Values = chart.ChartData[2, 4, 4, 4];
//Sets the data range of the category axis
chart.PrimaryCategoryAxis.CategoryLabels = chart.ChartData[2, 1, 4, 1];
//Specifies the chart type
chart.ChartType = OfficeChartType.Column_Clustered;
//Get the chart categories.
IOfficeChartCategories chartCategories = chart.Categories;
bool value = chartCategories.IsReadOnly;
//Save the presentation
pptxDoc.Save("Sample.pptx");
//Close the presentation
pptxDoc.Close();
'Creates a Presentation instance
Dim pptxDoc As IPresentation = Presentation.Create()
'Adds a blank slide to the Presentation
Dim slide As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank)
'Adds chart to the slide with position and size
Dim chart As IPresentationChart = slide.Charts.AddChart(100, 10, 700, 500)
'Specifies the chart title
chart.ChartTitle = "Sales Analysis"
'Sets chart data - Row1
chart.ChartData.SetValue(1, 2, "Jan")
chart.ChartData.SetValue(1, 3, "Feb")
chart.ChartData.SetValue(1, 4, "March")
'Sets 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)
'Sets 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)
'Sets 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)
'Creates a new chart series with the name
Dim seriesJan As IOfficeChartSerie = chart.Series.Add("Jan")
'Sets the data range of chart series – start row, start column, end row, end column
seriesJan.Values = chart.ChartData(2, 2, 4, 2)
'Creates a new chart series with the name
Dim seriesFeb As IOfficeChartSerie = chart.Series.Add("Feb")
'Sets the data range of chart series – start row, start column, end row, end column
seriesFeb.Values = chart.ChartData(2, 3, 4, 3)
'Creates a new chart series with the name
Dim seriesMarch As IOfficeChartSerie = chart.Series.Add("March")
'Sets the data range of chart series – start row, start column, end row, end column
seriesMarch.Values = chart.ChartData(2, 4, 4, 4)
'Sets the data range of the category axis
chart.PrimaryCategoryAxis.CategoryLabels = chart.ChartData(2, 1, 4, 1)
'Specifies the chart type
chart.ChartType = OfficeChartType.Column_Clustered
'Get the chart categories
Dim chartCategories As IOfficeChartCategories = chart.Categories
Dim value As Boolean = chartCategories.IsReadOnly
'Adds the third slide into the Presentation
pptxDoc.Save("Sample.pptx")
'Closes the Presentation
pptxDoc.Close()
CategoryLabelLevel
Gets or sets the category name filter option
Declaration
OfficeCategoriesLabelLevel CategoryLabelLevel { get; set; }
Property Value
Type |
---|
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 |
---|
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 the chart data. Read-only.
Declaration
IOfficeChartData ChartData { get; }
Property Value
Type |
---|
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 |
---|
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 title text area. Read-only.
Declaration
IOfficeChartTextArea ChartTitleArea { get; }
Property Value
Type |
---|
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");
//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 chart title text area
IOfficeChartTextArea textArea = chart.ChartTitleArea;
//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")
'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 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 |
---|
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.Column_Clustered;
//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.Column_Clustered
'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 |
---|
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 |
---|
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), IOfficeChart)
'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 |
---|
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), IOfficeChart)
'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 |
---|
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), IOfficeChart)
'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 |
---|
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 chart floor. Read-only.
Declaration
IOfficeChartWallOrFloor Floor { get; }
Property Value
Type |
---|
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 |
---|
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), IOfficeChart)
'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 |
---|
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), IOfficeChart)
'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 |
---|
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
Declaration
bool HasPlotArea { get; set; }
Property Value
Type |
---|
System.Boolean |
Height
Gets or sets the Height of the chart in points (1/72 inch).
Declaration
double Height { get; set; }
Property Value
Type |
---|
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), IOfficeChart)
'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 |
---|
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), IOfficeChart)
'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 |
---|
System.Boolean |
Examples
//Create an instance for PowerPoint
IPresentation pptxDoc = Presentation.Create();
//Add a blank slide to Presentation
ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank);
//Adds chart to the slide with position and size
IPresentationChart chart = slide.Charts.AddChart(100, 10, 700, 500);
//Set the chart type as Scatter_Markers
chart.ChartType = OfficeChartType.Scatter_Markers;
//Assign data
chart.DataRange = chart.ChartData[1, 1, 4, 2];
//Set data to the chart RowIndex, columnIndex, and data
chart.ChartData.SetValue(1, 1, "X-Axis");
chart.ChartData.SetValue(1, 2, "Y-Axis");
chart.ChartData.SetValue(2, 1, 1);
chart.ChartData.SetValue(3, 1, 5);
chart.ChartData.SetValue(4, 1, 10);
chart.ChartData.SetValue(2, 2, 10);
chart.ChartData.SetValue(3, 2, 5);
chart.ChartData.SetValue(4, 2, 1);
//Set chart title
chart.ChartTitle = "Scatter Markers Chart";
//Set legend
chart.HasLegend = false;
//Set Datalabels
IOfficeChartSerie serie = chart.Series[0];
serie.DataPoints.DefaultDataPoint.DataLabels.IsValue = true;
serie.DataPoints.DefaultDataPoint.DataLabels.IsCategoryName = true;
//Set IsSeriesInRows
chart.IsSeriesInRows = false;
//Saves the Presentation
pptxDoc.Save("Output.pptx");
//Closes the presentation
pptxDoc.Close();
'Create an instance for PowerPoint
Dim pptxDoc As IPresentation = Presentation.Create()
'Add a blank slide to Presentation
Dim slide As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank)
'Adds chart to the slide with position and size
Dim chart As IPresentationChart = slide.Charts.AddChart(100, 10, 700, 500)
'Set the chart type as Scatter_Markers
chart.ChartType = OfficeChartType.Scatter_Markers
'Assign data
chart.DataRange = chart.ChartData(1, 1, 4, 2)
'Set data to the chart RowIndex, columnIndex, and data
chart.ChartData.SetValue(1, 1, "X-Axis")
chart.ChartData.SetValue(1, 2, "Y-Axis")
chart.ChartData.SetValue(2, 1, 1)
chart.ChartData.SetValue(3, 1, 5)
chart.ChartData.SetValue(4, 1, 10)
chart.ChartData.SetValue(2, 2, 10)
chart.ChartData.SetValue(3, 2, 5)
chart.ChartData.SetValue(4, 2, 1)
'Apply chart elements
'Set chart title
chart.ChartTitle = "Scatter Markers Chart"
'Set legend
chart.HasLegend = False
'Set Datalabels
Dim serie As IOfficeChartSerie = chart.Series(0)
serie.DataPoints.DefaultDataPoint.DataLabels.IsValue = True
serie.DataPoints.DefaultDataPoint.DataLabels.IsCategoryName = True
'Set IsSeriesInRows
chart.IsSeriesInRows = False
'Saves the Presentation
pptxDoc.Save("Output.pptx")
'Closes the Presentation
pptxDoc.Close()
Legend
Gets the chart legend.
Declaration
IOfficeChartLegend Legend { get; }
Property Value
Type |
---|
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()
OfficeChart
Gets a IOfficeChart instance for this presentation chart. Read-only.
Declaration
IOfficeChart OfficeChart { get; }
Property Value
Type |
---|
IOfficeChart |
Remarks
This property can be used in SaveAsImage(IOfficeChart, Stream) to convert chart as an image.
Examples
//Opens a Presentation
IPresentation pptxDoc = Presentation.Open("Sample.pptx");
//Creates an instance of ChartToImageConverter
pptxDoc.ChartToImageConverter = new ChartToImageConverter();
//Sets the scaling mode as best
pptxDoc.ChartToImageConverter.ScalingMode = Syncfusion.OfficeChart.ScalingMode.Best;
//Gets a slide from the Presentation
ISlide slide = pptxDoc.Slides[0];
//Gets the presentation chart in slide
IPresentationChart presentationChart = slide.Shapes[0] as IPresentationChart;
//Gets the IOfficeChart instance
IOfficeChart officeChart = presentationChart.OfficeChart;
//Save the chart to image.
MemoryStream memoryStream = new MemoryStream();
officeChart.SaveAsImage(memoryStream);
//Closes the Presentation
pptxDoc.Close();
'Opens a Presentation
Dim pptxDoc As IPresentation = Presentation.Open("Sample.pptx")
'Creates an instance of ChartToImageConverter
pptxDoc.ChartToImageConverter = New ChartToImageConverter
'Sets the scaling mode as best
pptxDoc.ChartToImageConverter.ScalingMode = Syncfusion.OfficeChart.ScalingMode.Best
'Gets a slide from the Presentation
Dim slide As ISlide = pptxDoc.Slides(0)
'Gets the presentation chart in slide
Dim presentationChart As IPresentationChart = CType(slide.Shapes(0), IPresentationChart)
'Gets the IOfficeChart instance
Dim officeChart As IOfficeChart = presentationChart.OfficeChart
'Save the chart to image.
Dim memoryStream As MemoryStream = New MemoryStream
officeChart.SaveAsImage(memoryStream)
'Closes the Presentation
pptxDoc.Close
Perspective
Gets or sets the perspective for the 3-D chart view (0 to 100).
Declaration
int Perspective { get; set; }
Property Value
Type |
---|
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
Gets plot area frame format. Read-only.
Declaration
IOfficeChartFrameFormat PlotArea { get; }
Property Value
Type |
---|
IOfficeChartFrameFormat |
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);
//Set 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()
PlotVisibleOnly
Gets or sets whether if only visible cells are plotted. False if both visible and hidden cells are plotted.
Declaration
bool PlotVisibleOnly { get; set; }
Property Value
Type |
---|
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), IOfficeChart)
'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. Read-only.
Declaration
IOfficeChartCategoryAxis PrimaryCategoryAxis { get; }
Property Value
Type |
---|
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. Read-only.
Declaration
IOfficeChartSeriesAxis PrimarySerieAxis { get; }
Property Value
Type |
---|
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. Read-only.
Declaration
IOfficeChartValueAxis PrimaryValueAxis { get; }
Property Value
Type |
---|
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 whether if the chart axes are at right angles, independent of chart rotation or elevation.
Declaration
bool RightAngleAxes { get; set; }
Property Value
Type |
---|
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 |
---|
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), IOfficeChart)
'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. Read-only.
Declaration
IOfficeChartCategoryAxis SecondaryCategoryAxis { get; }
Property Value
Type |
---|
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), IOfficeChart)
'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. Read-only.
Declaration
IOfficeChartValueAxis SecondaryValueAxis { get; }
Property Value
Type |
---|
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), IOfficeChart)
'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 |
---|
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), IOfficeChart)
'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 the series name filter option
Declaration
OfficeSeriesNameLevel SeriesNameLevel { get; set; }
Property Value
Type |
---|
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 the chart BackWall. Read-only.
Declaration
IOfficeChartWallOrFloor SideWall { get; }
Property Value
Type |
---|
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), IOfficeChart)
'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 |
---|
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), IOfficeChart)
'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 the Style of the chart.
Declaration
int Style { get; set; }
Property Value
Type |
---|
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, 700, 500);
//Specify the chart style
chart.Style=30;
//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 style
chart.Style=30;
'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()
Walls
Gets the chart walls. Read-only.
Declaration
IOfficeChartWallOrFloor Walls { get; }
Property Value
Type |
---|
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 grid lines are drawn two-dimensionally on a 3-D chart.
Declaration
bool WallsAndGridlines2D { get; set; }
Property Value
Type |
---|
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 |
---|
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), IOfficeChart)
'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 |
---|
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 |
---|
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(Boolean)
Replaces the chart data with the worksheet data.
Declaration
void Refresh(bool updateFormula = false)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | updateFormula | Optional Boolean. Set to true to update all the formulas in the Excel sheet. The default value is false. |
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(true);
//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(True)
'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), IOfficeChart)
'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)
Declaration
void SetDataRange(IEnumerable enumerable, int rowIndex, int columnIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.IEnumerable | enumerable | |
System.Int32 | rowIndex | |
System.Int32 | columnIndex |
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()