prepareBoxplotData.d.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. /**
  2. * See:
  3. * <https://en.wikipedia.org/wiki/Box_plot#cite_note-frigge_hoaglin_iglewicz-2>
  4. * <http://stat.ethz.ch/R-manual/R-devel/library/grDevices/html/boxplot.stats.html>
  5. *
  6. * Helper method for preparing data.
  7. *
  8. * @param {Array.<number>} rawData like
  9. * [
  10. * [12,232,443], (raw data set for the first box)
  11. * [3843,5545,1232], (raw data set for the second box)
  12. * ...
  13. * ]
  14. * @param {Object} [opt]
  15. *
  16. * @param {(number|string)} [opt.boundIQR=1.5] Data less than min bound is outlier.
  17. * default 1.5, means Q1 - 1.5 * (Q3 - Q1).
  18. * If 'none'/0 passed, min bound will not be used.
  19. * @param {(number|string)} [opt.layout='horizontal']
  20. * Box plot layout, can be 'horizontal' or 'vertical'
  21. * @return {Object} {
  22. * boxData: Array.<Array.<number>>
  23. * outliers: Array.<Array.<number>>
  24. * axisData: Array.<string>
  25. * }
  26. */
  27. export default function (rawData: number[][], opt: {
  28. boundIQR?: number | 'none';
  29. layout?: 'horizontal' | 'vertical';
  30. }): {
  31. boxData: number[][];
  32. outliers: number[][];
  33. axisData: string[];
  34. };