| RMC_CalcAverage function. | ||
| Calculates the average of a series | ||
| Syntax | ||
| nResult (LONG) = RMC_CalcAverage( ByVal nCtrlId (LONG), ByVal nRegion (LONG), ByVal nSeriesIndex (LONG), ByRef nAverage (DOUBLE), ByRef nXStart (LONG), ByRef nYStart (LONG), ByRef nXEnd (LONG), ByRef nYend (LONG), ByRef sHighLowIndex (ASCIIZ) ) | ||
| Parameter | ||
| nCtrlId (LONG) | ||
| Unique ID of the chart control, to which the series belongs. | ||
| nRegion (LONG) | ||
| Index of the region, to which the series belongs. | ||
| nSeriesIndex (LONG) | ||
| Index of the series, whose average shall be calculated. | ||
| nAverage (DOUBLE) | ||
| After succesfull function call: holds the average value. | ||
| nXStart (LONG) | ||
| After succesfull function call: holds the first X-position, which would be needed to draw a line within the grid boundary at the average position. | ||
| nYStart (LONG) | ||
| After succesfull function call: holds the first Y-position, which would be needed to draw a line within the grid boundary at the average position. | ||
| nXEnd (LONG) | ||
| After succesfull function call: holds the second X-position, which would be needed to draw a line within the grid boundary at the average position. | ||
| nYEnd (LONG) | ||
| After succesfull function call: holds the second Y-position, which would be needed to draw a line within the grid boundary at the average position. | ||
| sHighLowIndex (ASCIIZ) | ||
| Defines in case of a HighLow series, which values should be calculated: Open, High, Low or Close (=default). | ||
| Return value | ||
| 0 | ||
| No error, function succeeded. | ||
| RMC_ERROR_CTRLID | ||
| Wrong control ID (0 or no chart with this control ID was found). | ||
| RMC_ERROR_WRONGREGION | ||
| The region index is inexistent in the chart control. | ||
| RMC_ERROR_SERIESINDEX | ||
| The series index is not valid (No series with this index exists in this region). | ||
| RMC_ERROR_WRONGSERIESTYPE | ||
| The series is not grid based (either Pie/Donut/Pyramid or XY). | ||
| Example | ||
Check also "Single bars" in the demo projects for an example how to use this function.
' Add a bar series nError = RMC_AddBarSeries(%ID_RMC,1,aData(0),10) 'Add a grid, the axes and all other stuff... . . . ' Calc the average and get the needed X/Y positions (nL,nT,nR,nB) for the line nError = RMC_CalcAverage(%ID_RMC1,1,1,nAverage,nL,nT,nR,nB) ' Add a CustomLine to show the average: nError = RMC_CODash(%ID_RMC1,1,nL,nT,nR,nB,%RMC_LINE_FLAT,%ColorGreen,0,2) | ||