Skip to content

Commit 102a311

Browse files
kurkleetimberg
authored andcommitted
Rewrite filler (#6795)
Filler plugin is rewritten and test coverage increased
1 parent 8bc250f commit 102a311

26 files changed

+1039
-495
lines changed

docs/general/performance.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ new Chart(ctx, {
8989

9090
### Automatic data decimation during draw
9191

92-
Line element will automatically decimate data, when the following conditions are met: `tension` is `0`, `steppedLine` is `false` (default), `fill` is `false` and `borderDash` is `[]` (default).`
92+
Line element will automatically decimate data, when the following conditions are met: `tension` is `0`, `steppedLine` is `false` (default) and `borderDash` is `[]` (default).`
9393
This improves rendering speed by skipping drawing of invisible line segments.
9494

9595
```javascript
@@ -109,6 +109,26 @@ new Chart(ctx, {
109109
});
110110
```
111111

112+
### Enable spanGaps
113+
114+
If you have a lot of data points, it can be more performant to enable `spanGaps`. This disables segmentation of the line, which can be an unneeded step.
115+
116+
To enable `spanGaps`:
117+
118+
```javascript
119+
new Chart(ctx, {
120+
type: 'line',
121+
data: {
122+
datasets: [{
123+
spanGaps: true // enable for a single dataset
124+
}]
125+
},
126+
options: {
127+
spanGaps: true // enable for all datasets
128+
}
129+
});
130+
```
131+
112132
### Disable Line Drawing
113133

114134
If you have a lot of data points, it can be more performant to disable rendering of the line for a dataset and only draw points. Doing this means that there is less to draw on the canvas which will improve render performance.

src/controllers/controller.line.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,8 @@ module.exports = DatasetController.extend({
7777

7878
// Update Line
7979
if (showLine && mode !== 'resize') {
80-
8180
const properties = {
82-
_children: points,
81+
points,
8382
options: me._resolveDatasetElementOptions()
8483
};
8584

src/controllers/controller.radar.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,11 @@ module.exports = DatasetController.extend({
9090
const meta = me._cachedMeta;
9191
const line = meta.dataset;
9292
const points = meta.data || [];
93-
93+
const labels = meta.iScale._getLabels();
9494
const properties = {
95-
_children: points,
95+
points,
9696
_loop: true,
97+
_fullLoop: labels.length === points.length,
9798
options: me._resolveDatasetElementOptions()
9899
};
99100

@@ -122,10 +123,11 @@ module.exports = DatasetController.extend({
122123
const y = reset ? scale.yCenter : pointPosition.y;
123124

124125
const properties = {
125-
x: x,
126-
y: y,
126+
x,
127+
y,
128+
angle: pointPosition.angle,
127129
skip: isNaN(x) || isNaN(y),
128-
options,
130+
options
129131
};
130132

131133
me._updateElement(point, index, properties, mode);

src/core/core.scale.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -876,12 +876,9 @@ class Scale extends Element {
876876
}
877877

878878
getBaseValue() {
879-
var me = this;
880-
var min = me.min;
881-
var max = me.max;
879+
const {min, max} = this;
882880

883-
return me.beginAtZero ? 0 :
884-
min < 0 && max < 0 ? max :
881+
return min < 0 && max < 0 ? max :
885882
min > 0 && max > 0 ? min :
886883
0;
887884
}

0 commit comments

Comments
 (0)