()
| 15 | */ |
| 16 | export const BubbleMixin = Base => class extends ColorMixin(Base) { |
| 17 | constructor () { |
| 18 | super(); |
| 19 | |
| 20 | this._maxBubbleRelativeSize = 0.3; |
| 21 | this._minRadiusWithLabel = 10; |
| 22 | this._sortBubbleSize = false; |
| 23 | this._elasticRadius = false; |
| 24 | this._excludeElasticZero = true; |
| 25 | |
| 26 | // These cane be used by derived classes as well, so member status |
| 27 | this.BUBBLE_NODE_CLASS = 'node'; |
| 28 | this.BUBBLE_CLASS = 'bubble'; |
| 29 | this.MIN_RADIUS = 10; |
| 30 | |
| 31 | this.renderLabel(true); |
| 32 | |
| 33 | this.data(group => { |
| 34 | const data = group.all(); |
| 35 | |
| 36 | if (this._keyboardAccessible) { |
| 37 | // sort based on the x value (key) |
| 38 | data.sort((a, b) => ascending(this.keyAccessor()(a), this.keyAccessor()(b))); |
| 39 | } |
| 40 | |
| 41 | if (this._sortBubbleSize) { |
| 42 | // sort descending so smaller bubbles are on top |
| 43 | const radiusAccessor = this.radiusValueAccessor(); |
| 44 | data.sort((a, b) => descending(radiusAccessor(a), radiusAccessor(b))); |
| 45 | } |
| 46 | return data; |
| 47 | }); |
| 48 | |
| 49 | this._r = scaleLinear().domain([0, 100]); |
| 50 | } |
| 51 | |
| 52 | _rValueAccessor (d) { |
| 53 | return d.r; |
nothing calls this directly
no test coverage detected