mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-11 18:51:31 +00:00
The official image from streamline does not currently work for the arm64 platform. As a temporary measure, the source code and docker build scripts have been lifted from the official images and are used to build locally. Some additional modifications are made to reduce overall image size, these are documented in docker/README.md
33 lines
901 B
JavaScript
Executable File
33 lines
901 B
JavaScript
Executable File
/**
|
|
* It can sometimes be useful to get the average of data in an API result set,
|
|
* be it from a column, or a collection of cells. This method provides exactly
|
|
* that ability.
|
|
*
|
|
* @name average()
|
|
* @summary Average the values in a data set.
|
|
* @author [Allan Jardine](http://sprymedia.co.uk)
|
|
* @requires DataTables 1.10+
|
|
*
|
|
* @returns {Number} Calculated average
|
|
*
|
|
* @example
|
|
* // Average a column
|
|
* var table = $('#example').DataTable();
|
|
* table.column( 3 ).data().average();
|
|
*
|
|
* @example
|
|
* // Average two cells
|
|
* var table = $('#example').DataTable();
|
|
* table.cells( 0, [3,4] ).data().average();
|
|
*/
|
|
|
|
jQuery.fn.dataTable.Api.register( 'average()', function () {
|
|
var data = this.flatten();
|
|
var sum = data.reduce( function ( a, b ) {
|
|
return (a*1) + (b*1); // cast values in-case they are strings
|
|
} );
|
|
|
|
return sum / data.length;
|
|
} );
|
|
|