(d)
| 68 | } |
| 69 | |
| 70 | function setHighlight(d) { |
| 71 | if(!d.brush.filterSpecified) { |
| 72 | return '0,' + d.height; |
| 73 | } |
| 74 | |
| 75 | var pixelRanges = unitToPx(d.brush.filter.getConsolidated(), d.height); |
| 76 | var dashArray = [0]; // we start with a 0 length selection as filter ranges are inclusive, not exclusive |
| 77 | var p, sectionHeight, iNext; |
| 78 | var currentGap = pixelRanges.length ? pixelRanges[0][0] : null; |
| 79 | for(var i = 0; i < pixelRanges.length; i++) { |
| 80 | p = pixelRanges[i]; |
| 81 | sectionHeight = p[1] - p[0]; |
| 82 | dashArray.push(currentGap); |
| 83 | dashArray.push(sectionHeight); |
| 84 | iNext = i + 1; |
| 85 | if(iNext < pixelRanges.length) { |
| 86 | currentGap = pixelRanges[iNext][0] - p[1]; |
| 87 | } |
| 88 | } |
| 89 | dashArray.push(d.height); |
| 90 | // d.height is added at the end to ensure that (1) we have an even number of dasharray points, MDN page says |
| 91 | // "If an odd number of values is provided, then the list of values is repeated to yield an even number of values." |
| 92 | // and (2) it's _at least_ as long as the full height (even if range is minuscule and at the bottom) though this |
| 93 | // may not be necessary, maybe duplicating the last point would do too. But no harm in a longer dasharray than line. |
| 94 | return dashArray; |
| 95 | } |
| 96 | |
| 97 | function unitToPx(unitRanges, height) { |
| 98 | return unitRanges.map(function(pr) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…