From: Jukka Kurkela Date: Sat, 31 Oct 2020 12:54:14 +0000 (+0200) Subject: Rename lineTension back to tension (#7978) X-Git-Tag: v3.0.0-beta.5~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff76a236bfc0a417ea1f36a81c14e2dc6cf3c5f5;p=thirdparty%2FChart.js.git Rename lineTension back to tension (#7978) --- diff --git a/docs/docs/charts/line.mdx b/docs/docs/charts/line.mdx index 65edb6127..8ee843a8a 100644 --- a/docs/docs/charts/line.mdx +++ b/docs/docs/charts/line.mdx @@ -25,7 +25,7 @@ export const ExampleChart = () => { data: [65, 59, 80, 81, 56, 55, 40], fill: false, borderColor: 'rgb(75, 192, 192)', - lineTension: 0.1 + tension: 0.1 }] }, options: { @@ -72,7 +72,7 @@ The line chart allows a number of properties to be specified for each dataset. T | [`hoverBorderJoinStyle`](#line-styling) | `string` | Yes | - | `undefined` | [`hoverBorderWidth`](#line-styling) | `number` | Yes | - | `undefined` | [`label`](#general) | `string` | - | - | `''` -| [`lineTension`](#line-styling) | `number` | - | - | `0` +| [`tension`](#line-styling) | `number` | - | - | `0` | [`order`](#general) | `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)'` @@ -131,7 +131,7 @@ The style of the line can be controlled with the following properties: | `borderJoinStyle` | Line joint style. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin). | `borderWidth` | The line width (in pixels). | `fill` | How to fill the area under the line. See [area charts](area.md). -| `lineTension` | Bezier curve tension of the line. Set to 0 to draw straightlines. This option is ignored if monotone cubic interpolation is used. +| `tension` | Bezier curve tension of the line. Set to 0 to draw straightlines. This option is ignored if monotone cubic interpolation is used. | `showLine` | If false, the line is not drawn for this dataset. | `spanGaps` | If true, lines will be drawn between points with no or null data. If false, points with `NaN` data will create a break in the line. Can also be a number specifying the maximum gap length to span. The unit of the value depends on the scale used. @@ -171,7 +171,7 @@ The following values are supported for `stepped`. * `'after'`: Step-after Interpolation * `'middle'`: Step-middle Interpolation -If the `stepped` value is set to anything other than false, `lineTension` will be ignored. +If the `stepped` value is set to anything other than false, `tension` will be ignored. ## Configuration Options diff --git a/docs/docs/charts/radar.mdx b/docs/docs/charts/radar.mdx index 9086aed4f..2c305a2fe 100644 --- a/docs/docs/charts/radar.mdx +++ b/docs/docs/charts/radar.mdx @@ -96,7 +96,7 @@ The radar chart allows a number of properties to be specified for each dataset. | [`fill`](#line-styling) | boolean|string | Yes | - | `true` | [`label`](#general) | `string` | - | - | `''` | [`order`](#general) | `number` | - | - | `0` -| [`lineTension`](#line-styling) | `number` | - | - | `0` +| [`tension`](#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` @@ -148,7 +148,7 @@ The style of the line can be controlled with the following properties: | `borderJoinStyle` | Line joint style. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin). | `borderWidth` | The line width (in pixels). | `fill` | How to fill the area under the line. See [area charts](area.md). -| `lineTension` | Bezier curve tension of the line. Set to 0 to draw straight lines. +| `tension` | Bezier curve tension of the line. Set to 0 to draw straight lines. | `spanGaps` | If true, lines will be drawn between points with no or null data. If false, points with `NaN` data will create a break in the line. If the value is `undefined`, `spanGaps` fallback to the associated [chart configuration options](#configuration-options). The rest of the values fallback to the associated [`elements.line.*`](../configuration/elements.md#line-configuration) options. diff --git a/docs/docs/getting-started/v3-migration.md b/docs/docs/getting-started/v3-migration.md index 8e9085678..907390b85 100644 --- a/docs/docs/getting-started/v3-migration.md +++ b/docs/docs/getting-started/v3-migration.md @@ -90,7 +90,6 @@ A number of changes were made to the configuration options passed to the `Chart` * `scales.[x/y]Axes.time.min` was renamed to `scales[id].min` * `scales.[x/y]Axes.zeroLine*` options of axes were removed. Use scriptable scale options instead. * The dataset option `steppedLine` was removed. Use `stepped` -* The dataset option `tension` was removed. Use `lineTension` * The chart option `showLines` was renamed to `showLine` to match the dataset option. * Dataset options are now configured as `options[type].datasets` rather than `options.datasets[type]` * To override the platform class used in a chart instance, pass `platform: PlatformClass` in the config object. Note that the class should be passed, not an instance of the class. diff --git a/samples/charts/line/interpolation-modes.html b/samples/charts/line/interpolation-modes.html index f6154539d..6a7550f54 100644 --- a/samples/charts/line/interpolation-modes.html +++ b/samples/charts/line/interpolation-modes.html @@ -51,7 +51,7 @@ borderColor: window.chartColors.green, backgroundColor: 'rgba(0, 0, 0, 0)', fill: false, - lineTension: 0 + tension: 0 }] }, options: { diff --git a/samples/scales/financial.html b/samples/scales/financial.html index 425f1657f..7b1a83bce 100644 --- a/samples/scales/financial.html +++ b/samples/scales/financial.html @@ -117,7 +117,7 @@ type: 'line', pointRadius: 0, fill: false, - lineTension: 0, + tension: 0, borderWidth: 2 }] }, diff --git a/src/controllers/controller.line.js b/src/controllers/controller.line.js index c59b2df89..c3ecf7991 100644 --- a/src/controllers/controller.line.js +++ b/src/controllers/controller.line.js @@ -93,7 +93,7 @@ export default class LineController extends DatasetController { // to https://github.com/chartjs/Chart.js/issues/2435#issuecomment-216718158 // This option gives lines the ability to span gaps values.spanGaps = valueOrDefault(config.spanGaps, options.spanGaps); - values.tension = valueOrDefault(config.lineTension, lineOptions.tension); + values.tension = valueOrDefault(config.tension, lineOptions.tension); values.stepped = resolve([config.stepped, lineOptions.stepped]); if (!showLine) { diff --git a/src/controllers/controller.radar.js b/src/controllers/controller.radar.js index 6dfb3b5cc..9c81e08e2 100644 --- a/src/controllers/controller.radar.js +++ b/src/controllers/controller.radar.js @@ -79,7 +79,7 @@ export default class RadarController extends DatasetController { const showLine = valueOrDefault(config.showLine, options.showLine); values.spanGaps = valueOrDefault(config.spanGaps, options.spanGaps); - values.tension = valueOrDefault(config.lineTension, options.elements.line.tension); + values.tension = valueOrDefault(config.tension, options.elements.line.tension); if (!showLine) { values.borderWidth = 0; diff --git a/test/fixtures/element.line/skip/all.js b/test/fixtures/element.line/skip/all.js index dd313913c..89cbe98e7 100644 --- a/test/fixtures/element.line/skip/all.js +++ b/test/fixtures/element.line/skip/all.js @@ -7,7 +7,7 @@ module.exports = { data: [{x: 0, y: NaN}, {x: NaN, y: 0}, {x: NaN, y: -10}, {x: 19, y: NaN}], borderColor: 'red', fill: true, - lineTension: 0 + tension: 0 } ] }, diff --git a/test/fixtures/element.line/skip/first-span.js b/test/fixtures/element.line/skip/first-span.js index c0ac21a67..f2afa7f45 100644 --- a/test/fixtures/element.line/skip/first-span.js +++ b/test/fixtures/element.line/skip/first-span.js @@ -8,7 +8,7 @@ module.exports = { borderColor: 'red', fill: true, spanGaps: true, - lineTension: 0 + tension: 0 } ] }, diff --git a/test/fixtures/element.line/skip/first.js b/test/fixtures/element.line/skip/first.js index ec2f9b508..bdab6c83d 100644 --- a/test/fixtures/element.line/skip/first.js +++ b/test/fixtures/element.line/skip/first.js @@ -7,7 +7,7 @@ module.exports = { data: [{x: NaN, y: 10}, {x: 5, y: 0}, {x: 15, y: -10}, {x: 19, y: -5}], borderColor: 'red', fill: true, - lineTension: 0 + tension: 0 } ] }, diff --git a/test/fixtures/element.line/skip/last-span.js b/test/fixtures/element.line/skip/last-span.js index b038232f9..d05226a30 100644 --- a/test/fixtures/element.line/skip/last-span.js +++ b/test/fixtures/element.line/skip/last-span.js @@ -8,7 +8,7 @@ module.exports = { borderColor: 'red', fill: true, spanGaps: true, - lineTension: 0 + tension: 0 } ] }, diff --git a/test/fixtures/element.line/skip/last.js b/test/fixtures/element.line/skip/last.js index 7ffcac211..5afe55fc1 100644 --- a/test/fixtures/element.line/skip/last.js +++ b/test/fixtures/element.line/skip/last.js @@ -7,7 +7,7 @@ module.exports = { data: [{x: 0, y: 10}, {x: 5, y: 0}, {x: 15, y: -10}, {x: NaN, y: -5}], borderColor: 'red', fill: true, - lineTension: 0 + tension: 0 } ] }, diff --git a/test/fixtures/element.line/skip/middle-span.js b/test/fixtures/element.line/skip/middle-span.js index 52ecb1fe3..990731370 100644 --- a/test/fixtures/element.line/skip/middle-span.js +++ b/test/fixtures/element.line/skip/middle-span.js @@ -8,7 +8,7 @@ module.exports = { borderColor: 'red', fill: true, spanGaps: true, - lineTension: 0 + tension: 0 } ] }, diff --git a/test/fixtures/element.line/skip/middle.js b/test/fixtures/element.line/skip/middle.js index 8e312604e..9128fbb9d 100644 --- a/test/fixtures/element.line/skip/middle.js +++ b/test/fixtures/element.line/skip/middle.js @@ -7,7 +7,7 @@ module.exports = { data: [{x: 0, y: 10}, {x: 5, y: 0}, {x: NaN, y: -10}, {x: 19, y: -5}], borderColor: 'red', fill: true, - lineTension: 0 + tension: 0 } ] }, diff --git a/test/fixtures/element.line/stepped/after.js b/test/fixtures/element.line/stepped/after.js index 5bf19f80d..434623748 100644 --- a/test/fixtures/element.line/stepped/after.js +++ b/test/fixtures/element.line/stepped/after.js @@ -7,7 +7,7 @@ module.exports = { data: [{x: 1, y: 10}, {x: 5, y: 0}, {x: 15, y: -10}, {x: 19, y: -5}], borderColor: 'red', fill: false, - lineTension: 0, + tension: 0, stepped: 'after' } ] diff --git a/test/fixtures/element.line/stepped/before.js b/test/fixtures/element.line/stepped/before.js index f12f6a246..1d483b9b2 100644 --- a/test/fixtures/element.line/stepped/before.js +++ b/test/fixtures/element.line/stepped/before.js @@ -7,7 +7,7 @@ module.exports = { data: [{x: 1, y: 10}, {x: 5, y: 0}, {x: 15, y: -10}, {x: 19, y: -5}], borderColor: 'red', fill: false, - lineTension: 0, + tension: 0, stepped: 'before' } ] diff --git a/test/fixtures/element.line/stepped/default.js b/test/fixtures/element.line/stepped/default.js index b2bfd3a53..f907158fd 100644 --- a/test/fixtures/element.line/stepped/default.js +++ b/test/fixtures/element.line/stepped/default.js @@ -7,7 +7,7 @@ module.exports = { data: [{x: 1, y: 10}, {x: 5, y: 0}, {x: 15, y: -10}, {x: 19, y: -5}], borderColor: 'red', fill: false, - lineTension: 0, + tension: 0, stepped: true } ] diff --git a/test/fixtures/element.line/stepped/middle.js b/test/fixtures/element.line/stepped/middle.js index bdcda092c..58ad4edf8 100644 --- a/test/fixtures/element.line/stepped/middle.js +++ b/test/fixtures/element.line/stepped/middle.js @@ -7,7 +7,7 @@ module.exports = { data: [{x: 1, y: 10}, {x: 5, y: 0}, {x: 15, y: -10}, {x: 19, y: -5}], borderColor: 'red', fill: false, - lineTension: 0, + tension: 0, stepped: 'middle' } ] diff --git a/test/fixtures/element.line/tension/one.js b/test/fixtures/element.line/tension/one.js index 144c98a24..0631023a7 100644 --- a/test/fixtures/element.line/tension/one.js +++ b/test/fixtures/element.line/tension/one.js @@ -7,7 +7,7 @@ module.exports = { data: [{x: 1, y: 10}, {x: 5, y: 0}, {x: 15, y: -10}, {x: 19, y: -5}], borderColor: 'red', fill: false, - lineTension: 1 + tension: 1 } ] }, diff --git a/test/fixtures/element.line/tension/zero.js b/test/fixtures/element.line/tension/zero.js index 31d7165b9..7e738a739 100644 --- a/test/fixtures/element.line/tension/zero.js +++ b/test/fixtures/element.line/tension/zero.js @@ -7,7 +7,7 @@ module.exports = { data: [{x: 1, y: 10}, {x: 5, y: 0}, {x: 15, y: -10}, {x: 19, y: -5}], borderColor: 'red', fill: false, - lineTension: 0 + tension: 0 } ] }, diff --git a/test/fixtures/plugin.filler/fill-line-dataset-interpolated.js b/test/fixtures/plugin.filler/fill-line-dataset-interpolated.js index d0b26190e..bfba6fd72 100644 --- a/test/fixtures/plugin.filler/fill-line-dataset-interpolated.js +++ b/test/fixtures/plugin.filler/fill-line-dataset-interpolated.js @@ -43,7 +43,7 @@ module.exports = { title: false, line: { datasets: { - lineTension: 0.4, + tension: 0.4, borderWidth: 1, pointRadius: 1.5, } diff --git a/test/fixtures/scale.timeseries/financial-daily.js b/test/fixtures/scale.timeseries/financial-daily.js index fab4328fd..49ef34654 100644 --- a/test/fixtures/scale.timeseries/financial-daily.js +++ b/test/fixtures/scale.timeseries/financial-daily.js @@ -9,7 +9,7 @@ module.exports = { type: 'line', pointRadius: 0, fill: false, - lineTension: 0, + tension: 0, borderWidth: 2 }] }, diff --git a/test/specs/controller.line.tests.js b/test/specs/controller.line.tests.js index f8249261d..fa2e87eb1 100644 --- a/test/specs/controller.line.tests.js +++ b/test/specs/controller.line.tests.js @@ -512,7 +512,7 @@ describe('Chart.controllers.line', function() { Chart.helpers.merge(Chart.defaults.controllers.line.datasets, { spanGaps: true, - lineTension: 0.231, + tension: 0.231, backgroundColor: '#add', borderWidth: '#daa', borderColor: '#dad', @@ -555,7 +555,7 @@ describe('Chart.controllers.line', function() { Chart.helpers.merge(Chart.defaults.controllers.line.datasets, { spanGaps: true, - lineTension: 0.231 + tension: 0.231 }); var chart = window.acquireChart({ @@ -572,7 +572,7 @@ describe('Chart.controllers.line', function() { options: { line: { datasets: { - lineTension: 0.345, + tension: 0.345, backgroundColor: '#add' } } @@ -604,7 +604,7 @@ describe('Chart.controllers.line', function() { line: { datasets: { spanGaps: true, - lineTension: 0.231, + tension: 0.231, backgroundColor: '#add', borderWidth: '#daa', borderColor: '#dad', @@ -642,7 +642,7 @@ describe('Chart.controllers.line', function() { data: [0, 0], label: 'dataset1', spanGaps: true, - lineTension: 0.231, + tension: 0.231, backgroundColor: '#add', borderWidth: '#daa', borderColor: '#dad', diff --git a/test/specs/controller.radar.tests.js b/test/specs/controller.radar.tests.js index 4660cd239..c343bbd72 100644 --- a/test/specs/controller.radar.tests.js +++ b/test/specs/controller.radar.tests.js @@ -174,7 +174,7 @@ describe('Chart.controllers.radar', function() { }); // Use dataset level styles for lines & points - chart.data.datasets[0].lineTension = 0; + chart.data.datasets[0].tension = 0; chart.data.datasets[0].backgroundColor = 'rgb(98, 98, 98)'; chart.data.datasets[0].borderColor = 'rgb(8, 8, 8)'; chart.data.datasets[0].borderWidth = 0.55;