Aspose::Cells::Charts::ITrendline Class Referenceabstract

Represents a trendline in a chart. More...

Inherits Aspose::Cells::Drawing::ILine.

Public Member Functions

virtual bool IsNameAuto ()=0
 Returns if Microsoft Excel automatically determines the name of the trendline. More...
 
virtual void SetNameAuto (bool value)=0
 Returns if Microsoft Excel automatically determines the name of the trendline. More...
 
virtual Aspose::Cells::Charts::TrendlineType GetType ()=0
 Returns the trendline type. More...
 
virtual intrusive_ptr< Aspose::Cells::Systems::String > GetName ()=0
 Returns the name of the trendline. More...
 
virtual void SetName (intrusive_ptr< Aspose::Cells::Systems::String > value)=0
 Returns the name of the trendline. More...
 
virtual Aspose::Cells::Systems::Int32 GetOrder ()=0
 Returns or sets the trendline order (an integer greater than 1) when the trendline type is Polynomial. The order must be between 2 and 6. More...
 
virtual void SetOrder (Aspose::Cells::Systems::Int32 value)=0
 Returns or sets the trendline order (an integer greater than 1) when the trendline type is Polynomial. The order must be between 2 and 6. More...
 
virtual Aspose::Cells::Systems::Int32 GetPeriod ()=0
 Returns or sets the period for the moving-average trendline. More...
 
virtual void SetPeriod (Aspose::Cells::Systems::Int32 value)=0
 Returns or sets the period for the moving-average trendline. More...
 
virtual Aspose::Cells::Systems::Double GetForward ()=0
 Returns or sets the number of periods (or units on a scatter chart) that the trendline extends forward. The number of periods must be greater than and equal to zero. More...
 
virtual void SetForward (Aspose::Cells::Systems::Double value)=0
 Returns or sets the number of periods (or units on a scatter chart) that the trendline extends forward. The number of periods must be greater than and equal to zero. More...
 
virtual Aspose::Cells::Systems::Double GetBackward ()=0
 Returns or sets the number of periods (or units on a scatter chart) that the trendline extends backward. The number of periods must be greater than and equal to zero. If the chart type is column ,the number of periods must be between 0 and 0.5 More...
 
virtual void SetBackward (Aspose::Cells::Systems::Double value)=0
 Returns or sets the number of periods (or units on a scatter chart) that the trendline extends backward. The number of periods must be greater than and equal to zero. If the chart type is column ,the number of periods must be between 0 and 0.5 More...
 
virtual bool GetDisplayEquation ()=0
 Represents if the equation for the trendline is displayed on the chart (in the same data label as the R-squared value). Setting this property to True automatically turns on data labels. More...
 
virtual void SetDisplayEquation (bool value)=0
 Represents if the equation for the trendline is displayed on the chart (in the same data label as the R-squared value). Setting this property to True automatically turns on data labels. More...
 
virtual bool GetDisplayRSquared ()=0
 Represents if the R-squared value of the trendline is displayed on the chart (in the same data label as the equation). Setting this property to True automatically turns on data labels. More...
 
virtual void SetDisplayRSquared (bool value)=0
 Represents if the R-squared value of the trendline is displayed on the chart (in the same data label as the equation). Setting this property to True automatically turns on data labels. More...
 
virtual Aspose::Cells::Systems::Double GetIntercept ()=0
 Returns or sets the point where the trendline crosses the value axis. More...
 
virtual void SetIntercept (Aspose::Cells::Systems::Double value)=0
 Returns or sets the point where the trendline crosses the value axis. More...
 
virtual intrusive_ptr< Aspose::Cells::Charts::IDataLabelsGetIDataLabels ()=0
 Represents the DataLabels object for the specified ASeries. More...
 
virtual intrusive_ptr< Aspose::Cells::Charts::ILegendEntryGetILegendEntry ()=0
 Gets the legend entry according to this trendline More...
 
- Public Member Functions inherited from Aspose::Cells::Drawing::ILine
virtual Aspose::Cells::Drawing::MsoLineStyle GetCompoundType ()=0
 Specifies the compound line type More...
 
virtual void SetCompoundType (Aspose::Cells::Drawing::MsoLineStyle value)=0
 Specifies the compound line type More...
 
virtual Aspose::Cells::Drawing::MsoLineDashStyle GetDashType ()=0
 Specifies the dash line type More...
 
virtual void SetDashType (Aspose::Cells::Drawing::MsoLineDashStyle value)=0
 Specifies the dash line type More...
 
virtual Aspose::Cells::Drawing::LineCapType GetCapType ()=0
 Specifies the ending caps. More...
 
