]> git.ipfire.org Git - thirdparty/Chart.js.git/commit
Add support to fill between datasets (#4008)
authorSimon Brunel <simonbrunel@users.noreply.github.com>
Sat, 18 Mar 2017 10:08:57 +0000 (11:08 +0100)
committerGitHub <noreply@github.com>
Sat, 18 Mar 2017 10:08:57 +0000 (11:08 +0100)
commit4b421a50bfa17f73ac7aa8db7d077e674dbc148d
tree4cb978f4411eece67919ea05d080e74f56c801de
parent1ca0ffb5d5b6c2072176fd36fa85a58c483aa434
Add support to fill between datasets (#4008)

The `fill` option now accepts the index of the target dataset (number) or a string starting by "+" or "-" followed by a number representing the dataset index relative to the current one (e.g. `fill: "-2"` on dataset at index 3 will fill to dataset at index 1). It's also possible to "propagate" the filling to the target of an hidden dataset (`options.plugins.filler.propagate`). Fill boundaries `zero`, `top` and `bottom` have been deprecated and replaced by `origin`, `start` and `end`.

Implementation has been moved out of the line element into a new plugin (`src/plugins/plugin.filler.js`) and does not rely anymore on the deprecated model `scaleTop`, `scaleBottom` and `scaleZero` values. Drawing Bézier splines has been refactored in the canvas helpers (note that `Chart.helpers.canvas` is now an alias of `Chart.canvasHelpers`).

Add 3 new examples and extend utils with a pseudo-random number generator that can be initialized with `srand`. That makes possible to design examples starting always with the same initial data.
49 files changed:
samples/area/analyser.js [new file with mode: 0644]
samples/area/line-boundaries.html [new file with mode: 0644]
samples/area/line-datasets.html [new file with mode: 0644]
samples/area/radar.html [new file with mode: 0644]
samples/style.css [new file with mode: 0644]
samples/utils.js
src/chart.js
src/controllers/controller.line.js
src/controllers/controller.radar.js
src/core/core.canvasHelpers.js
src/elements/element.line.js
src/plugins/plugin.filler.js [new file with mode: 0644]
test/fixtures/plugin.filler/fill-line-boundary-end-span.json [moved from test/fixtures/element.line/fill-line-top-span.json with 97% similarity]
test/fixtures/plugin.filler/fill-line-boundary-end-span.png [moved from test/fixtures/element.line/fill-line-top-span.png with 100% similarity]
test/fixtures/plugin.filler/fill-line-boundary-end.json [moved from test/fixtures/element.line/fill-line-top.json with 97% similarity]
test/fixtures/plugin.filler/fill-line-boundary-end.png [moved from test/fixtures/element.line/fill-line-top.png with 100% similarity]
test/fixtures/plugin.filler/fill-line-boundary-origin-span.json [moved from test/fixtures/element.line/fill-line-zero-span.json with 97% similarity]
test/fixtures/plugin.filler/fill-line-boundary-origin-span.png [moved from test/fixtures/element.line/fill-line-zero-span.png with 100% similarity]
test/fixtures/plugin.filler/fill-line-boundary-origin-spline-span.json [moved from test/fixtures/element.line/fill-line-spline-span.json with 97% similarity]
test/fixtures/plugin.filler/fill-line-boundary-origin-spline-span.png [moved from test/fixtures/element.line/fill-line-spline-span.png with 100% similarity]
test/fixtures/plugin.filler/fill-line-boundary-origin-spline.json [moved from test/fixtures/element.line/fill-line-spline.json with 97% similarity]
test/fixtures/plugin.filler/fill-line-boundary-origin-spline.png [moved from test/fixtures/element.line/fill-line-spline.png with 100% similarity]
test/fixtures/plugin.filler/fill-line-boundary-origin-stepped-span.json [moved from test/fixtures/element.line/fill-line-stepped-span.json with 97% similarity]
test/fixtures/plugin.filler/fill-line-boundary-origin-stepped-span.png [moved from test/fixtures/element.line/fill-line-stepped-span.png with 100% similarity]
test/fixtures/plugin.filler/fill-line-boundary-origin-stepped.json [moved from test/fixtures/element.line/fill-line-stepped.json with 97% similarity]
test/fixtures/plugin.filler/fill-line-boundary-origin-stepped.png [moved from test/fixtures/element.line/fill-line-stepped.png with 100% similarity]
test/fixtures/plugin.filler/fill-line-boundary-origin.json [moved from test/fixtures/element.line/fill-line-zero.json with 97% similarity]
test/fixtures/plugin.filler/fill-line-boundary-origin.png [moved from test/fixtures/element.line/fill-line-zero.png with 100% similarity]
test/fixtures/plugin.filler/fill-line-boundary-start-span.json [moved from test/fixtures/element.line/fill-line-bottom-span.json with 97% similarity]
test/fixtures/plugin.filler/fill-line-boundary-start-span.png [moved from test/fixtures/element.line/fill-line-bottom-span.png with 100% similarity]
test/fixtures/plugin.filler/fill-line-boundary-start.json [moved from test/fixtures/element.line/fill-line-bottom.json with 97% similarity]
test/fixtures/plugin.filler/fill-line-boundary-start.png [moved from test/fixtures/element.line/fill-line-bottom.png with 100% similarity]
test/fixtures/plugin.filler/fill-line-dataset-span.json [new file with mode: 0644]
test/fixtures/plugin.filler/fill-line-dataset-span.png [new file with mode: 0644]
test/fixtures/plugin.filler/fill-line-dataset-spline-span.json [new file with mode: 0644]
test/fixtures/plugin.filler/fill-line-dataset-spline-span.png [new file with mode: 0644]
test/fixtures/plugin.filler/fill-line-dataset-spline.json [new file with mode: 0644]
test/fixtures/plugin.filler/fill-line-dataset-spline.png [new file with mode: 0644]
test/fixtures/plugin.filler/fill-line-dataset.json [new file with mode: 0644]
test/fixtures/plugin.filler/fill-line-dataset.png [new file with mode: 0644]
test/fixtures/plugin.filler/fill-radar-boundary-origin-spline.json [moved from test/fixtures/element.line/fill-radar-spline.json with 97% similarity]
test/fixtures/plugin.filler/fill-radar-boundary-origin-spline.png [moved from test/fixtures/element.line/fill-radar-spline.png with 100% similarity]
test/fixtures/plugin.filler/fill-radar-boundary-origin.json [moved from test/fixtures/element.line/fill-radar-zero.json with 97% similarity]
test/fixtures/plugin.filler/fill-radar-boundary-origin.png [moved from test/fixtures/element.line/fill-radar-zero.png with 100% similarity]
test/specs/controller.line.tests.js
test/specs/controller.radar.tests.js
test/specs/element.line.tests.js
test/specs/global.deprecations.tests.js
test/specs/plugin.filler.tests.js [new file with mode: 0644]