Creates a trendline for AmSerialChart and AmXYChart charts which indicates the trend of your data or covers some different purposes. Multiple can be assigned.

Example

var chart = AmCharts.makeChart("chartdiv",{
	...
	"trendLines": [
		{
			"initialValue": 1,
			"initialXValue": 1,
			"finalValue": 11,
			"finalXValue": 12
		}
	]
});

Properties

PropertyTypeDefaultDescription
balloonTextStringWhen set, enables displaying a roll-over balloon.
dashLengthNumber0Dash length.
finalCategoryStringString, equal to category value to which trend line should be drawn. It should be used if chart doesn't parse dates.
finalDateDateDate to which trend line should be drawn. It can be date string (using the same date format as chart.dataDateFormat) or date object.
finalImageImageAllows to add an image to the end of a trend line.
finalValueNumberValue at which trend line should end.
finalXValueNumberUsed by XY chart only. X value at which trend line should end.
idStringUnique id of a Trend line. You don't need to set it, unless you want to.
initialCategoryStringString, equal to category value from which trend line should start. It should be used if chart doesn't parse dates.
initialDateDateDate from which trend line should start. It can be date string (using the same date format as chart.dataDateFormat) or date object.
initialImageImageAllows to add an image to the beginning of a trend line.
initialValueNumberValue from which trend line should start.
initialXValueNumberUsed by XY chart only. X value from which trend line should start.
isProtectedBooleanfalseUsed by Stock chart. If this property is set to true, this trend line won't be removed when clicked on eraser tool.
lineAlphaNumber1Line opacity.
lineColorColor#00CC00Line color.
lineThicknessNumber1Line thickness.
valueAxisValueAxisValueAxisValue axis of the trend line. Will use first value axis of the chart if not set any. You can use a reference to the value axis object or id of value axis.
valueAxisXValueAxisValueAxisUsed by XY chart only. X axis of trend line. Will use first X axis of the chart if not set any. You can use a reference to the value axis object or id of value axis.

Methods

TrendLine class does not have any methods.

Events

NameEvent objectDescription
click{type: "click", TrendLine, chart:AmRectangularChart}Dispatched when user clicks on a trend line.
rollOut{type: "rollOut", TrendLine, chart:AmRectangularChart}Dispatched when user rolls out of a trend line.
rollOver{type: "rollOver", TrendLine, chart:AmRectangularChart}Dispatched when user clicks rolls-over a trend line.