TrendLayer objects are created by using XYChart.addTrendLayer and XYChart.addTrendLayer2.
The trend layer performs linear regression analysis on the data points, and represents the result as a best fit straight line with optional confidence and prediction bands.
In linear regression analysis, the data points are assumed to be related by:
y = m * x + c + err
where m and c are constants, and err is a random variable.
Linear regression analysis estimates m, c and err based on available data using the least square method. Using estimated values of m and c, the line y = m * x + c are plotted as the best fit straight line based on available data.
However, as m and c are estimations based on available data, it may not be exactly equal to the "real" m and c. In ChartDirector, the uncertainties are represented visually as a confidence band around the regression line. For example, the 95% confidence band means there are 95% probability that the "real" line is in that band.
To predict a data point (infer y given x), we can use the formula:
y = m * x + c + err
based on estimated values of m, c and err.
The uncertainties of the data point is contributed by the uncertainties in m and c, as well as err. In ChartDirector, the uncertainties of the data points are represented visually as a prediction band around the regression line. For example, a 95% prediction band means there are 95% probability that a data point will be in that band.
The prediction band is always wider than the confidence band. It is because the uncertainties of the regression line is contributed by m and c, while the uncertainties of the data points are contributed by m, c and err. The err term makes the data points less certain that the regression line.
Method | Inherited | Description |
---|---|---|
addConfidenceBand | (Self) | Adds a confidence band to the trend layer. |
addPredictionBand | (Self) | Adds a prediction band to the trend layer. |
getSlope | (Self) | Gets the slope of the trend line. |
getIntercept | (Self) | Gets the y-axis intercept of the trend line. |
getCorrelation | (Self) | Gets the correlation coefficient of the trend line. |
getStdError | (Self) | Gets the standard error of the trend line. |
setImageMapWidth | (Self) | Sets the effective width of the line used for producing image maps. |
getLine | (Self) | Retrieves an opaque LineObj representing the trend line. The opaque LineObj is to be used in XYChart.addInterLineLayer for adding coloring between lines. |
set3D | Layer | Sets the 3D depth of the layer, and the 3D gap between the current layer and the next layer. |
setLineWidth | Layer | Sets the default line width of lines when drawing data sets on the layer. |
setBorderColor | Layer | Sets the default border color and 3D raised effect when drawing data sets on the layer. |
setLegendOrder | Layer | Sets the order of the data set names as appeared in the legend box. |
setLegend | Layer | Sets the order of the data set names as appeared in the legend box. |
setDataCombineMethod | Layer | Sets the method used to combine multiple data sets in a layer. |
addDataSet | Layer | Adds a data set to the chart layer. |
getDataSet | Layer | Gets the requested DataSet object. |
addDataGroup | Layer | Open a new data group. |
addExtraField | Layer | Adds an array of text to be used as an extra field in various places. |
addExtraField2 | Layer | Adds an array of numbers/dates to be used as an extra field in various places. |
setUseYAxis | Layer | Determine the y-axis to use when drawing the data sets. |
setUseYAxis2 | Layer | Determine if the primary or secondary y-axis should be used when drawing the data sets. |
setXData | Layer | Sets the x values of the data points in the data sets. |
setXData2 | Layer | Sets the x values of the data points in the data sets as evenly distributed in a range. |
alignLayer | Layer | Aligns the layer with a data set of another bar chart layer in Side layout. |
getXCoor | Layer | Gets the x pixel coordinate of a point given the x data value. |
getYCoor | Layer | Gets the y pixel coordinate of a point given the y data value. |
xZoneColor | Layer | Creates a x-zone color. A x-zone will change from one color to another depending on a threshold value on the x-axis. |
yZoneColor | Layer | Creates a y-zone color. A y-zone will change from one color to another depending on a threshold value on the y-axis. |
setDataLabelStyle | Layer | Enables data labels and sets their styles. |
setDataLabelFormat | Layer | Sets the data label format. |
addCustomDataLabel | Layer | Adds a custom data label to a data point. |
setAggregateLabelStyle | Layer | Enables aggregate labels and sets their styles. |
setAggregateLabelFormat | Layer | Sets the aggregate label format. |
addCustomAggregateLabel | Layer | Adds a custom aggregate label to an aggregated object. |
addCustomGroupLabel | Layer | Adds a custom data group label to object representing the group. |
getImageCoor | Layer | Gets the image map coordinates of a data point as represented in the layer as HTML image map attributes. |
getImageCoor2 | Layer | Gets the image map coordinates of a region containing all data points at the given x-position as HTML image map attributes. |
getHTMLImageMap | Layer | Generates an HTML image map for all data points as represented on the layer. |
setHTMLImageMap | Layer | Override the default arguments used when generating HTML image map for the layer. |