Stats collection module. Stats collection is described in detail in Stats article.

Methods

dateSelector (date:String, id:String):Void

Outputs date selector with selected date.

Parameters:

date

Selected date in the DD.MM.YYYY format. If null, will select current date.

id

Statistics page ID.

inline drawBarChart (options:_StatsChartOptions):Void

Outputs a horizontal bar chart to web page from SQL query results or a list of values.

Parameters:

options

Chart parameters object.

inline drawLineChart (options:_StatsChartOptions):Void

Outputs a line chart to web page from SQL query results or a list of values.

Parameters:

options

Chart parameters object.

inline drawPieChart (options:_StatsChartOptions):Void

Outputs a pie chart to web page from SQL query results or a list of values.

Parameters:

options

Chart parameters object.

getStats (key:String, ?date:String):Float

Returns the statistics value for that key.

Parameters:

key

Statistics key.

date

Statistics date. Will use "'yesterday'" by default. Note that the given string will not be quoted in the query.

Returns:

Statistics value.

getType (id:String):_StatsType

Returns stats type by its ID.

Parameters:

id

Stats type ID.

Returns:

Stats type.

inline registerDashboardChart (title:String, chart:_StatsChartOptions):Void

Registers a chart to display on dashboard.

Parameters:

title

Chart title.

chart

Chart options. Chart type needs to be set.

inline registerDashboardChartBasic (id:String, title:String):Void

Registers a basic single-line chart (date, value) to display on dashboard.

Parameters:

id

Chart ID. Will be checked for display with stats sub-permissions code.

title

Chart title.

inline registerDashboardFunc (id:String, title:String, func:Void ‑> Void):Void

Registers a function to display on dashboard.

Parameters:

id

Dashboard block ID. Needed for sub-permissions check.

title

Dashboard block title.

func

Function that draws the block.

inline registerType (t:_StatsType):Void

Registers stats type.

Parameters:

t

Stats type.