TrendLayer objects are created by using XYChart.addTrendLayer and XYChart.addTrendLayer2.
The trend layer performs regression analysis on the data points. It draws the optimal line or curve that fits the data points, with optional confidence and prediction bands.
In regression analysis, a function with some unknown coefficients is chosen first. The "method of least squares" is used to estimate the coefficients, so that the function optimally fits the data points.
In the most common case, the function chosen is a linear function with unknown slope and intercept (the unknown coefficients). Linear regression is used to determine the slope and intercept such that the line optimally fits the data points.
The regression types supported by ChartDirector are listed below. They can be chosen using TrendLayer.setRegressionType. The default regression type is linear regression.
|Linear||y = a0 + a1x|
|Constrained Linear||y = a1x|
|Polynomial||y = Σanxn|
|Exponential||y = ea0 + a1x|
|Logarithmic||y = a0 + a1log(x)|
The coefficients estimated by regression analysis are based on available data. They may be not equal to the "real" values, which are unknown. In ChartDirector, the uncertainties can be represented visually as a confidence band around the regression line. For example, a 95% confidence band means there is 95% probability that the real line is in that band. Confidence bands can be added to the chart using TrendLayer.addConfidenceBand.
Even if the regression line is 100% accurate, data point may still not lie exactly on the line due to noise in the data. The prediction band is the region that the data points are likely to be found. For example, a 95% prediction band means there is 95% probability that a data point will be in that band. Prediction bands can be added to the chart using TrendLayer.addPredictionBand.
A prediction band is normally wider than and is at least as wide as the confidence band of the same probability. It is because the uncertainties of the data points are due to both the uncertainties of the regression line and the noise.
|setRegressionType||(Self)||Sets the regression type to be used.|
|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. The method is only defined if the regression type is linear or constrained linear.|
|getIntercept||(Self)||Gets the y-axis intercept of the trend line. The method is only defined if the regression type is linear.|
|getCoefficient||(Self)||Gets the coefficients of the regression function.|
|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 lighting effect for the data representation.|
|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.|
|getLegendIcon||Layer||Gets the CDML representation of the legend icon for a data set.|
|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 a DataSet object based on the order in which it is being added to the chart.|
|getDataSetByZ||Layer||Gets a DataSet object based on the order in which it is being drawn.|
|getDataSetCount||Layer||Gets the number of data sets in the layer.|
|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.|
|setBaseLine||Layer||Sets the baseline for the data representation.|
|alignLayer||Layer||Aligns the layer with a data set of another bar chart layer in Side layout.|
|getXCoor||Layer||Gets the x pixel coordinate given the x data value.|
|getYCoor||Layer||Gets the y pixel coordinate given the y data value.|
|getNearestXValue||Layer||Gets the x data value that is nearest to the specified x pixel coordinate.|
|getXIndexOf||Layer||Gets the data point index at the specified x data value.|
|getXPosition||Layer||Gets the x positional value of a data point, as measured on the primary x-axis.|
|xZoneColor||Layer||Creates an x-zone color. An 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.|
|moveFront||Layer||Moves the layer in front of another layer.|
|moveBack||Layer||Moves the layer behind another layer.|
|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.|