MCPcopy Create free account
hub / github.com/Rello/analytics / beforeDatasetsDraw

Function beforeDatasetsDraw

js/3rdParty/chartjs-plugin-annotation.min.js:20–38  ·  view source on GitHub ↗
(chart, args, options)

Source from the content-addressed store, hash-verified

18 id: 'annotation',
19
20 beforeDatasetsDraw(chart, args, options) {
21 const { ctx, chartArea, scales } = chart;
22 const annotations = options.annotations || {};
23
24 if (!chartArea) return;
25
26 ctx.save();
27
28 Object.keys(annotations).forEach(id => {
29 const annotation = annotations[id];
30 if (!annotation || annotation.display === false) return;
31
32 if (annotation.type === 'line') {
33 this.drawLine(ctx, chartArea, scales, annotation);
34 }
35 });
36
37 ctx.restore();
38 },
39
40 drawLine(ctx, chartArea, scales, annotation) {
41 const { left, right, top, bottom } = chartArea;

Callers

nothing calls this directly

Calls 1

saveMethod · 0.80

Tested by

no test coverage detected