diff --git a/src/controllers/controller.bar.js b/src/controllers/controller.bar.js index 7abc60df6..9ade92879 100644 --- a/src/controllers/controller.bar.js +++ b/src/controllers/controller.bar.js @@ -103,7 +103,7 @@ // 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], diff --git a/src/controllers/controller.line.js b/src/controllers/controller.line.js index 144622109..c9fc36682 100644 --- a/src/controllers/controller.line.js +++ b/src/controllers/controller.line.js @@ -132,7 +132,7 @@ // 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), diff --git a/src/core/core.controller.js b/src/core/core.controller.js index 55c4159d3..aaa23a262 100644 --- a/src/core/core.controller.js +++ b/src/core/core.controller.js @@ -47,8 +47,11 @@ // 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();