MovingAverageLineStyle
MovingAverageLineStyle ( seriesIndex ; numOfIntervals ; calculationMethod ; shape ; stroke ; color ; colorVariant )
Argument | Type | Range | Default | Note |
---|---|---|---|---|
seriesIndex | int | 0..10000 | all | |
numOfIntervals | int | 1..10000 | 2 | |
calculationMethod | int | 0..3 | average | |
shape | int | 0..5 | poly | |
stroke | num[] | 0..1000 | 1 | Dimension:[pt] |
color | rgba | 0..255 | black | |
colorVariant | int | -1..128 | solid |
Examples
MovingAverageLineStyle(1;50;average;poly;2;red)
MovingAverageLineStyle(all;10;;smooth;;blue)
Description
The MovingAverageLineStyle() function can be used to control the appearance of the moving average lines. The 4th argument shape controls the shape of the curve — smooth, polygonal or step-like; details can be found in Line Shapes. The stroke and color of the average lines can be varied using the arguments stroke, color and colorVariant. Unless otherwise defined, average lines are black, one-pixel wide lines.
| MOVING_AVERAGE_LINE_STYLE_01 |
1 | OpenDrawing(250;150) |
2 | ChartData(7 15 20 23 24 22) |
3 | |
4 | MovingAverage(1;3) |
5 | MovingAverageLineStyle(1;3;;smooth;1.0;#c002a0) |
6 | /* Set up styles. */ |
7 | SymbolStyle(1;bullet;4;1;#4682b4) |
8 | /* Set up axes. */ |
9 | |
10 | AxisMajorTicks(all;0) |
11 | AxisMajorTickLabelOptions(x;;;5) |
12 | AxisMajorTickLabelOptions(y;;-5) |
13 | /* Set up grid. */ |
14 | MajorGridLineWidths(x;y;0) |
15 | MajorGridLineWidths(y;x;0.25) |
16 |
Currently, three methods are available to calculate moving averages. Details can be found at the MovingAverageOptions() function. By calling the MovingAverage() function repeatedly, several moving averages can be represented at the same time for both different data series and for a different number of intervals.
| MOVING_AVERAGE_LINE_STYLE_02 |
1 | OpenDrawing(250;150) |
2 | ChartData(57 108 70 125 116 13 63 67 45 121 181 189 201 166 115 105 91 75 99 72 33 29 69 85 162 210 211 256 304 258 274 270 263; |
3 | 233 229 269 285 362 410 411 456 504 458 474 470 463 257 308 270 325 316 213 263 267 245 321 381 389 401 366 315 305 291 275 299 272) |
4 | |
5 | MovingAverage(1;10;average) |
6 | MovingAverage(2;5;average) |
7 | MovingAverageLineStyle(1;10;average;poly;1;#4682b4) |
8 | MovingAverageLineStyle(2;5;average;poly;1;#c002a0) |
9 | /* Set up styles. */ |
10 | SymbolStyle(1;bullet;3;1;#4682b4) |
11 | SymbolStyle(2;bullet;3;1;#c002a0) |
12 | /* Set up axes. */ |
13 | AxisOptions(x;none) /* Hide x-axis. */ |
14 | |
15 | AxisMajorTicks(all;0) |
16 | /* Set up grid. */ |
17 | MajorGridLineWidths(x;y;0.25) |
18 | MajorGridLineWidths(y;x;0) |
19 |
| MOVING_AVERAGE_LINE_STYLE_03 |
1 | OpenDrawing(250;150) |
2 | ChartData(57 108 70 125 116 13 63 67 45 121 181 189 201 166 115 105 91 75 99 72 33 29 69 85 162 210 211 256 304 258 274 270 263 233 229 269 285 362 410 411 456 504 458 474 470 463 257 308 270 325 316 213 263 267 245 321 381 389 401 366 315 305 291 275 299 272) |
3 | |
4 | MovingAverage(1;10;average) |
5 | MovingAverage(1;25;average) |
6 | MovingAverageLineStyle(1;10;average;poly;1 2 2;#063e9e) |
7 | MovingAverageLineStyle(1;25;average;poly;2;#00a79d) |
8 | /* Set up styles. */ |
9 | |
10 | /* Set up axes. */ |
11 | AxisOptions(x;none) /* Hide x-axis. */ |
12 | |
13 | AxisMajorTicks(all;0) |
14 | /* Set up grid. */ |
15 | MajorGridLineWidths(x;y;0.25) |
16 | MajorGridLineWidths(y;x;0) |
17 |