MCPcopy Create free account
hub / github.com/chartjs/Chart.js / draw

Method draw

docs/scripts/derived-bubble.js:4–23  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2
3class 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}
25Custom.id = 'derivedBubble';
26Custom.defaults = {

Callers

nothing calls this directly

Calls 3

getMetaMethod · 0.80
getPropsMethod · 0.80
drawMethod · 0.65

Tested by

no test coverage detected