From: Jukka Kurkela Date: Wed, 21 Oct 2020 12:13:27 +0000 (+0300) Subject: Rename showLines to showLine (#7936) X-Git-Tag: v3.0.0-beta.5~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6a72bcbecad2187349e92d6b19ff189d89646077;p=thirdparty%2FChart.js.git Rename showLines to showLine (#7936) --- diff --git a/docs/docs/charts/line.mdx b/docs/docs/charts/line.mdx index 1a1ebc738..100e935e3 100644 --- a/docs/docs/charts/line.mdx +++ b/docs/docs/charts/line.mdx @@ -179,7 +179,7 @@ The line chart defines the following configuration options. These options are me | Name | Type | Default | Description | ---- | ---- | ------- | ----------- -| `showLines` | `boolean` | `true` | If false, the lines between points are not drawn. +| `showLine` | `boolean` | `true` | If false, the lines between points are not drawn. | `spanGaps` | `boolean`\|`number` | `false` | 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. ## Default Options diff --git a/docs/docs/general/performance.md b/docs/docs/general/performance.md index 13a239092..4fed8bc1e 100644 --- a/docs/docs/general/performance.md +++ b/docs/docs/general/performance.md @@ -188,7 +188,7 @@ new Chart(ctx, { }] }, options: { - showLines: false // disable for all datasets + showLine: false // disable for all datasets } }); ``` diff --git a/docs/docs/getting-started/v3-migration.md b/docs/docs/getting-started/v3-migration.md index 085a246db..23d8a78da 100644 --- a/docs/docs/getting-started/v3-migration.md +++ b/docs/docs/getting-started/v3-migration.md @@ -91,6 +91,7 @@ A number of changes were made to the configuration options passed to the `Chart` * `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. * `aspectRatio` defaults to 1 for doughnut, pie, polarArea, and radar charts diff --git a/src/controllers/controller.line.js b/src/controllers/controller.line.js index f9ae019e7..c59b2df89 100644 --- a/src/controllers/controller.line.js +++ b/src/controllers/controller.line.js @@ -87,7 +87,7 @@ export default class LineController extends DatasetController { const options = me.chart.options; const lineOptions = options.elements.line; const values = super.resolveDatasetElementOptions(active); - const showLine = valueOrDefault(config.showLine, options.showLines); + const showLine = valueOrDefault(config.showLine, options.showLine); // The default behavior of lines is to break at null values, according // to https://github.com/chartjs/Chart.js/issues/2435#issuecomment-216718158 @@ -161,7 +161,7 @@ LineController.defaults = { rotation: 'pointRotation' }, - showLines: true, + showLine: true, spanGaps: false, interaction: { diff --git a/src/controllers/controller.radar.js b/src/controllers/controller.radar.js index 19283338f..6dfb3b5cc 100644 --- a/src/controllers/controller.radar.js +++ b/src/controllers/controller.radar.js @@ -76,7 +76,7 @@ export default class RadarController extends DatasetController { const config = me._config; const options = me.chart.options; const values = super.resolveDatasetElementOptions(active); - const showLine = valueOrDefault(config.showLine, options.showLines); + const showLine = valueOrDefault(config.showLine, options.showLine); values.spanGaps = valueOrDefault(config.spanGaps, options.spanGaps); values.tension = valueOrDefault(config.lineTension, options.elements.line.tension); diff --git a/src/core/core.defaults.js b/src/core/core.defaults.js index be9449d62..9793a880d 100644 --- a/src/core/core.defaults.js +++ b/src/core/core.defaults.js @@ -53,7 +53,7 @@ export class Defaults { this.onHover = null; this.onClick = null; this.responsive = true; - this.showLines = true; + this.showLine = true; this.plugins = {}; this.scale = undefined; this.doughnut = undefined; diff --git a/test/fixtures/controller.line/showLines/dataset.js b/test/fixtures/controller.line/showLines/dataset.js index b1f47db14..fd755ca37 100644 --- a/test/fixtures/controller.line/showLines/dataset.js +++ b/test/fixtures/controller.line/showLines/dataset.js @@ -16,7 +16,7 @@ module.exports = { options: { legend: false, title: false, - showLines: true, + showLine: true, scales: { x: { display: false diff --git a/test/fixtures/controller.line/showLines/false.js b/test/fixtures/controller.line/showLines/false.js index d88f9ebdd..026c51027 100644 --- a/test/fixtures/controller.line/showLines/false.js +++ b/test/fixtures/controller.line/showLines/false.js @@ -14,7 +14,7 @@ module.exports = { options: { legend: false, title: false, - showLines: false, + showLine: false, scales: { x: { display: false diff --git a/test/fixtures/controller.radar/showLines/value.js b/test/fixtures/controller.radar/showLines/value.js index eab88702b..f903c38f8 100644 --- a/test/fixtures/controller.radar/showLines/value.js +++ b/test/fixtures/controller.radar/showLines/value.js @@ -25,7 +25,7 @@ module.exports = { options: { legend: false, title: false, - showLines: false, + showLine: false, elements: { line: { borderColor: '#ff0000', diff --git a/test/fixtures/controller.scatter/showLines/true.js b/test/fixtures/controller.scatter/showLines/true.js index a98262653..9c31f48de 100644 --- a/test/fixtures/controller.scatter/showLines/true.js +++ b/test/fixtures/controller.scatter/showLines/true.js @@ -1,5 +1,5 @@ module.exports = { - description: 'showLines option should draw a line if true', + description: 'showLine option should draw a line if true', config: { type: 'scatter', data: { diff --git a/test/fixtures/controller.scatter/showLines/undefined.js b/test/fixtures/controller.scatter/showLines/undefined.js index 42b8bef9f..4da3e5854 100644 --- a/test/fixtures/controller.scatter/showLines/undefined.js +++ b/test/fixtures/controller.scatter/showLines/undefined.js @@ -1,5 +1,5 @@ module.exports = { - description: 'showLines option should not draw a line if undefined', + description: 'showLine option should not draw a line if undefined', config: { type: 'scatter', data: { diff --git a/test/specs/controller.bubble.tests.js b/test/specs/controller.bubble.tests.js index b0ce9723b..f31513fbe 100644 --- a/test/specs/controller.bubble.tests.js +++ b/test/specs/controller.bubble.tests.js @@ -70,7 +70,7 @@ describe('Chart.controllers.bubble', function() { }, options: { animation: false, - showLines: true + showLine: true } }); diff --git a/test/specs/controller.line.tests.js b/test/specs/controller.line.tests.js index fbc7c75bd..d29bdc3e6 100644 --- a/test/specs/controller.line.tests.js +++ b/test/specs/controller.line.tests.js @@ -74,7 +74,7 @@ describe('Chart.controllers.line', function() { labels: ['label1', 'label2', 'label3', 'label4'] }, options: { - showLines: true + showLine: true } }); @@ -109,7 +109,7 @@ describe('Chart.controllers.line', function() { labels: ['label1', 'label2', 'label3', 'label4'] }, options: { - showLines: true, + showLine: true, legend: false, title: false, elements: { diff --git a/test/specs/controller.polarArea.tests.js b/test/specs/controller.polarArea.tests.js index 3a5991b41..508cc68a5 100644 --- a/test/specs/controller.polarArea.tests.js +++ b/test/specs/controller.polarArea.tests.js @@ -86,7 +86,7 @@ describe('Chart.controllers.polarArea', function() { labels: ['label1', 'label2', 'label3', 'label4'] }, options: { - showLines: true, + showLine: true, legend: false, title: false, elements: { @@ -153,7 +153,7 @@ describe('Chart.controllers.polarArea', function() { labels: ['label1', 'label2', 'label3', 'label4'] }, options: { - showLines: true, + showLine: true, legend: false, title: false, startAngle: 90, // default is 0 @@ -201,7 +201,7 @@ describe('Chart.controllers.polarArea', function() { labels: ['label1', 'label2', 'label3', 'label4'] }, options: { - showLines: true, + showLine: true, elements: { arc: { backgroundColor: 'rgb(255, 0, 0)', diff --git a/test/specs/controller.radar.tests.js b/test/specs/controller.radar.tests.js index 235d820ea..4660cd239 100644 --- a/test/specs/controller.radar.tests.js +++ b/test/specs/controller.radar.tests.js @@ -84,7 +84,7 @@ describe('Chart.controllers.radar', function() { labels: ['label1', 'label2', 'label3', 'label4'] }, options: { - showLines: true, + showLine: true, legend: false, title: false, elements: { diff --git a/test/specs/core.controller.tests.js b/test/specs/core.controller.tests.js index fe0dd8558..aa783eb0a 100644 --- a/test/specs/core.controller.tests.js +++ b/test/specs/core.controller.tests.js @@ -104,7 +104,7 @@ describe('Chart', function() { var options = chart.options; expect(options.font.size).toBe(defaults.font.size); - expect(options.showLines).toBe(defaults.line.showLines); + expect(options.showLine).toBe(defaults.line.showLine); expect(options.spanGaps).toBe(true); expect(options.hover.onHover).toBe(callback); expect(options.hover.mode).toBe('test'); @@ -128,7 +128,7 @@ describe('Chart', function() { var options = chart.options; expect(options.font.size).toBe(defaults.font.size); - expect(options.showLines).toBe(defaults.line.showLines); + expect(options.showLine).toBe(defaults.line.showLine); expect(options.spanGaps).toBe(true); expect(options.hover.onHover).toBe(callback); expect(options.hover.mode).toBe('test'); @@ -160,7 +160,7 @@ describe('Chart', function() { }); var options = chart.options; - expect(options.showLines).toBe(defaults.showLines); + expect(options.showLine).toBe(defaults.showLine); expect(options.spanGaps).toBe(false); expect(options.hover.mode).toBe('dataset'); expect(options.title.position).toBe('bottom'); diff --git a/types/controllers/index.d.ts b/types/controllers/index.d.ts index 0dde84bbc..f7fce5e26 100644 --- a/types/controllers/index.d.ts +++ b/types/controllers/index.d.ts @@ -153,7 +153,7 @@ export interface ILineControllerChartOptions { * If false, the lines between points are not drawn. * @default true */ - showLines: boolean; + showLine: boolean; } export interface LineController extends DatasetController {} @@ -181,7 +181,7 @@ export interface IDoughnutControllerDatasetOptions extends IControllerDatasetOptions, ScriptableAndArrayOptions, ScriptableAndArrayOptions { - + /** * Sweep to allow arcs to cover. * @default 2 * Math.PI