Skip to content

Commit

Permalink
Fix regression with lineTension (#6288)
Browse files Browse the repository at this point in the history
  • Loading branch information
nagix authored and simonbrunel committed May 24, 2019
1 parent bd3ab17 commit b02a3a8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/charts/radar.md
Expand Up @@ -75,7 +75,7 @@ The radar chart allows a number of properties to be specified for each dataset.
| [`borderWidth`](#line-styling) | `number` | Yes | - | `3`
| [`fill`](#line-styling) | <code>boolean&#124;string</code> | Yes | - | `true`
| [`label`](#general) | `string` | - | - | `''`
| [`lineTension`](#line-styling) | `number` | - | - | `0.4`
| [`lineTension`](#line-styling) | `number` | - | - | `0`
| [`pointBackgroundColor`](#point-styling) | `Color` | Yes | Yes | `'rgba(0, 0, 0, 0.1)'`
| [`pointBorderColor`](#point-styling) | `Color` | Yes | Yes | `'rgba(0, 0, 0, 0.1)'`
| [`pointBorderWidth`](#point-styling) | `number` | Yes | Yes | `1`
Expand Down
16 changes: 8 additions & 8 deletions src/controllers/controller.line.js
Expand Up @@ -73,8 +73,8 @@ module.exports = DatasetController.extend({
var line = meta.dataset;
var points = meta.data || [];
var options = me.chart.options;
var dataset = me.getDataset();
var showLine = me._showLine = valueOrDefault(me._config.showLine, options.showLines);
var config = me._config;
var showLine = me._showLine = valueOrDefault(config.showLine, options.showLines);
var i, ilen;

me._xScale = me.getScaleForId(meta.xAxisID);
Expand All @@ -83,8 +83,8 @@ module.exports = DatasetController.extend({
// Update Line
if (showLine) {
// Compatibility: If the properties are defined with only the old name, use those values
if ((dataset.tension !== undefined) && (dataset.lineTension === undefined)) {
dataset.lineTension = dataset.tension;
if (config.tension !== undefined && config.lineTension === undefined) {
config.lineTension = config.tension;
}

// Utility
Expand Down Expand Up @@ -161,7 +161,7 @@ module.exports = DatasetController.extend({
*/
_resolveDatasetElementOptions: function(element) {
var me = this;
var datasetOpts = me._config;
var config = me._config;
var custom = element.custom || {};
var options = me.chart.options;
var lineOptions = options.elements.line;
Expand All @@ -170,9 +170,9 @@ module.exports = DatasetController.extend({
// The default behavior of lines is to break at null values, according
// to https://github.com/chartjs/Chart.js/issues/2435#issuecomment-216718158
// This option gives lines the ability to span gaps
values.spanGaps = valueOrDefault(datasetOpts.spanGaps, options.spanGaps);
values.tension = valueOrDefault(datasetOpts.lineTension, lineOptions.tension);
values.steppedLine = resolve([custom.steppedLine, datasetOpts.steppedLine, lineOptions.stepped]);
values.spanGaps = valueOrDefault(config.spanGaps, options.spanGaps);
values.tension = valueOrDefault(config.lineTension, lineOptions.tension);
values.steppedLine = resolve([custom.steppedLine, config.steppedLine, lineOptions.stepped]);

return values;
},
Expand Down
6 changes: 3 additions & 3 deletions src/controllers/controller.radar.js
Expand Up @@ -69,12 +69,12 @@ module.exports = DatasetController.extend({
var line = meta.dataset;
var points = meta.data || [];
var scale = me.chart.scale;
var dataset = me.getDataset();
var config = me._config;
var i, ilen;

// Compatibility: If the properties are defined with only the old name, use those values
if ((dataset.tension !== undefined) && (dataset.lineTension === undefined)) {
dataset.lineTension = dataset.tension;
if (config.tension !== undefined && config.lineTension === undefined) {
config.lineTension = config.tension;
}

// Utility
Expand Down

0 comments on commit b02a3a8

Please sign in to comment.