Change updateElement to updateElements (#6722)

This commit is contained in:
Ben McCann
2019-11-19 04:12:38 -08:00
committed by Evert Timberg
parent edbeaac29f
commit 34b93751db
8 changed files with 195 additions and 198 deletions

View File

@@ -116,39 +116,42 @@ module.exports = DatasetController.extend({
const points = me._cachedMeta.data;
// Update Points
helpers.each(points, function(point, index) {
me.updateElement(point, index, reset);
});
me.updateElements(points, 0, points.length, reset);
},
/**
* @protected
*/
updateElement: function(point, index, reset) {
updateElements: function(points, start, count, reset) {
const me = this;
const meta = me._cachedMeta;
const xScale = meta.xScale;
const yScale = meta.yScale;
const options = me._resolveDataElementOptions(index);
const parsed = !reset && me._getParsed(index);
const x = reset ? xScale.getPixelForDecimal(0.5) : xScale.getPixelForValue(parsed[xScale.id]);
const y = reset ? yScale.getBasePixel() : yScale.getPixelForValue(parsed[yScale.id]);
let i;
point._options = options;
point._model = {
backgroundColor: options.backgroundColor,
borderColor: options.borderColor,
borderWidth: options.borderWidth,
hitRadius: options.hitRadius,
pointStyle: options.pointStyle,
rotation: options.rotation,
radius: reset ? 0 : options.radius,
skip: isNaN(x) || isNaN(y),
x: x,
y: y,
};
for (i = start; i < start + count; i++) {
const point = points[i];
const options = me._resolveDataElementOptions(i);
const parsed = !reset && me._getParsed(i);
const x = reset ? xScale.getPixelForDecimal(0.5) : xScale.getPixelForValue(parsed[xScale.id]);
const y = reset ? yScale.getBasePixel() : yScale.getPixelForValue(parsed[yScale.id]);
point.pivot(me.chart._animationsDisabled);
point._options = options;
point._model = {
backgroundColor: options.backgroundColor,
borderColor: options.borderColor,
borderWidth: options.borderWidth,
hitRadius: options.hitRadius,
pointStyle: options.pointStyle,
rotation: options.rotation,
radius: reset ? 0 : options.radius,
skip: isNaN(x) || isNaN(y),
x: x,
y: y,
};
point.pivot(me.chart._animationsDisabled);
}
},
/**