Rename dataset-specific option "tension" to "lineTension" and add a compatibility-clause to support the old name as well

This commit is contained in:
Jannis Achstetter
2016-04-20 17:07:56 +02:00
parent b0c1e9cb69
commit bc0f0f0fa7

View File

@@ -86,9 +86,16 @@ module.exports = function(Chart) {
// Data
line._children = points;
// Model
// Compatibility: If the properties are defined with only the old name, use those values
if ((this.getDataset().tension !== undefined) && (this.getDataset().lineTension === undefined))
{
this.getDataset().lineTension = this.getDataset().tension;
}
line._model = {
// 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().lineTension, this.chart.options.elements.line.tension),
backgroundColor: line.custom && line.custom.backgroundColor ? line.custom.backgroundColor : (this.getDataset().backgroundColor || this.chart.options.elements.line.backgroundColor),
borderWidth: line.custom && line.custom.borderWidth ? line.custom.borderWidth : (this.getDataset().borderWidth || this.chart.options.elements.line.borderWidth),
borderColor: line.custom && line.custom.borderColor ? line.custom.borderColor : (this.getDataset().borderColor || this.chart.options.elements.line.borderColor),