virtual void SetCapType (Aspose::Cells::Drawing::LineCapType value)=0
 Specifies the ending caps. More...
 
virtual Aspose::Cells::Drawing::LineJoinType GetJoinType ()=0
 Specifies the joining caps. More...
 
virtual void SetJoinType (Aspose::Cells::Drawing::LineJoinType value)=0
 Specifies the joining caps. More...
 
virtual Aspose::Cells::Drawing::MsoArrowheadStyle GetBeginType ()=0
 Specifies an arrowhead for the begin of a line. More...
 
virtual void SetBeginType (Aspose::Cells::Drawing::MsoArrowheadStyle value)=0
 Specifies an arrowhead for the begin of a line. More...
 
virtual Aspose::Cells::Drawing::MsoArrowheadStyle GetEndType ()=0
 Specifies an arrowhead for the end of a line. More...
 
virtual void SetEndType (Aspose::Cells::Drawing::MsoArrowheadStyle value)=0
 Specifies an arrowhead for the end of a line. More...
 
virtual Aspose::Cells::Drawing::MsoArrowheadLength GetBeginArrowLength ()=0
 Specifies the length of the arrowhead for the begin of a line. More...
 
virtual void SetBeginArrowLength (Aspose::Cells::Drawing::MsoArrowheadLength value)=0
 Specifies the length of the arrowhead for the begin of a line. More...
 
virtual Aspose::Cells::Drawing::MsoArrowheadLength GetEndArrowLength ()=0
 Specifies the length of the arrowhead for the end of a line. More...
 
virtual void SetEndArrowLength (Aspose::Cells::Drawing::MsoArrowheadLength value)=0
 Specifies the length of the arrowhead for the end of a line. More...
 
virtual Aspose::Cells::Drawing::MsoArrowheadWidth GetBeginArrowWidth ()=0
 Specifies the width of the arrowhead for the begin of a line. More...
 
virtual void SetBeginArrowWidth (Aspose::Cells::Drawing::MsoArrowheadWidth value)=0
 Specifies the width of the arrowhead for the begin of a line. More...
 
virtual Aspose::Cells::Drawing::MsoArrowheadWidth GetEndArrowWidth ()=0
 Specifies the width of the arrowhead for the end of a line. More...
 
virtual void SetEndArrowWidth (Aspose::Cells::Drawing::MsoArrowheadWidth value)=0
 Specifies the width of the arrowhead for the end of a line. More...
 
virtual intrusive_ptr< Aspose::Cells::IThemeColorGetIThemeColor ()=0
 Gets the theme color. More...
 
virtual void SetIThemeColor (intrusive_ptr< Aspose::Cells::IThemeColor > value)=0
 Sets the theme color. More...
 
virtual intrusive_ptr< Aspose::Cells::Systems::Drawing::Color > GetColor ()=0
 Represents the Color of the line. More...
 
virtual void SetColor (intrusive_ptr< Aspose::Cells::Systems::Drawing::Color > value)=0
 Represents the Color of the line. More...
 
virtual Aspose::Cells::Systems::Double GetTransparency ()=0
 Returns or sets the degree of transparency of the line as a value from 0.0 (opaque) through 1.0 (clear). More...
 
virtual void SetTransparency (Aspose::Cells::Systems::Double value)=0
 Returns or sets the degree of transparency of the line as a value from 0.0 (opaque) through 1.0 (clear). More...
 
virtual Aspose::Cells::Drawing::LineType GetStyle ()=0
 Represents the style of the line. More...
 
virtual void SetStyle (Aspose::Cells::Drawing::LineType value)=0
 Represents the style of the line. More...
 
virtual Aspose::Cells::Drawing::WeightType GetWeight ()=0
 Gets the WeightType of the line. More...
 
virtual void SetWeight (Aspose::Cells::Drawing::WeightType value)=0
 Sets the WeightType of the line. More...
 
virtual Aspose::Cells::Systems::Double GetWeightPt ()=0
 Gets the weight of the line in unit of points. More...
 
virtual void SetWeightPt (Aspose::Cells::Systems::Double value)=0
 Sets the weight of the line in unit of points. More...
 
virtual Aspose::Cells::Systems::Double GetWeightPx ()=0
 Gets the weight of the line in uni of pixels. More...
 
virtual void SetWeightPx (Aspose::Cells::Systems::Double value)=0
 Sets the weight of the line in uni of pixels. More...
 
virtual Aspose::Cells::Charts::ChartLineFormattingType GetFormattingType ()=0
 Gets format type. More...
 
virtual void SetFormattingType (Aspose::Cells::Charts::ChartLineFormattingType value)=0
 Sets format type. More...
 
virtual bool IsAutomaticColor ()=0
 Indicates whether the color of line is auotmatic assigned. More...
 
