Calculating the average of column
Calculating the average of column
jhjh
Posts: 10Questions: 5Answers: 0
Hello, I want to implement the average value in javascript using the values imported into DB(Row1, Row2). Among the values shown in the figure, I want to obtain rows, minimum, maximum, and average values of col1 to co2, which page should I refer to?
Answers
This example shows how to sum the column, it would be the same principle with a division in there too,
Colin
Colin, in the example that you point to, how do you know how many rows there are? In the original post, there are two rows. Is there a built-in function that gives us the number or rows or do you have to count them as you iterate over them?
@jackalbright There are a couple options.
footerCallback
docs state the thedata
parameter is the full array of table data. You can usedata.length
to get the full number of rows.count()
API you can get the number of rows in the data set if usingselector-modifier
to calculate over the page or filtered data. Something like this:Kevin