]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Fix animations
authorEvert Timberg <evert.timberg@gmail.com>
Mon, 15 Jun 2015 22:54:46 +0000 (18:54 -0400)
committerEvert Timberg <evert.timberg@gmail.com>
Mon, 15 Jun 2015 22:54:46 +0000 (18:54 -0400)
src/controllers/controller.bar.js
src/controllers/controller.line.js
src/core/core.controller.js

index 7abc60df6b547b9e9b0e669b240b6ea89ef49ef3..9ade928793006dbadbcf1064cb2c621efc9e7888 100644 (file)
                                        // Desired view properties
                                        _model: {
                                                x: xScale.calculateBarX(this.chart.data.datasets.length, this.index, index),
-                                               y: reset ? yScalePoint : yScale.getPixelForValue(this.getDataset().data[index]),
+                                               y: reset ? yScalePoint : yScale.calculateBarY(this.index, index),
 
                                                // Tooltip
                                                label: this.chart.data.labels[index],
index 14462210993e440152bfc55380e527f6c6cd858d..c9fc366822f3d8b3fc9ca0bca19dd87bcb2fe8b8 100644 (file)
                                        // Desired view properties
                                        _model: {
                                                x: xScale.getPointPixelForValue(this.getDataset().data[index], index, this.index),
-                                               y: yScale.getPointPixelForValue(this.getDataset().data[index], index, this.index),
+                                               y: reset ? scaleBase : yScale.getPointPixelForValue(this.getDataset().data[index], index, this.index),
                                                // Appearance
                                                tension: point.custom && point.custom.tension ? point.custom.tension : this.chart.options.elements.line.tension,
                                                radius: point.custom && point.custom.radius ? point.custom.radius : helpers.getValueAtIndexOrDefault(this.getDataset().radius, index, this.chart.options.elements.point.radius),
index 55c4159d39cfd6bd6d8a1074e8279cf783801fdb..aaa23a262c906791ba47a991544e91dd636009f5 100644 (file)
                        // If BeforeInit(this) doesn't return false, proceed
 
                        this.bindEvents();
-                       this.buildScales();
+
+                       // Make sure controllers are built first so that each dataset is bound to an axis before the scales
+                       // are built
                        this.buildControllers();
+                       this.buildScales();
                        this.resetElements();
                        this.initToolTip();
                        this.update();