Just assign instead of extend

This commit is contained in:
Mathias Küsel 2016-01-15 13:05:23 +01:00
parent 4f6e86640f
commit 19613f531c

View File

@ -82,14 +82,13 @@
// Update Line // Update Line
if (this.chart.options.showLines) { if (this.chart.options.showLines) {
helpers.extend(line, {
// Utility // Utility
_scale: yScale, line._scale = yScale;
_datasetIndex: this.index, line._datasetIndex = this.index;
// Data // Data
_children: points, line._children = points;
// Model // Model
_model: { line._model = {
// Appearance // Appearance
tension: line.custom && line.custom.tension ? line.custom.tension : helpers.getValueOrDefault(this.getDataset().tension, this.chart.options.elements.line.tension), tension: line.custom && line.custom.tension ? line.custom.tension : helpers.getValueOrDefault(this.getDataset().tension, this.chart.options.elements.line.tension),
backgroundColor: line.custom && line.custom.backgroundColor ? line.custom.backgroundColor : (this.getDataset().backgroundColor || this.chart.options.elements.line.backgroundColor), backgroundColor: line.custom && line.custom.backgroundColor ? line.custom.backgroundColor : (this.getDataset().backgroundColor || this.chart.options.elements.line.backgroundColor),
@ -103,9 +102,8 @@
// Scale // Scale
scaleTop: yScale.top, scaleTop: yScale.top,
scaleBottom: yScale.bottom, scaleBottom: yScale.bottom,
scaleZero: scaleBase, scaleZero: scaleBase
}, };
});
line.pivot(); line.pivot();
} }
@ -174,16 +172,15 @@
scaleBase = yScale.getPixelForValue(0); scaleBase = yScale.getPixelForValue(0);
} }
helpers.extend(point, {
// Utility // Utility
_chart: this.chart.chart, point._chart = this.chart.chart;
_xScale: xScale, point._xScale = xScale;
_yScale: yScale, point._yScale = yScale;
_datasetIndex: this.index, point._datasetIndex = this.index;
_index: index, point._index = index;
// Desired view properties // Desired view properties
_model: { point._model = {
x: xScale.getPixelForValue(this.getDataset().data[index], index, this.index, this.chart.isCombo), x: xScale.getPixelForValue(this.getDataset().data[index], index, this.index, this.chart.isCombo),
y: reset ? scaleBase : this.calculatePointY(this.getDataset().data[index], index, this.index, this.chart.isCombo), y: reset ? scaleBase : this.calculatePointY(this.getDataset().data[index], index, this.index, this.chart.isCombo),
// Appearance // Appearance
@ -193,9 +190,8 @@
borderColor: this.getPointBorderColor(point, index), borderColor: this.getPointBorderColor(point, index),
borderWidth: this.getPointBorderWidth(point, index), borderWidth: this.getPointBorderWidth(point, index),
// Tooltip // Tooltip
hitRadius: point.custom && point.custom.hitRadius ? point.custom.hitRadius : helpers.getValueAtIndexOrDefault(this.getDataset().hitRadius, index, this.chart.options.elements.point.hitRadius), hitRadius: point.custom && point.custom.hitRadius ? point.custom.hitRadius : helpers.getValueAtIndexOrDefault(this.getDataset().hitRadius, index, this.chart.options.elements.point.hitRadius)
}, };
});
point._model.skip = point.custom && point.custom.skip ? point.custom.skip : (isNaN(point._model.x) || isNaN(point._model.y)); point._model.skip = point.custom && point.custom.skip ? point.custom.skip : (isNaN(point._model.x) || isNaN(point._model.y));
}, },