Questions? Email us:
sales@haneng.com

 

Automatic average and trendlines for line charts


HanengCharts has a built in function to show averages and trendlines in the multiline and scatter chart types. Below you can see a chart with 12 random values (refresh this page to see the chart with 12 other values) and the coresponding average and trendline.


The code to create the average line is:
<PARAM NAME="TargetLine_1" VALUE="AVG(a):00ff00:Average">
The first thing to notice is the name of the parameter: TargetLine_1. The Target Lines you want to add to the chart needs to have the name TargetLine_1, TargetLine_2, TargetLine_3 and so on. Now lets look at the value of the parameter: AVG(a):00ff00:Average. If you look closely you can see that there is 3 values separated by the : char. The first value, AVG(a), shows that you want the average of all the values in data set a, the second value, 00ff00, is the color we want the line to have (in standard html code) and the last value, Average, is an optional label for the Target Line.

The code to create the trendline is:
<PARAM NAME="TargetLine_2" VALUE="TREND(a):ff0000:Trendline">
The first thing to notice is the name of the parameter: TargetLine_2. The Target Lines you want to add to the chart needs to have the name TargetLine_1, TargetLine_2, TargetLine_3 and so on. Now lets look at the value of the parameter: TREND(a):ff0000:Trendline. If you look closely you can see that there is 3 values separated by the : char. The first value, TREND(a), shows that you want the trend of all the values in data set a, the second value, ff0000, is the color we want the line to have (in standard html code) and the last value, Trendline, is an optional label for the Target Line.
Back >>