| 2 | import {valueOrDefault} from '../helpers/helpers.core.js'; |
| 3 | |
| 4 | export default class BubbleController extends DatasetController { |
| 5 | |
| 6 | static id = 'bubble'; |
| 7 | |
| 8 | /** |
| 9 | * @type {any} |
| 10 | */ |
| 11 | static defaults = { |
| 12 | datasetElementType: false, |
| 13 | dataElementType: 'point', |
| 14 | |
| 15 | animations: { |
| 16 | numbers: { |
| 17 | type: 'number', |
| 18 | properties: ['x', 'y', 'borderWidth', 'radius'] |
| 19 | } |
| 20 | } |
| 21 | }; |
| 22 | |
| 23 | /** |
| 24 | * @type {any} |
| 25 | */ |
| 26 | static overrides = { |
| 27 | scales: { |
| 28 | x: { |
| 29 | type: 'linear' |
| 30 | }, |
| 31 | y: { |
| 32 | type: 'linear' |
| 33 | } |
| 34 | } |
| 35 | }; |
| 36 | |
| 37 | initialize() { |
| 38 | this.enableOptionSharing = true; |
| 39 | super.initialize(); |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Parse array of primitive values |
| 44 | * @protected |
| 45 | */ |
| 46 | parsePrimitiveData(meta, data, start, count) { |
| 47 | const parsed = super.parsePrimitiveData(meta, data, start, count); |
| 48 | for (let i = 0; i < parsed.length; i++) { |
| 49 | parsed[i]._custom = this.resolveDataElementOptions(i + start).radius; |
| 50 | } |
| 51 | return parsed; |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * Parse array of arrays |
| 56 | * @protected |
| 57 | */ |
| 58 | parseArrayData(meta, data, start, count) { |
| 59 | const parsed = super.parseArrayData(meta, data, start, count); |
| 60 | for (let i = 0; i < parsed.length; i++) { |
| 61 | const item = data[start + i]; |
nothing calls this directly
no outgoing calls
no test coverage detected