| 2 | |
| 3 | class Custom extends BubbleController { |
| 4 | draw() { |
| 5 | // Call bubble controller method to draw all the points |
| 6 | super.draw(arguments); |
| 7 | |
| 8 | // Now we can do some custom drawing for this dataset. |
| 9 | // Here we'll draw a box around the first point in each dataset, |
| 10 | // using `boxStrokeStyle` dataset option for color |
| 11 | var meta = this.getMeta(); |
| 12 | var pt0 = meta.data[0]; |
| 13 | |
| 14 | const {x, y} = pt0.getProps(['x', 'y']); |
| 15 | const {radius} = pt0.options; |
| 16 | |
| 17 | var ctx = this.chart.ctx; |
| 18 | ctx.save(); |
| 19 | ctx.strokeStyle = this.options.boxStrokeStyle; |
| 20 | ctx.lineWidth = 1; |
| 21 | ctx.strokeRect(x - radius, y - radius, 2 * radius, 2 * radius); |
| 22 | ctx.restore(); |
| 23 | } |
| 24 | } |
| 25 | Custom.id = 'derivedBubble'; |
| 26 | Custom.defaults = { |