asposecells.api
Class Trendline

Represents a trendline in a chart.

Example:

# Instantiating a Workbook object
workbook = Workbook()
# Adding a new worksheet to the Excel object
sheetIndex = workbook.getWorksheets().add()
# Obtaining the reference of the newly added worksheet by passing its sheet index
worksheet = workbook.getWorksheets().get(sheetIndex)
# Adding a sample value to "A1" cell
worksheet.getCells().get("A1").putValue(50)
# Adding a sample value to "A2" cell
worksheet.getCells().get("A2").putValue(100)
# Adding a sample value to "A3" cell
worksheet.getCells().get("A3").putValue(150)
# Adding a sample value to "A4" cell
worksheet.getCells().get("A4").putValue(200)
# Adding a sample value to "B1" cell
worksheet.getCells().get("B1").putValue(60)
# Adding a sample value to "B2" cell
worksheet.getCells().get("B2").putValue(32)
# Adding a sample value to "B3" cell
worksheet.getCells().get("B3").putValue(50)
# Adding a sample value to "B4" cell
worksheet.getCells().get("B4").putValue(40)
# Adding a sample value to "C1" cell as category data
worksheet.getCells().get("C1").putValue("Q1")
# Adding a sample value to "C2" cell as category data
worksheet.getCells().get("C2").putValue("Q2")
# Adding a sample value to "C3" cell as category data
worksheet.getCells().get("C3").putValue("Y1")
# Adding a sample value to "C4" cell as category data
worksheet.getCells().get("C4").putValue("Y2")
# Adding a chart to the worksheet
chartIndex = worksheet.getCharts().add(ChartType.COLUMN, 5, 0, 15, 5)
# Accessing the instance of the newly added chart
chart = worksheet.getCharts().get(chartIndex)
# Adding NSeries (chart data source) to the chart ranging from "A1" cell to "B4"
chart.getNSeries().add("A1:B4", True)
# Setting the data source for the category data of NSeries
chart.getNSeries().setCategoryData("C1:C4")
# adding a linear trendline
index = chart.getNSeries().get(0).getTrendLines().add(TrendlineType.LINEAR)
trendline = chart.getNSeries().get(0).getTrendLines().get(index)
# Setting the custom name of the trendline.
trendline.setName("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("Book1.xls")

Property Getters/Setters Summary
methodgetBackward()
methodsetBackward(value)
           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
methodgetBeginArrowLength()
methodsetBeginArrowLength(value)
           Specifies the length of the arrowhead for the begin of a line. The value of the property is MsoArrowheadLength integer constant.
methodgetBeginArrowWidth()
methodsetBeginArrowWidth(value)
           Specifies the width of the arrowhead for the begin of a line. The value of the property is MsoArrowheadWidth integer constant.
methodgetBeginType()
methodsetBeginType(value)
           Specifies an arrowhead for the begin of a line. The value of the property is MsoArrowheadStyle integer constant.
methodgetCapType()
methodsetCapType(value)
           Specifies the ending caps. The value of the property is LineCapType integer constant.
methodgetColor()
methodsetColor(value)
           Represents the com.aspose.cells.Color of the line.
methodgetCompoundType()
methodsetCompoundType(value)
           Specifies the compound line type The value of the property is MsoLineStyle integer constant.
methodgetDashType()
methodsetDashType(value)
           Specifies the dash line type The value of the property is MsoLineDashStyle integer constant.
methodgetDataLabels()
           Represents the DataLabels object for the specified ASeries.
methodgetDisplayEquation()
methodsetDisplayEquation(value)
           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.
methodgetDisplayRSquared()
methodsetDisplayRSquared(value)
           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.
methodgetEndArrowLength()
methodsetEndArrowLength(value)
           Specifies the length of the arrowhead for the end of a line. The value of the property is MsoArrowheadLength integer constant.
methodgetEndArrowWidth()
methodsetEndArrowWidth(value)
           Specifies the width of the arrowhead for the end of a line. The value of the property is MsoArrowheadWidth integer constant.
methodgetEndType()
methodsetEndType(value)
           Specifies an arrowhead for the end of a line. The value of the property is MsoArrowheadStyle integer constant.
methodgetFormattingType()
methodsetFormattingType(value)
           Gets or sets format type. The value of the property is ChartLineFormattingType integer constant.
methodgetForward()
methodsetForward(value)
           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.
methodgetGradientFill()
           Represents gradient fill.
methodgetIntercept()
methodsetIntercept(value)
           Returns or sets the point where the trendline crosses the value axis.
methodisAuto()
methodsetAuto(value)
           Indicates whether this line style is auto assigned.
methodisAutomaticColor()
           Indicates whether the color of line is auotmatic assigned.
methodisNameAuto()
methodsetNameAuto(value)
           Returns if Microsoft Excel automatically determines the name of the trendline.
methodisVisible()
methodsetVisible(value)
           Represents whether the line is visible.
methodgetJoinType()
methodsetJoinType(value)
           Specifies the joining caps. The value of the property is LineJoinType integer constant.
methodgetLegendEntry()
           Gets the legend entry according to this trendline
methodgetName()
methodsetName(value)
           Returns the name of the trendline.
methodgetOrder()
methodsetOrder(value)
           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.
methodgetPeriod()
methodsetPeriod(value)
           Returns or sets the period for the moving-average trendline.
methodgetStyle()
methodsetStyle(value)
           Represents the style of the line. The value of the property is LineType integer constant.
methodgetThemeColor()
methodsetThemeColor(value)
           Gets and sets the theme color.
methodgetTransparency()
methodsetTransparency(value)
           Returns or sets the degree of transparency of the line as a value from 0.0 (opaque) through 1.0 (clear).
methodgetType()
           Returns the trendline type. The value of the property is TrendlineType integer constant.
methodgetWeight()
methodsetWeight(value)
           Gets or sets the WeightType of the line. The value of the property is WeightType integer constant.
methodgetWeightPt()
methodsetWeightPt(value)
           Gets or sets the weight of the line in unit of points.
methodgetWeightPx()
methodsetWeightPx(value)
           Gets or sets the weight of the line in uni of pixels.
 
Method Summary
methodisInterceptAuto()
           Indicates whether Microsoft Workbook automatically determines the intercept of the trendline.
methodsetInterceptAuto(isInterceptAuto)
           Sets whether Microsoft Workbook automatically determines the intercept of the trendline.
 

Property Getters/Setters Detail

isNameAuto/setNameAuto : boolean 

boolean isNameAuto() / setNameAuto(value)
Returns if Microsoft Excel automatically determines the name of the trendline.

getType : int 

int getType()
Returns the trendline type. The value of the property is TrendlineType integer constant.

getName/setName : String 

String getName() / setName(value)
Returns the name of the trendline.

getOrder/setOrder : int 

int getOrder() / setOrder(value)
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/setPeriod : int 

int getPeriod() / setPeriod(value)
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

getForward/setForward : float 

float getForward() / setForward(value)
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.

getBackward/setBackward : float 

float getBackward() / setBackward(value)
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/setDisplayEquation : boolean 

boolean getDisplayEquation() / setDisplayEquation(value)
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/setDisplayRSquared : boolean 

boolean getDisplayRSquared() / setDisplayRSquared(value)
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.

getIntercept/setIntercept : float 

float getIntercept() / setIntercept(value)
Returns or sets the point where the trendline crosses the value axis.

getDataLabels : DataLabels 

DataLabels getDataLabels()
Represents the DataLabels object for the specified ASeries.

getLegendEntry : LegendEntry 

LegendEntry getLegendEntry()
Gets the legend entry according to this trendline

getCompoundType/setCompoundType : int 

int getCompoundType() / setCompoundType(value)
Specifies the compound line type The value of the property is MsoLineStyle integer constant.

getDashType/setDashType : int 

int getDashType() / setDashType(value)
Specifies the dash line type The value of the property is MsoLineDashStyle integer constant.

getCapType/setCapType : int 

int getCapType() / setCapType(value)
Specifies the ending caps. The value of the property is LineCapType integer constant.

getJoinType/setJoinType : int 

int getJoinType() / setJoinType(value)
Specifies the joining caps. The value of the property is LineJoinType integer constant.

getBeginType/setBeginType : int 

int getBeginType() / setBeginType(value)
Specifies an arrowhead for the begin of a line. The value of the property is MsoArrowheadStyle integer constant.

getEndType/setEndType : int 

int getEndType() / setEndType(value)
Specifies an arrowhead for the end of a line. The value of the property is MsoArrowheadStyle integer constant.

getBeginArrowLength/setBeginArrowLength : int 

int getBeginArrowLength() / setBeginArrowLength(value)
Specifies the length of the arrowhead for the begin of a line. The value of the property is MsoArrowheadLength integer constant.

getEndArrowLength/setEndArrowLength : int 

int getEndArrowLength() / setEndArrowLength(value)
Specifies the length of the arrowhead for the end of a line. The value of the property is MsoArrowheadLength integer constant.

getBeginArrowWidth/setBeginArrowWidth : int 

int getBeginArrowWidth() / setBeginArrowWidth(value)
Specifies the width of the arrowhead for the begin of a line. The value of the property is MsoArrowheadWidth integer constant.

getEndArrowWidth/setEndArrowWidth : int 

int getEndArrowWidth() / setEndArrowWidth(value)
Specifies the width of the arrowhead for the end of a line. The value of the property is MsoArrowheadWidth integer constant.

getThemeColor/setThemeColor : ThemeColor 

ThemeColor getThemeColor() / setThemeColor(value)
Gets and sets the theme color. If the forground color is not a theme color, NULL will be returned.

getColor/setColor : Color 

Color getColor() / setColor(value)
Represents the com.aspose.cells.Color of the line.

getTransparency/setTransparency : float 

float getTransparency() / setTransparency(value)
Returns or sets the degree of transparency of the line as a value from 0.0 (opaque) through 1.0 (clear).

getStyle/setStyle : int 

int getStyle() / setStyle(value)
Represents the style of the line. The value of the property is LineType integer constant.

getWeight/setWeight : int 

int getWeight() / setWeight(value)
Gets or sets the WeightType of the line. The value of the property is WeightType integer constant.

getWeightPt/setWeightPt : float 

float getWeightPt() / setWeightPt(value)
Gets or sets the weight of the line in unit of points.

getWeightPx/setWeightPx : float 

float getWeightPx() / setWeightPx(value)
Gets or sets the weight of the line in uni of pixels.

getFormattingType/setFormattingType : int 

int getFormattingType() / setFormattingType(value)
Gets or sets format type. The value of the property is ChartLineFormattingType integer constant.

isAutomaticColor : boolean 

boolean isAutomaticColor()
Indicates whether the color of line is auotmatic assigned.

isVisible/setVisible : boolean 

boolean isVisible() / setVisible(value)
Represents whether the line is visible.

isAuto/setAuto : boolean 

boolean isAuto() / setAuto(value)
Indicates whether this line style is auto assigned.

getGradientFill : GradientFill 

GradientFill getGradientFill()
Represents gradient fill.

Method Detail

isInterceptAuto

boolean isInterceptAuto()
Indicates whether Microsoft Workbook automatically determines the intercept of the trendline.

setInterceptAuto

 setInterceptAuto(isInterceptAuto)
Sets whether Microsoft Workbook automatically determines the intercept of the trendline.

See Also:
          Aspose.Cells Documentation - the home page for the Aspose.Cellss Product Documentation.
          Aspose.Cells Support Forum - our preferred method of support.