With any of the chart types other than PieChart, you can add a TrendLine to your chart's seriesList option by setting the isTrendLine attribute to true. Attributes that you can use for a TrendLine series include the following.
- isTrendLine: Set this value to true to indicate that the series item is a trendline rather than a regular data item.
- fitType: Select from any of 11 values that indicate the type of trendline to draw.
- polynom (default)
- exponent
- logarithmic
- power
- fourier
- minX
- minY
- maxX
- maxY
- averageX
- averageY
- order: Set this value to an integer value greater than 1 to indicate the number of terms to use in a polynom equation.
- Applies only when the fitType is polynom or fourier.
- When the fitType is power, exponent or logarithmic, its value is fixed to 2 no matter what it is set to.
- For any other fitType, order is not used.
- sampleCount: Set this value to the number of data items to consider in function calculation. It only applies when the fitType is polynom, power, exponent, logarithmic or fourier.
Other attributes that you use in any series are also used for a TrendLine.
- data: Bind x and y data, (or just y data, in the case of a bar chart) to display as the TrendLine.
- label: Set the text to display for the TrendLine's legend entry. (Not necessary if you set legendEntry to false.)
- legendEntry: Set this to true to add the TrendLine to the chart's legend. If true, it displays the label next to the color used for the line.
In the samples folder included in your Wijmo installation, check out the samples in the WidgetExplorer. There is a TrendLine sample for each supported chart type.
See Also