source: node_modules/d3-shape/src/order/appearance.js@ ba17441

Last change on this file since ba17441 was e4c61dd, checked in by istevanoska <ilinastevanoska@…>, 6 months ago

Prototype 1.1

  • Property mode set to 100644
File size: 339 bytes
Line 
1import none from "./none.js";
2
3export default function(series) {
4 var peaks = series.map(peak);
5 return none(series).sort(function(a, b) { return peaks[a] - peaks[b]; });
6}
7
8function peak(series) {
9 var i = -1, j = 0, n = series.length, vi, vj = -Infinity;
10 while (++i < n) if ((vi = +series[i][1]) > vj) vj = vi, j = i;
11 return j;
12}
Note: See TracBrowser for help on using the repository browser.