Interface IPresentationCharts
Represents a collection of IPresentationChart instance in a slide.
Inherited Members
Namespace: Syncfusion.Presentation
Assembly: Syncfusion.Presentation.Base.dll
Syntax
public interface IPresentationCharts : IEnumerable<IPresentationChart>, IEnumerable
Properties
Count
Gets the number of elements in the chart collection. Read-only.
Declaration
int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The total count of the charts in the chart collection. |
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Create instance to hold chart collection
IPresentationCharts charts = slide.Charts;
//Add chart to slide
IPresentationChart chart =charts.AddChart(400, 300, 100, 100);
//Get the count for chart collection
int count = charts.Count;
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a blank slide to the presentation.
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Create instance to hold chart collection
Dim charts As IPresentationCharts = slide.Charts
'Add chart to slide
Dim chart As IPresentationChart = charts.AddChart(400, 300, 100, 100)
'Get the count for chart collection
Dim count As Integer = charts.Count
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
Item[Int32]
Gets a single IPresentationChart instance from the collection. Read-only.
Declaration
IPresentationChart this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Index from the collection. |
Property Value
Type | Description |
---|---|
IPresentationChart | Returns the particular chart based on the index. |
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Create instance to hold chart collection
IPresentationCharts charts = slide.Charts;
//Add chart to slide
charts.AddChart(400, 300, 100, 100);
//Retrieve the chart at index 0
IPresentationChart chart = charts[0];
//Set the chart title
chart.ChartTitle = "Chart";
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a blank slide to the presentation.
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Create instance to hold chart collection
Dim charts As IPresentationCharts = slide.Charts
'Add chart to slide
charts.AddChart(400, 300, 100, 100)
'Retrieve the chart at index 0
Dim chart As IPresentationChart = charts(0)
'Set the chart title
chart.ChartTitle = "Chart"
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
Methods
AddChart(IEnumerable, Double, Double, Double, Double)
Creates a chart from the specified enumerable and adds the chart to the shape collection.
Declaration
IPresentationChart AddChart(IEnumerable enumerable, double left, double top, double width, double height)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.IEnumerable | enumerable | Specifies the System.Collections.IEnumerable object with desired data |
System.Double | left | Represents the left position, in points. The Left value ranges from -169056 to 169056. |
System.Double | top | Represents the top position, in points. The Top value ranges from -169056 to 169056. |
System.Double | width | Represents the width, in points. The Width value ranges from 0 to 169056. |
System.Double | height | Represents the height, in points. The Height value ranges from 0 to 169056. |
Returns
Type | Description |
---|---|
IPresentationChart | Returns an IPresentationChart instance. |
AddChart(Double, Double, Double, Double)
Adds a chart to the shape collection with the specified bounds.
Declaration
IPresentationChart AddChart(double left, double top, double width, double height)
Parameters
Type | Name | Description |
---|---|---|
System.Double | left | Represents the left position, in points. The Left value ranges from -169056 to 169056. |
System.Double | top | Represents the top position, in points. The Top value ranges from -169056 to 169056. |
System.Double | width | Represents the width, in points. The Width value ranges from 0 to 169056. |
System.Double | height | Represents the height, in points. The Height value ranges from 0 to 169056. |
Returns
Type | Description |
---|---|
IPresentationChart | Returns an IPresentationChart instance. |
Examples
//Create a new presentation
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Create instance to hold chart collection
IPresentationCharts charts = slide.Charts;
//Add chart to slide
IPresentationChart chart =charts.AddChart(400, 300, 100, 100);
//Set the chart title
chart.ChartTitle = "Chart";
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a blank slide to the presentation.
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Create instance to hold chart collection
Dim charts As IPresentationCharts = slide.Charts
'Add chart to slide
Dim chart As IPresentationChart = charts.AddChart(400, 300, 100, 100)
'Set the chart title
chart.ChartTitle = "Chart"
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
AddChart(Stream, Int32, String, RectangleF)
Creates a chart for the data in specified excel document and adds the chart to the shape collection.
Declaration
IPresentationChart AddChart(Stream excelStream, int sheetNumber, string dataRange, RectangleF bounds)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | excelStream | Excel document stream having the data for chart[Only the "*.xlsx" format is supported]. |
System.Int32 | sheetNumber | Worksheet number of the excel document. |
System.String | dataRange | Data range in the worksheet for the chart to be created. |
System.Drawing.RectangleF | bounds | Position and size of the chart, in points. |
Returns
Type | Description |
---|---|
IPresentationChart | Returns an IPresentationChart instance. |
AddChart(Object[][], Double, Double, Double, Double)
Creates a chart for the specified data and adds the chart to the shape collection.
Declaration
IPresentationChart AddChart(object[][] data, double left, double top, double width, double height)
Parameters
Type | Name | Description |
---|---|---|
System.Object[][] | data | Specifies the two dimensional chart data. |
System.Double | left | Represents the left position, in points. The Left value ranges from -169056 to 169056. |
System.Double | top | Represents the top position, in points. The Top value ranges from -169056 to 169056. |
System.Double | width | Represents the width, in points. The Width value ranges from 0 to 169056. |
System.Double | height | Represents the height, in points. The Height value ranges from 0 to 169056. |
Returns
Type | Description |
---|---|
IPresentationChart | Returns an IPresentationChart instance. |
IndexOf(IPresentationChart)
Returns the zero-based index of the first occurrence of the IPresentationChart instance within the collection.
Declaration
int IndexOf(IPresentationChart chart)
Parameters
Type | Name | Description |
---|---|---|
IPresentationChart | chart | The IPresentationChart instance to locate in the collection. |
Returns
Type | Description |
---|---|
System.Int32 | Returns the zero-based index of the first occurrence of object within the entire collection, if found; otherwise, –1. |
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Create instance to hold chart collection
IPresentationCharts charts = slide.Charts;
//Add chart to slide
IPresentationChart chart =charts.AddChart(400, 300, 100, 100);
//Get the index of specific chart
int index = charts.IndexOf(chart);
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a blank slide to the presentation.
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Create instance to hold chart collection
Dim charts As IPresentationCharts = slide.Charts
'Add chart to slide
Dim chart As IPresentationChart = charts.AddChart(400, 300, 100, 100)
'Get the index of specific chart
Dim index As Integer = shapes.IndexOf(chart)
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
RemoveAt(Int32)
Removes the element at the specified index of the chart collection.
Declaration
void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index of the element to be removed. |
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Create instance to hold chart collection
IPresentationCharts charts = slide.Charts;
//Add chart to slide
IPresentationChart chart =charts.AddChart(400, 300, 100, 100);
//Remove chart specific index
charts.RemoveAt(0);
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a blank slide to the presentation.
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Create instance to hold chart collection
Dim charts As IPresentationCharts = slide.Charts
'Add chart to slide
Dim chart As IPresentationChart = charts.AddChart(400, 300, 100, 100)
'Remove chart specific index
chart.RemoveAt(0)
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()