]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Draw active points last (#6944)
authorJukka Kurkela <jukka.kurkela@gmail.com>
Fri, 10 Jan 2020 23:27:31 +0000 (01:27 +0200)
committerEvert Timberg <evert.timberg+github@gmail.com>
Fri, 10 Jan 2020 23:27:30 +0000 (18:27 -0500)
src/controllers/controller.line.js
src/core/core.datasetController.js

index 756ac9e9ddcf2abf958f120a72a77ab9509f209c..ddb4aa0d785a6056612dbf1350907d425498e17e 100644 (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);
                }
        },
 });
index 1db4dcfcd5518856903b0f3d5587b5ace9efe222..abe8e461491d524dfb06234cccf10191a7e78650 100644 (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)});
        },