I want to use HighCharts to create boxplots. As I can see in the docs I need to already provide Highcharts with the required five-point-summary, i.e., min, max, q1, q3, median values for creating the boxplot.
Given an arbitrary-length array constisting of numbers, how can I calculate these five numbers efficiently? Is there a quick means in JS to do so?
Although you have a solution for doing it server side, I took a few minutes to convert my PHP solution to a Javascript solution, to address the initial question.
step 1) function to calculate percentiles:
step 2) wrapper to grab min, max, and each of the required percentiles
step 3) build a chart with it
example:
[[edit]]
A quick update that contemplates outliers: