|
5090 | 5090 | var array$3 = Array.prototype; |
5091 | 5091 |
|
5092 | 5092 | var map$2 = array$3.map; |
5093 | | - var slice$5 = array$3.slice; |
| 5093 | + var slice$6 = array$3.slice; |
5094 | 5094 |
|
5095 | 5095 | var implicit = {name: "implicit"}; |
5096 | 5096 |
|
|
5099 | 5099 | domain = [], |
5100 | 5100 | unknown = implicit; |
5101 | 5101 |
|
5102 | | - range = range == null ? [] : slice$5.call(range); |
| 5102 | + range = range == null ? [] : slice$6.call(range); |
5103 | 5103 |
|
5104 | 5104 | function scale(d) { |
5105 | 5105 | var key = d + "", i = index.get(key); |
|
5119 | 5119 | }; |
5120 | 5120 |
|
5121 | 5121 | scale.range = function(_) { |
5122 | | - return arguments.length ? (range = slice$5.call(_), scale) : range.slice(); |
| 5122 | + return arguments.length ? (range = slice$6.call(_), scale) : range.slice(); |
5123 | 5123 | }; |
5124 | 5124 |
|
5125 | 5125 | scale.unknown = function(_) { |
|
5335 | 5335 | }; |
5336 | 5336 |
|
5337 | 5337 | scale.range = function(_) { |
5338 | | - return arguments.length ? (range = slice$5.call(_), rescale()) : range.slice(); |
| 5338 | + return arguments.length ? (range = slice$6.call(_), rescale()) : range.slice(); |
5339 | 5339 | }; |
5340 | 5340 |
|
5341 | 5341 | scale.rangeRound = function(_) { |
5342 | | - return range = slice$5.call(_), interpolate$$1 = interpolateRound, rescale(); |
| 5342 | + return range = slice$6.call(_), interpolate$$1 = interpolateRound, rescale(); |
5343 | 5343 | }; |
5344 | 5344 |
|
5345 | 5345 | scale.clamp = function(_) { |
|
7814 | 7814 | for (var i = 0; i < axisBrushes.length; i++) { |
7815 | 7815 | var brush$$1 = document.getElementById('brush-' + pos + '-' + i); |
7816 | 7816 |
|
7817 | | - if (brushSelection(brush$$1) !== null) { |
| 7817 | + if (brush$$1 && brushSelection(brush$$1) !== null) { |
7818 | 7818 | return true; |
7819 | 7819 | } |
7820 | 7820 | } |
|
7826 | 7826 | var extents = actives.map(function (p) { |
7827 | 7827 | var axisBrushes = brushes[p]; |
7828 | 7828 |
|
7829 | | - return axisBrushes.map(function (d, i) { |
| 7829 | + return axisBrushes.filter(function (d) { |
| 7830 | + return !pc.hideAxis().includes(d); |
| 7831 | + }).map(function (d, i) { |
7830 | 7832 | return brushSelection(document.getElementById('brush-' + Object.keys(config.dimensions).indexOf(p) + '-' + i)); |
7831 | 7833 | }).map(function (d, i) { |
7832 | 7834 | if (d === null || d === undefined) { |
|
8131 | 8133 | return function (extents) { |
8132 | 8134 | var brushes = state.brushes; |
8133 | 8135 |
|
| 8136 | + var hiddenAxes = pc.hideAxis(); |
8134 | 8137 |
|
8135 | 8138 | if (typeof extents === 'undefined') { |
8136 | | - return Object.keys(config.dimensions).reduce(function (acc, cur, pos) { |
| 8139 | + return Object.keys(config.dimensions).filter(function (d) { |
| 8140 | + return !hiddenAxes.includes(d); |
| 8141 | + }).reduce(function (acc, cur, pos) { |
8137 | 8142 | var axisBrushes = brushes[cur]; |
8138 | 8143 |
|
8139 | 8144 | if (axisBrushes === undefined || axisBrushes === null) { |
8140 | 8145 | acc[cur] = []; |
8141 | 8146 | } else { |
8142 | 8147 | acc[cur] = axisBrushes.reduce(function (d, p, i) { |
8143 | | - var range = brushSelection(document.getElementById('brush-' + pos + '-' + i)); |
8144 | | - if (range !== null) { |
8145 | | - d = d.push(range); |
8146 | | - } |
| 8148 | + var raw = brushSelection(document.getElementById('brush-' + pos + '-' + i)); |
8147 | 8149 |
|
| 8150 | + if (raw) { |
| 8151 | + var yScale = config.dimensions[cur].yscale; |
| 8152 | + var scaled = invertByScale(raw, yScale); |
| 8153 | + |
| 8154 | + d.push({ |
| 8155 | + extent: p.brush.extent(), |
| 8156 | + selection: { |
| 8157 | + raw: raw, |
| 8158 | + scaled: scaled |
| 8159 | + } |
| 8160 | + }); |
| 8161 | + } |
8148 | 8162 | return d; |
8149 | 8163 | }, []); |
8150 | 8164 | } |
|
8210 | 8224 | Object.keys(config.dimensions).forEach(function (d, pos) { |
8211 | 8225 | var axisBrush = brushes[d]; |
8212 | 8226 |
|
8213 | | - axisBrush.forEach(function (e, i) { |
8214 | | - var brush$$1 = document.getElementById('brush-' + pos + '-' + i); |
8215 | | - if (brushSelection(brush$$1) !== null) { |
8216 | | - pc.g().select('#brush-' + pos + '-' + i).call(e.brush.move, null); |
8217 | | - } |
8218 | | - }); |
| 8227 | + // hidden axes will be undefined |
| 8228 | + if (axisBrush) { |
| 8229 | + axisBrush.forEach(function (e, i) { |
| 8230 | + var brush$$1 = document.getElementById('brush-' + pos + '-' + i); |
| 8231 | + if (brush$$1 && brushSelection(brush$$1) !== null) { |
| 8232 | + pc.g().select('#brush-' + pos + '-' + i).call(e.brush.move, null); |
| 8233 | + } |
| 8234 | + }); |
| 8235 | + } |
8219 | 8236 | }); |
8220 | 8237 |
|
8221 | 8238 | pc.renderBrushed(); |
|
8225 | 8242 | var axisBrush = brushes[dimension]; |
8226 | 8243 | var pos = Object.keys(config.dimensions).indexOf(dimension); |
8227 | 8244 |
|
8228 | | - axisBrush.forEach(function (e, i) { |
8229 | | - var brush$$1 = document.getElementById('brush-' + pos + '-' + i); |
8230 | | - if (brushSelection(brush$$1) !== null) { |
8231 | | - pc.g().select('#brush-' + pos + '-' + i).call(e.brush.move, null); |
| 8245 | + if (axisBrush) { |
| 8246 | + axisBrush.forEach(function (e, i) { |
| 8247 | + var brush$$1 = document.getElementById('brush-' + pos + '-' + i); |
| 8248 | + if (brushSelection(brush$$1) !== null) { |
| 8249 | + pc.g().select('#brush-' + pos + '-' + i).call(e.brush.move, null); |
8232 | 8250 |
|
8233 | | - if (typeof e.event === 'function') { |
8234 | | - e.event(select('#brush-' + pos + '-' + i)); |
| 8251 | + if (typeof e.event === 'function') { |
| 8252 | + e.event(select('#brush-' + pos + '-' + i)); |
| 8253 | + } |
8235 | 8254 | } |
8236 | | - } |
8237 | | - }); |
| 8255 | + }); |
| 8256 | + } |
8238 | 8257 |
|
8239 | 8258 | pc.renderBrushed(); |
8240 | 8259 | } |
|
8258 | 8277 | pc.createAxes(); |
8259 | 8278 | } |
8260 | 8279 |
|
| 8280 | + var hiddenAxes = pc.hideAxis(); |
| 8281 | + |
8261 | 8282 | pc.g().append('svg:g').attr('id', function (d, i) { |
8262 | 8283 | return 'brush-group-' + i; |
8263 | 8284 | }).attr('class', 'brush-group').attr('dimension', function (d) { |
8264 | 8285 | return d; |
8265 | 8286 | }).each(function (d) { |
8266 | | - brushFor$1(state, config, pc, events, brushGroup)(d, select(this)); |
| 8287 | + if (!hiddenAxes.includes(d)) { |
| 8288 | + brushFor$1(state, config, pc, events, brushGroup)(d, select(this)); |
| 8289 | + } |
8267 | 8290 | }); |
8268 | 8291 |
|
8269 | 8292 | pc.brushExtents = brushExtents$1(state, config, pc, events, brushGroup); |
|
11198 | 11221 | }; |
11199 | 11222 | }; |
11200 | 11223 |
|
11201 | | - var brushReset$4 = function brushReset(config) { |
| 11224 | + var brushReset$4 = function brushReset(config, pc) { |
11202 | 11225 | return function (dimension) { |
11203 | 11226 | var brushesToKeep = []; |
11204 | 11227 | for (var j = 0; j < config.brushes.length; j++) { |
|
11472 | 11495 | }; |
11473 | 11496 | }; |
11474 | 11497 |
|
11475 | | - var version$1 = "2.2.8"; |
| 11498 | + var version$1 = "2.2.10"; |
11476 | 11499 |
|
11477 | 11500 | var DefaultConfig = { |
11478 | 11501 | data: [], |
|
11662 | 11685 | pc.render(); |
11663 | 11686 | } |
11664 | 11687 | }).on('hideAxis', function (d) { |
| 11688 | + pc.brushReset(); |
11665 | 11689 | pc.dimensions(pc.applyDimensionDefaults()); |
11666 | 11690 | pc.dimensions(without(config.dimensions, d.value)); |
| 11691 | + pc.render(); |
11667 | 11692 | }).on('flipAxes', function (d) { |
11668 | 11693 | if (d.value && d.value.length) { |
11669 | 11694 | d.value.forEach(function (dimension) { |
|
11793 | 11818 | pc.updateAxes = updateAxes(config, pc, position, axis, flags); |
11794 | 11819 | pc.applyAxisConfig = applyAxisConfig; |
11795 | 11820 | pc.brushable = brushable(config, pc, flags); |
11796 | | - pc.brushReset = brushReset$4(config); |
| 11821 | + pc.brushReset = brushReset$4(config, pc); |
11797 | 11822 | pc.selected = selected$4(config, pc); |
11798 | 11823 | pc.reorderable = reorderable(config, pc, xscale, position, dragging, flags); |
11799 | 11824 |
|
|
37777 | 37802 | * @param {number} [end=array.length] The end position. |
37778 | 37803 | * @returns {Array} Returns the slice of `array`. |
37779 | 37804 | */ |
37780 | | - function slice$7(array, start, end) { |
| 37805 | + function slice$8(array, start, end) { |
37781 | 37806 | var length = array == null ? 0 : array.length; |
37782 | 37807 | if (!length) { |
37783 | 37808 | return []; |
|
40608 | 40633 | initial, intersection: intersection$1, intersectionBy, intersectionWith, join, |
40609 | 40634 | last, lastIndexOf, nth, pull, pullAll, |
40610 | 40635 | pullAllBy, pullAllWith, pullAt, remove: remove$1, reverse: reverse$1, |
40611 | | - slice: slice$7, sortedIndex, sortedIndexBy, sortedIndexOf, sortedLastIndex, |
| 40636 | + slice: slice$8, sortedIndex, sortedIndexBy, sortedIndexOf, sortedLastIndex, |
40612 | 40637 | sortedLastIndexBy, sortedLastIndexOf, sortedUniq, sortedUniqBy, tail, |
40613 | 40638 | take, takeRight, takeRightWhile, takeWhile, union, |
40614 | 40639 | unionBy, unionWith, uniq, uniqBy, uniqWith, |
|
46819 | 46844 | }; |
46820 | 46845 | }; |
46821 | 46846 |
|
46822 | | - var version$2 = "1.0.0"; |
| 46847 | + var version$2 = "1.0.1"; |
46823 | 46848 |
|
46824 | 46849 | //css |
46825 | 46850 |
|
|
0 commit comments