Interface IOfficeChartTrendLine
Represents a trend line in a chart.
Namespace: Syncfusion.OfficeChart
Assembly: Syncfusion.OfficeChart.Base.dll
Syntax
public interface IOfficeChartTrendLine
Properties
Backward
Gets or sets the number of periods (or units on a scatter chart) that the trend line extends backward.
Declaration
double Backward { 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, 700, 500);
//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 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.Bar_Clustered;
//Add trendline to the serie
serieJan.TrendLines.Add();
//Get the trendline of serie
IOfficeChartTrendLine trendline = serieJan.TrendLines[0];
//Set the backward
trendline.Backward = 0.3;
//Set the line color of border
trendline.Border.LineColor = System.Drawing.Color.Green;
//Set the line weight
trendline.Border.LineWeight = OfficeChartLineWeight.Medium;
//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)
'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 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.Bar_Clustered
'Add trendline to the serie
serieJan.TrendLines.Add()
'Get the trendline of serie
Dim trendline As IOfficeChartTrendLine = serieJan.TrendLines(0)
'Set the backward
trendline.Backward = 0.3
'Set the line color of border
trendline.Border.LineColor = System.Drawing.Color.Green
'Set the line weight
trendline.Border.LineWeight = OfficeChartLineWeight.Medium
'Save the presentation
presentation__1.Save("Output.pptx")
'Close the presentation
presentation__1.Close()
Border
Gets the border of the trend line. Read-only.
Declaration
IOfficeChartBorder Border { get; }
Property Value
Type |
---|
IOfficeChartBorder |
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);
//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 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.Bar_Clustered;
//Add trendline to the serie
serieJan.TrendLines.Add();
//Get the trendline of serie
IOfficeChartTrendLine trendline = serieJan.TrendLines[0];
//Set the line color of border
trendline.Border.LineColor = System.Drawing.Color.Green;
//Set the line weight
trendline.Border.LineWeight = OfficeChartLineWeight.Medium;
//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)
'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 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.Bar_Clustered
'Add trendline to the serie
serieJan.TrendLines.Add()
'Get the trendline of serie
Dim trendline As IOfficeChartTrendLine = serieJan.TrendLines(0)
'Set the line color of border
trendline.Border.LineColor = System.Drawing.Color.Green
'Set the line weight
trendline.Border.LineWeight = OfficeChartLineWeight.Medium
'Save the presentation
presentation__1.Save("Output.pptx")
'Close the presentation
presentation__1.Close()
Chart3DOptions
Gets the chart3D options that is associated with the trendline.Read-only.
Declaration
IThreeDFormat Chart3DOptions { get; }
Property Value
Type | Description |
---|---|
IThreeDFormat | The chart3 D options. |
DataLabel
Gets the data label that is associated with the trendline.Read-only.
Declaration
IOfficeChartTextArea DataLabel { 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);
//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 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.Bar_Clustered;
//Add trendline to the serie
serieJan.TrendLines.Add();
//Get the trendline of serie
IOfficeChartTrendLine trendline = serieJan.TrendLines[0];
//Set the bold font style for data label
trendline.DataLabel.Bold = true;
//Set the color of data label
trendline.DataLabel.Color = OfficeKnownColors.Red;
//Set the font name
trendline.DataLabel.FontName = "Helvetica";
//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)
'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 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.Bar_Clustered
'Add trendline to the serie
serieJan.TrendLines.Add()
'Get the trendline of serie
Dim trendline As IOfficeChartTrendLine = serieJan.TrendLines(0)
'Set the bold font style for data label
trendline.DataLabel.Bold = True
'Set the color of data label
trendline.DataLabel.Color = OfficeKnownColors.Red
'Set the font name
trendline.DataLabel.FontName = "Helvetica"
'Save the presentation
presentation__1.Save("Output.pptx")
'Close the presentation
presentation__1.Close()
DisplayEquation
Gets or sets a value that indicates whether the equation for the trend line is displayed on the chart or not.
Declaration
bool DisplayEquation { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Examples
//Create a presentation instance
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add chart to the slide with position and size
IPresentationChart chart = slide.Charts.AddChart(100, 10, 700, 500);
//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];
//Add trendline to the serie
serieJan.TrendLines.Add();
//Get the trendline of serie
IOfficeChartTrendLine trendline = serieJan.TrendLines[0];
//Set the display equation
trendline.DisplayEquation = true;
//Set the display RSSquared
trendline.DisplayRSquared = true;
//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)
'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)
'Add trendline to the serie
serieJan.TrendLines.Add()
'Get the trendline of serie
Dim trendline As IOfficeChartTrendLine = serieJan.TrendLines(0)
'Set the display equation
trendline.DisplayEquation = True
'Set the display RSSquared
trendline.DisplayRSquared = True
'Save the presentation
presentation__1.Save("Output.pptx")
'Close the presentation
presentation__1.Close()
DisplayRSquared
Gets of sets a value that indicates whether the R-squared value of the trend line is displayed on the chart or not.
Declaration
bool DisplayRSquared { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Examples
//Create a presentation instance
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add chart to the slide with position and size
IPresentationChart chart = slide.Charts.AddChart(100, 10, 700, 500);
//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];
//Add trendline to the serie
serieJan.TrendLines.Add();
//Get the trendline of serie
IOfficeChartTrendLine trendline = serieJan.TrendLines[0];
//Set the display equation
trendline.DisplayEquation = true;
//Set the display RSSquared
trendline.DisplayRSquared = true;
//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)
'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)
'Add trendline to the serie
serieJan.TrendLines.Add()
'Get the trendline of serie
Dim trendline As IOfficeChartTrendLine = serieJan.TrendLines(0)
'Set the display equation
trendline.DisplayEquation = True
'Set the display RSSquared
trendline.DisplayRSquared = True
'Save the presentation
presentation__1.Save("Output.pptx")
'Close the presentation
presentation__1.Close()
Forward
Gets or sets the number of periods (or units on a scatter chart) that the trend line extends forward.
Declaration
double Forward { 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, 700, 500);
//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];
//Add trendline to the serie
serieJan.TrendLines.Add();
//Get the trendline of serie
IOfficeChartTrendLine trendline = serieJan.TrendLines[0];
//Set the intercept as auto
trendline.InterceptIsAuto = true;
//Set the name as auto
trendline.NameIsAuto = true;
//Set the forward
trendline.Forward = 0.3;
//Set the type of trendline
trendline.Type = OfficeTrendLineType.Logarithmic;
//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)
'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)
'Add trendline to the serie
serieJan.TrendLines.Add()
'Get the trendline of serie
Dim trendline As IOfficeChartTrendLine = serieJan.TrendLines(0)
'Set the intercept as auto
trendline.InterceptIsAuto = True
'Set the name as auto
trendline.NameIsAuto = True
'Set the forward
trendline.Forward = 0.3
'Set the type of trendline
trendline.Type = OfficeTrendLineType.Logarithmic
'Save the presentation
presentation__1.Save("Output.pptx")
'Close the presentation
presentation__1.Close()
Intercept
Gets or sets the point where the trend line crosses the value axis.
Declaration
double Intercept { 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, 700, 500);
//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];
//Add trendline to the serie
serieJan.TrendLines.Add();
//Get the trendline of serie
IOfficeChartTrendLine trendline = serieJan.TrendLines[0];
//Set the type of trendline
trendline.Type = OfficeTrendLineType.Polynomial;
//Set the intercept of trendline
trendline.Intercept = 0.8;
//Set the name for trendline
trendline.Name = "Trendline";
//Set the order
trendline.Order = 3;
//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)
'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)
'Add trendline to the serie
serieJan.TrendLines.Add()
'Get the trendline of serie
Dim trendline As IOfficeChartTrendLine = serieJan.TrendLines(0)
'Set the type of trendline
trendline.Type = OfficeTrendLineType.Polynomial
'Set the intercept of trendline
trendline.Intercept = 0.8
'Set the name for trendline
trendline.Name = "Trendline"
'Set the order
trendline.Order = 3
'Save the presentation
presentation__1.Save("Output.pptx")
'Close the presentation
presentation__1.Close()
InterceptIsAuto
Gets or sets the value that indicates whether the point where the trend line crosses the value axis is automatically determined by the regression.
Declaration
bool InterceptIsAuto { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Examples
//Create a presentation instance
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add chart to the slide with position and size
IPresentationChart chart = slide.Charts.AddChart(100, 10, 700, 500);
//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];
//Add trendline to the serie
serieJan.TrendLines.Add();
//Get the trendline of serie
IOfficeChartTrendLine trendline = serieJan.TrendLines[0];
//Set the intercept as auto
trendline.InterceptIsAuto = true;
//Set the name as auto
trendline.NameIsAuto = true;
//Set the forward
trendline.Forward = 0.3;
//Set the type of trendline
trendline.Type = OfficeTrendLineType.Logarithmic;
//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)
'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)
'Add trendline to the serie
serieJan.TrendLines.Add()
'Get the trendline of serie
Dim trendline As IOfficeChartTrendLine = serieJan.TrendLines(0)
'Set the intercept as auto
trendline.InterceptIsAuto = True
'Set the name as auto
trendline.NameIsAuto = True
'Set the forward
trendline.Forward = 0.3
'Set the type of trendline
trendline.Type = OfficeTrendLineType.Logarithmic
'Save the presentation
presentation__1.Save("Output.pptx")
'Close the presentation
presentation__1.Close()
Name
Gets or sets name of the trend line.
Declaration
string Name { 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);
//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];
//Add trendline to the serie
serieJan.TrendLines.Add();
//Get the trendline of serie
IOfficeChartTrendLine trendline = serieJan.TrendLines[0];
//Set the type of trendline
trendline.Type = OfficeTrendLineType.Polynomial;
//Set the intercept of trendline
trendline.Intercept = 0.8;
//Set the name for trendline
trendline.Name = "Trendline";
//Set the order
trendline.Order = 3;
//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)
'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)
'Add trendline to the serie
serieJan.TrendLines.Add()
'Get the trendline of serie
Dim trendline As IOfficeChartTrendLine = serieJan.TrendLines(0)
'Set the type of trendline
trendline.Type = OfficeTrendLineType.Polynomial
'Set the intercept of trendline
trendline.Intercept = 0.8
'Set the name for trendline
trendline.Name = "Trendline"
'Set the order
trendline.Order = 3
'Save the presentation
presentation__1.Save("Output.pptx")
'Close the presentation
presentation__1.Close()
NameIsAuto
Gets or sets a value that Indicates whether the name of the trend line is determined automatically or not.
Declaration
bool NameIsAuto { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Examples
//Create a presentation instance
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add chart to the slide with position and size
IPresentationChart chart = slide.Charts.AddChart(100, 10, 700, 500);
//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];
//Add trendline to the serie
serieJan.TrendLines.Add();
//Get the trendline of serie
IOfficeChartTrendLine trendline = serieJan.TrendLines[0];
//Set the intercept as auto
trendline.InterceptIsAuto = true;
//Set the name as auto
trendline.NameIsAuto = true;
//Set the forward
trendline.Forward = 0.3;
//Set the type of trendline
trendline.Type = OfficeTrendLineType.Logarithmic;
//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)
'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)
'Add trendline to the serie
serieJan.TrendLines.Add()
'Get the trendline of serie
Dim trendline As IOfficeChartTrendLine = serieJan.TrendLines(0)
'Set the intercept as auto
trendline.InterceptIsAuto = True
'Set the name as auto
trendline.NameIsAuto = True
'Set the forward
trendline.Forward = 0.3
'Set the type of trendline
trendline.Type = OfficeTrendLineType.Logarithmic
'Save the presentation
presentation__1.Save("Output.pptx")
'Close the presentation
presentation__1.Close()
Order
Gets or sets the trend line order (an integer greater than 1) when the trend line type is Polynomial.
Declaration
int Order { 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);
//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];
//Add trendline to the serie
serieJan.TrendLines.Add();
//Get the trendline of serie
IOfficeChartTrendLine trendline = serieJan.TrendLines[0];
//Set the type of trendline
trendline.Type = OfficeTrendLineType.Polynomial;
//Set the intercept of trendline
trendline.Intercept = 0.8;
//Set the name for trendline
trendline.Name = "Trendline";
//Set the order
trendline.Order = 3;
//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)
'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)
'Add trendline to the serie
serieJan.TrendLines.Add()
'Get the trendline of serie
Dim trendline As IOfficeChartTrendLine = serieJan.TrendLines(0)
'Set the type of trendline
trendline.Type = OfficeTrendLineType.Polynomial
'Set the intercept of trendline
trendline.Intercept = 0.8
'Set the name for trendline
trendline.Name = "Trendline"
'Set the order
trendline.Order = 3
'Save the presentation
presentation__1.Save("Output.pptx")
'Close the presentation
presentation__1.Close()
Shadow
Gets the shadow that is associated with the trendline.Read-only.
Declaration
IShadow Shadow { get; }
Property Value
Type | Description |
---|---|
IShadow | The shadow. |
Type
Returns or sets the trend line type
Declaration
OfficeTrendLineType Type { get; set; }
Property Value
Type |
---|
OfficeTrendLineType |
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);
//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];
//Add trendline to the serie
serieJan.TrendLines.Add();
//Get the trendline of serie
IOfficeChartTrendLine trendline = serieJan.TrendLines[0];
//Set the intercept as auto
trendline.InterceptIsAuto = true;
//Set the name as auto
trendline.NameIsAuto = true;
//Set the forward
trendline.Forward = 0.3;
//Set the type of trendline
trendline.Type = OfficeTrendLineType.Logarithmic;
//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)
'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)
'Add trendline to the serie
serieJan.TrendLines.Add()
'Get the trendline of serie
Dim trendline As IOfficeChartTrendLine = serieJan.TrendLines(0)
'Set the intercept as auto
trendline.InterceptIsAuto = True
'Set the name as auto
trendline.NameIsAuto = True
'Set the forward
trendline.Forward = 0.3
'Set the type of trendline
trendline.Type = OfficeTrendLineType.Logarithmic
'Save the presentation
presentation__1.Save("Output.pptx")
'Close the presentation
presentation__1.Close()
Methods
ClearFormats()
Clears the formatting of the trend line.
Declaration
void ClearFormats()
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);
//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];
//Add trendline to the serie
serieJan.TrendLines.Add();
//Get the trendline of serie
IOfficeChartTrendLine trendline = serieJan.TrendLines[0];
//Set the type of trendline
trendline.Type = OfficeTrendLineType.Polynomial;
//Set the intercept of trendline
trendline.Intercept = 0.8;
//Set the name for trendline
trendline.Name = "Trendline";
//Set the order
trendline.Order = 3;
//Clear the trendline formats
trendline.ClearFormats();
//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)
'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)
'Add trendline to the serie
serieJan.TrendLines.Add()
'Get the trendline of serie
Dim trendline As IOfficeChartTrendLine = serieJan.TrendLines(0)
'Set the type of trendline
trendline.Type = OfficeTrendLineType.Polynomial
'Set the intercept of trendline
trendline.Intercept = 0.8
'Set the name for trendline
trendline.Name = "Trendline"
'Set the order
trendline.Order = 3
'Clear the trendline formats
trendline.ClearFormats()
'Save the presentation
presentation__1.Save("Output.pptx")
'Close the presentation
presentation__1.Close()