virtual bool IsVisible ()=0
 Represents whether the line is visible. More...
 
virtual void SetVisible (bool value)=0
 Represents whether the line is visible. More...
 
virtual bool IsAuto ()=0
 Indicates whether this line style is auto assigned. More...
 
virtual void SetAuto (bool value)=0
 Indicates whether this line style is auto assigned. More...
 
virtual intrusive_ptr< Aspose::Cells::Drawing::IGradientFillGetIGradientFill ()=0
 Represents gradient fill. More...
 

Detailed Description

Represents a trendline in a chart.

[C++]
//Instantiating a Workbook object
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook();
//Adding a new worksheet to the Excel object
Aspose::Cells::Systems::Int32 sheetIndex = workbook->GetIWorksheets()->Add();
//Obtaining the reference of the newly added worksheet by passing its sheet index
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(sheetIndex);
//Adding a sample value to "A1" cell
worksheet->GetICells()->GetObjectByIndex(new String("A1"))->PutValue(50);
//Adding a sample value to "A2" cell
worksheet->GetICells()->GetObjectByIndex(new String("A2"))->PutValue(100);
//Adding a sample value to "A3" cell
worksheet->GetICells()->GetObjectByIndex(new String("A3"))->PutValue(150);
//Adding a sample value to "A4" cell
worksheet->GetICells()->GetObjectByIndex(new String("A4"))->PutValue(200);
//Adding a sample value to "B1" cell
worksheet->GetICells()->GetObjectByIndex(new String("B1"))->PutValue(60);
//Adding a sample value to "B2" cell
worksheet->GetICells()->GetObjectByIndex(new String("B2"))->PutValue(32);
//Adding a sample value to "B3" cell
worksheet->GetICells()->GetObjectByIndex(new String("B3"))->PutValue(50);
//Adding a sample value to "B4" cell
worksheet->GetICells()->GetObjectByIndex(new String("B4"))->PutValue(40);
//Adding a sample value to "C1" cell as category data
worksheet->GetICells()->GetObjectByIndex(new String("C1"))->PutValue(new String("Q1"));
//Adding a sample value to "C2" cell as category data
worksheet->GetICells()->GetObjectByIndex(new String("C2"))->PutValue(new String("Q2"));
//Adding a sample value to "C3" cell as category data
worksheet->GetICells()->GetObjectByIndex(new String("C3"))->PutValue(new String("Y1"));
//Adding a sample value to "C4" cell as category data
worksheet->GetICells()->GetObjectByIndex(new String("C4"))->PutValue(new String("Y2"));
//Adding a chart to the worksheet
Aspose::Cells::Systems::Int32 chartIndex = worksheet->GetICharts()->Add(ChartType_Column, 5, 0, 15, 5);
//Accessing the instance of the newly added chart
intrusive_ptr<IChart> chart = worksheet->GetICharts()->GetObjectByIndex(chartIndex);
//Adding NSeries (chart data source) to the chart ranging from "A1" cell to "B4"
chart->GetNISeries()->Add(new String("A1::B4"), true);
//Setting the data source for the category data of NSeries
chart->GetNISeries()->SetCategoryData(new String("C1::C4"));
//adding a linear trendline
Aspose::Cells::Systems::Int32 index = chart->GetNISeries()->GetObjectByIndex(0)->GetITrendLines()->Add(TrendlineType_Linear);
intrusive_ptr<ITrendline> trendline = chart->GetNISeries()->GetObjectByIndex(0)->GetITrendLines()->GetObjectByIndex(index);
//Setting the custom name of the trendline.
trendline->SetName(new String("Linear"));
//Displaying the equation on chart
trendline->SetDisplayEquation = true;
//Displaying the R-Squared value on chart
trendline->SetDisplayRSquared = true;
//Saving the Excel file
workbook->Save(new String("Book1.xls"));

Member Function Documentation

◆ GetBackward()

virtual Aspose::Cells::Systems::Double Aspose::Cells::Charts::ITrendline::GetBackward ( )
pure virtual

Returns or sets the number of periods (or units on a scatter chart) that the trendline extends backward. The number of periods must be greater than and equal to zero. If the chart type is column ,the number of periods must be between 0 and 0.5

◆ GetDisplayEquation()

virtual bool Aspose::Cells::Charts::ITrendline::GetDisplayEquation ( )
pure virtual

Represents if the equation for the trendline is displayed on the chart (in the same data label as the R-squared value). Setting this property to True automatically turns on data labels.

◆ GetDisplayRSquared()

virtual bool Aspose::Cells::Charts::ITrendline::GetDisplayRSquared ( )
pure virtual

