Draw active points last (#6944)

This commit is contained in:
Jukka Kurkela 2020-01-11 01:27:31 +02:00 committed by Evert Timberg
parent 8d7d5571cf
commit 547aa51544
2 changed files with 15 additions and 4 deletions

View File

@ -164,16 +164,26 @@ export default DatasetController.extend({
const meta = me._cachedMeta;
const points = meta.data || [];
const area = chart.chartArea;
const ilen = points.length;
let i = 0;
const active = [];
let ilen = points.length;
let i, point;
if (me._showLine) {
meta.dataset.draw(ctx, area);
}
// Draw the points
for (; i < ilen; ++i) {
points[i].draw(ctx, area);
for (i = 0; i < ilen; ++i) {
point = points[i];
if (point.active) {
active.push(point);
} else {
point.draw(ctx, area);
}
}
for (i = 0, ilen = active.length; i < ilen; ++i) {
active[i].draw(ctx, area);
}
},
});

View File

@ -1006,6 +1006,7 @@ helpers.extend(DatasetController.prototype, {
* @private
*/
_setStyle(element, index, mode, active) {
element.active = active;
this._resolveAnimations(index, mode, active).update(element, {options: this.getStyle(index, active)});
},