Interface IOfficeChartTrendLines
Interface that represents trend line collection.
Namespace: Syncfusion.OfficeChart
Assembly: Syncfusion.OfficeChart.UWP.dll
Syntax
public interface IOfficeChartTrendLines
Properties
Count
Gets the number of IOfficeChartTrendLineobjects in the collection.Read-only.
Declaration
int Count { get; }
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 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];
//Add trendline to the serie
serieJan.TrendLines.Add();
serieFeb.TrendLines.Add();
//Add trendline with specific type
serieFeb.TrendLines.Add(OfficeTrendLineType.Moving_Average);
//Get the count of the trendline
int count = serieFeb.TrendLines.Count;
//Get the trendline instance from collection
IOfficeChartTrendLine trendline = serieFeb.TrendLines[0];
//Set the trendline color and weight
trendline.Border.LineWeight = OfficeChartLineWeight.Wide;
trendline.Border.LineColor = System.Drawing.Color.Blue;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create a presentation instance
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a blank slide to the presentation
Dim slide As ISlide = presentation__1.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)
'Add trendline to the serie
serieJan.TrendLines.Add()
serieFeb.TrendLines.Add()
'Add trendline with specific type
serieFeb.TrendLines.Add(OfficeTrendLineType.Moving_Average)
'Get the count of the trendline
Dim count As Integer = serieFeb.TrendLines.Count
'Get the trendline instance from collection
Dim trendline As IOfficeChartTrendLine = serieFeb.TrendLines(0)
'Set the trendline color and weight
trendline.Border.LineWeight = OfficeChartLineWeight.Wide
trendline.Border.LineColor = System.Drawing.Color.Blue
'Save the presentation
presentation__1.Save("Output.pptx")
'Close the presentation
presentation__1.Close()
Item[Int32]
Gets a single IOfficeChartTrendLine instance at the specified index from the collection. Read-only.
Declaration
IOfficeChartTrendLine this[int iIndex] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iIndex | The zero-based index of the element. |
Property Value
Type | Description |
---|---|
IOfficeChartTrendLine | Returns the particular trend line based on the index. |
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];
//Add trendline to the serie
serieJan.TrendLines.Add();
serieFeb.TrendLines.Add();
//Add trendline with specific type
serieFeb.TrendLines.Add(OfficeTrendLineType.Moving_Average);
//Get the count of the trendline
int count = serieFeb.TrendLines.Count;
//Get the trendline instance from collection
IOfficeChartTrendLine trendline = serieFeb.TrendLines[0];
//Set the trendline color and weight
trendline.Border.LineWeight = OfficeChartLineWeight.Wide;
trendline.Border.LineColor = System.Drawing.Color.Blue;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create a presentation instance
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a blank slide to the presentation
Dim slide As ISlide = presentation__1.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)
'Add trendline to the serie
serieJan.TrendLines.Add()
serieFeb.TrendLines.Add()
'Add trendline with specific type
serieFeb.TrendLines.Add(OfficeTrendLineType.Moving_Average)
'Get the count of the trendline
Dim count As Integer = serieFeb.TrendLines.Count
'Get the trendline instance from collection
Dim trendline As IOfficeChartTrendLine = serieFeb.TrendLines(0)
'Set the trendline color and weight
trendline.Border.LineWeight = OfficeChartLineWeight.Wide
trendline.Border.LineColor = System.Drawing.Color.Blue
'Save the presentation
presentation__1.Save("Output.pptx")
'Close the presentation
presentation__1.Close()
Methods
Add()
Adds new instance of trend line to collection.
Declaration
IOfficeChartTrendLine Add()
Returns
Type | Description |
---|---|
IOfficeChartTrendLine | Returns added trend line object. |
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];
//Add trendline to the serie
serieJan.TrendLines.Add();
//Add trendline with specific type
serieFeb.TrendLines.Add(OfficeTrendLineType.Moving_Average);
//Set the trendline color and weight
serieFeb.TrendLines[0].Border.LineWeight = OfficeChartLineWeight.Wide;
serieFeb.TrendLines[0].Border.LineColor = System.Drawing.Color.Blue;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create a presentation instance
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a blank slide to the presentation
Dim slide As ISlide = presentation__1.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)
'Add trendline to the serie
serieJan.TrendLines.Add()
'Add trendline with specific type
serieFeb.TrendLines.Add(OfficeTrendLineType.Moving_Average)
'Set the trendline color and weight
serieFeb.TrendLines(0).Border.LineWeight = OfficeChartLineWeight.Wide
serieFeb.TrendLines(0).Border.LineColor = System.Drawing.Color.Blue
'Save the presentation
presentation__1.Save("Output.pptx")
'Close the presentation
presentation__1.Close()
Add(OfficeTrendLineType)
Adds new instance of trend line to collection with specified type of trend line.
Declaration
IOfficeChartTrendLine Add(OfficeTrendLineType type)
Parameters
Type | Name | Description |
---|---|---|
OfficeTrendLineType | type | Represents type of trend line. |
Returns
Type | Description |
---|---|
IOfficeChartTrendLine | Returns added trend line object. |
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];
//Add trendline to the serie
serieJan.TrendLines.Add();
//Add trendline with specific type
serieFeb.TrendLines.Add(OfficeTrendLineType.Moving_Average);
//Set the trendline color and weight
serieFeb.TrendLines[0].Border.LineWeight = OfficeChartLineWeight.Wide;
serieFeb.TrendLines[0].Border.LineColor = System.Drawing.Color.Blue;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create a presentation instance
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a blank slide to the presentation
Dim slide As ISlide = presentation__1.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)
'Add trendline to the serie
serieJan.TrendLines.Add()
'Add trendline with specific type
serieFeb.TrendLines.Add(OfficeTrendLineType.Moving_Average)
'Set the trendline color and weight
serieFeb.TrendLines(0).Border.LineWeight = OfficeChartLineWeight.Wide
serieFeb.TrendLines(0).Border.LineColor = System.Drawing.Color.Blue
'Save the presentation
presentation__1.Save("Output.pptx")
'Close the presentation
presentation__1.Close()
Clear()
Clears trend line collection.
Declaration
void Clear()
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];
//Add trendline to the serie
serieJan.TrendLines.Add();
serieFeb.TrendLines.Add();
//Add trendline with specific type
serieFeb.TrendLines.Add(OfficeTrendLineType.Moving_Average);
//Get the count of the trendline
int count = serieFeb.TrendLines.Count;
//Get the trendline instance from collection
IOfficeChartTrendLine trendline = serieFeb.TrendLines[0];
//Set the trendline color and weight
trendline.Border.LineWeight = OfficeChartLineWeight.Wide;
trendline.Border.LineColor = System.Drawing.Color.Blue;
//Clear the trendlines in serie
serieFeb.TrendLines.Clear();
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create a presentation instance
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a blank slide to the presentation
Dim slide As ISlide = presentation__1.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)
'Add trendline to the serie
serieJan.TrendLines.Add()
serieFeb.TrendLines.Add()
'Add trendline with specific type
serieFeb.TrendLines.Add(OfficeTrendLineType.Moving_Average)
'Get the count of the trendline
Dim count As Integer = serieFeb.TrendLines.Count
'Get the trendline instance from collection
Dim trendline As IOfficeChartTrendLine = serieFeb.TrendLines(0)
'Set the trendline color and weight
trendline.Border.LineWeight = OfficeChartLineWeight.Wide
trendline.Border.LineColor = System.Drawing.Color.Blue
'Clear the trendlines in serie
serieFeb.TrendLines.Clear()
'Save the presentation
presentation__1.Save("Output.pptx")
'Close the presentation
presentation__1.Close()
RemoveAt(Int32)
Removes trend line object at the specified index from the collection.
Declaration
void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Represents |
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];
//Add trendline to the serie
serieJan.TrendLines.Add();
serieFeb.TrendLines.Add();
//Add trendline with specific type
serieFeb.TrendLines.Add(OfficeTrendLineType.Moving_Average);
//Get the count of the trendline
int count = serieFeb.TrendLines.Count;
//Get the trendline instance from collection
IOfficeChartTrendLine trendline = serieFeb.TrendLines[0];
//Set the trendline color and weight
trendline.Border.LineWeight = OfficeChartLineWeight.Wide;
trendline.Border.LineColor = System.Drawing.Color.Blue;
//Remove a trendline object using index
serieFeb.TrendLines.RemoveAt(1);
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create a presentation instance
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a blank slide to the presentation
Dim slide As ISlide = presentation__1.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)
'Add trendline to the serie
serieJan.TrendLines.Add()
serieFeb.TrendLines.Add()
'Add trendline with specific type
serieFeb.TrendLines.Add(OfficeTrendLineType.Moving_Average)
'Get the count of the trendline
Dim count As Integer = serieFeb.TrendLines.Count
'Get the trendline instance from collection
Dim trendline As IOfficeChartTrendLine = serieFeb.TrendLines(0)
'Set the trendline color and weight
trendline.Border.LineWeight = OfficeChartLineWeight.Wide
trendline.Border.LineColor = System.Drawing.Color.Blue
'Remove a trendline object using index
serieFeb.TrendLines.RemoveAt(1)
'Save the presentation
presentation__1.Save("Output.pptx")
'Close the presentation
presentation__1.Close()