MCPcopy
hub / github.com/chartjs/Chart.js / getGradient

Function getGradient

test/fixtures/controller.line/segments/gradient.js:1–10  ·  view source on GitHub ↗
(context)

Source from the content-addressed store, hash-verified

1const getGradient = (context) => {
2 const {chart, p0, p1} = context;
3 const ctx = chart.ctx;
4 const {x: x0} = p0.getProps(['x'], true);
5 const {x: x1} = p1.getProps(['x'], true);
6 const gradient = ctx.createLinearGradient(x0, 0, x1, 0);
7 gradient.addColorStop(0, p0.options.backgroundColor);
8 gradient.addColorStop(1, p1.options.backgroundColor);
9 return gradient;
10};
11
12module.exports = {
13 config: {

Callers

nothing calls this directly

Calls 1

getPropsMethod · 0.80

Tested by

no test coverage detected