Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regression with lineTension #6288

Merged
merged 2 commits into from May 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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` | - | - | `3`
| [`fill`](#line-styling) | <code>boolean&#124;string</code> | - | - | `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