Represents if the R-squared value of the trendline is displayed on the chart (in the same data label as the equation). Setting this property to True automatically turns on data labels.

◆ GetForward()

virtual Aspose::Cells::Systems::Double Aspose::Cells::Charts::ITrendline::GetForward ( )
pure virtual

Returns or sets the number of periods (or units on a scatter chart) that the trendline extends forward. The number of periods must be greater than and equal to zero.

◆ GetIDataLabels()

virtual intrusive_ptr<Aspose::Cells::Charts::IDataLabels> Aspose::Cells::Charts::ITrendline::GetIDataLabels ( )
pure virtual

Represents the DataLabels object for the specified ASeries.

◆ GetILegendEntry()

virtual intrusive_ptr<Aspose::Cells::Charts::ILegendEntry> Aspose::Cells::Charts::ITrendline::GetILegendEntry ( )
pure virtual

Gets the legend entry according to this trendline

◆ GetIntercept()

virtual Aspose::Cells::Systems::Double Aspose::Cells::Charts::ITrendline::GetIntercept ( )
pure virtual

Returns or sets the point where the trendline crosses the value axis.

◆ GetName()

virtual intrusive_ptr<Aspose::Cells::Systems::String> Aspose::Cells::Charts::ITrendline::GetName ( )
pure virtual

Returns the name of the trendline.

◆ GetOrder()

virtual Aspose::Cells::Systems::Int32 Aspose::Cells::Charts::ITrendline::GetOrder ( )
pure virtual

Returns or sets the trendline order (an integer greater than 1) when the trendline type is Polynomial. The order must be between 2 and 6.

◆ GetPeriod()

virtual Aspose::Cells::Systems::Int32 Aspose::Cells::Charts::ITrendline::GetPeriod ( )
pure virtual

Returns or sets the period for the moving-average trendline.

This value should be between 2 and 255. And it must be less than the number of the chart points in the series

◆ GetType()

virtual Aspose::Cells::Charts::TrendlineType Aspose::Cells::Charts::ITrendline::GetType ( )
pure virtual

Returns the trendline type.

◆ IsNameAuto()

virtual bool Aspose::Cells::Charts::ITrendline::IsNameAuto ( )
pure virtual

Returns if Microsoft Excel automatically determines the name of the trendline.

◆ SetBackward()

virtual void Aspose::Cells::Charts::ITrendline::SetBackward ( Aspose::Cells::Systems::Double  value)
pure virtual

Returns or sets the number of periods (or units on a scatter chart) that the trendline extends backward. The number of periods must be greater than and equal to zero. If the chart type is column ,the number of periods must be between 0 and 0.5

◆ SetDisplayEquation()

virtual void Aspose::Cells::Charts::ITrendline::SetDisplayEquation ( bool  value)
pure virtual

Represents if the equation for the trendline is displayed on the chart (in the same data label as the R-squared value). Setting this property to True automatically turns on data labels.

◆ SetDisplayRSquared()

virtual void Aspose::Cells::Charts::ITrendline::SetDisplayRSquared ( bool  value)
pure virtual

Represents if the R-squared value of the trendline is displayed on the chart (in the same data label as the equation). Setting this property to True automatically turns on data labels.

◆ SetForward()

virtual void Aspose::Cells::Charts::ITrendline::SetForward ( Aspose::Cells::Systems::Double  value)
pure virtual

Returns or sets the number of periods (or units on a scatter chart) that the trendline extends forward. The number of periods must be greater than and equal to zero.

◆ SetIntercept()

virtual void Aspose::Cells::Charts::ITrendline::SetIntercept ( Aspose::Cells::Systems::Double  value)
pure virtual

Returns or sets the point where the trendline crosses the value axis.

◆ SetName()

virtual void Aspose::Cells::Charts::ITrendline::SetName ( intrusive_ptr< Aspose::Cells::Systems::String >  value)
pure virtual

Returns the name of the trendline.

◆ SetNameAuto()

virtual void Aspose::Cells::Charts::ITrendline::SetNameAuto ( bool  value)
pure virtual

Returns if Microsoft Excel automatically determines the name of the trendline.

◆ SetOrder()

virtual void Aspose::Cells::Charts::ITrendline::SetOrder ( Aspose::Cells::Systems::Int32  value)
pure virtual

Returns or sets the trendline order (an integer greater than 1) when the trendline type is Polynomial. The order must be between 2 and 6.

◆ SetPeriod()

virtual void Aspose::Cells::Charts::ITrendline::SetPeriod ( Aspose::Cells::Systems::Int32  value)
pure virtual

Returns or sets the period for the moving-average trendline.

This value should be between 2 and 255. And it must be less than the number of the chart points in the series