const base = vScale.getBasePixel();
const horizontal = vScale.isHorizontal();
const ruler = this._getRuler();
- const firstOpts = this.resolveDataElementOptions(start, mode);
- const sharedOptions = this.getSharedOptions(firstOpts);
- const includeOptions = this.includeOptions(mode, sharedOptions);
-
- this.updateSharedOptions(sharedOptions, mode, firstOpts);
+ const {sharedOptions, includeOptions} = this._getSharedOptions(start, mode);
for (let i = start; i < start + count; i++) {
const parsed = this.getParsed(i);
updateElements(points, start, count, mode) {
const reset = mode === 'reset';
const {iScale, vScale} = this._cachedMeta;
- const firstOpts = this.resolveDataElementOptions(start, mode);
- const sharedOptions = this.getSharedOptions(firstOpts);
- const includeOptions = this.includeOptions(mode, sharedOptions);
+ const {sharedOptions, includeOptions} = this._getSharedOptions(start, mode);
const iAxis = iScale.axis;
const vAxis = vScale.axis;
properties.skip = isNaN(iPixel) || isNaN(vPixel);
if (includeOptions) {
- properties.options = this.resolveDataElementOptions(i, point.active ? 'active' : mode);
+ properties.options = sharedOptions || this.resolveDataElementOptions(i, point.active ? 'active' : mode);
if (reset) {
properties.options.radius = 0;
this.updateElement(point, i, properties, mode);
}
-
- this.updateSharedOptions(sharedOptions, mode, firstOpts);
}
/**
const animateScale = reset && animationOpts.animateScale;
const innerRadius = animateScale ? 0 : this.innerRadius;
const outerRadius = animateScale ? 0 : this.outerRadius;
- const firstOpts = this.resolveDataElementOptions(start, mode);
- const sharedOptions = this.getSharedOptions(firstOpts);
- const includeOptions = this.includeOptions(mode, sharedOptions);
+ const {sharedOptions, includeOptions} = this._getSharedOptions(start, mode);
let startAngle = this._getRotation();
let i;
this.updateElement(arc, i, properties, mode);
}
- this.updateSharedOptions(sharedOptions, mode, firstOpts);
}
calculateTotal() {
updateElements(points, start, count, mode) {
const reset = mode === 'reset';
const {iScale, vScale, _stacked, _dataset} = this._cachedMeta;
- const firstOpts = this.resolveDataElementOptions(start, mode);
- const sharedOptions = this.getSharedOptions(firstOpts);
- const includeOptions = this.includeOptions(mode, sharedOptions);
+ const {sharedOptions, includeOptions} = this._getSharedOptions(start, mode);
const iAxis = iScale.axis;
const vAxis = vScale.axis;
const {spanGaps, segment} = this.options;
prevParsed = parsed;
}
-
- this.updateSharedOptions(sharedOptions, mode, firstOpts);
}
/**
return !sharedOptions || isDirectUpdateMode(mode) || this.chart._animationsDisabled;
}
+ /**
+ * @todo v4, rename to getSharedOptions and remove excess functions
+ */
+ _getSharedOptions(start, mode) {
+ const firstOpts = this.resolveDataElementOptions(start, mode);
+ const previouslySharedOptions = this._sharedOptions;
+ const sharedOptions = this.getSharedOptions(firstOpts);
+ const includeOptions = this.includeOptions(mode, sharedOptions) || (sharedOptions !== previouslySharedOptions);
+ this.updateSharedOptions(sharedOptions, mode, firstOpts);
+ return {sharedOptions, includeOptions};
+ }
+
/**
* Utility for updating an element with new properties, using animations when appropriate.
* @protected
--- /dev/null
+module.exports = {
+ config: {
+ type: 'line',
+ data: {
+ labels: ['A', 'B', 'C'],
+ datasets: [{
+ data: [12, 19, 3]
+ }]
+ },
+ options: {
+ animation: {
+ duration: 0
+ },
+ backgroundColor: 'red',
+ radius: () => 20,
+ scales: {
+ x: {display: false},
+ y: {display: false}
+ }
+ }
+ },
+ options: {
+ canvas: {
+ height: 256,
+ width: 512
+ },
+ run: (chart) => {
+ chart.options.radius = 5;
+ chart.update();
+ }
+ }
+};