Rename showLines to showLine (#7936)

This commit is contained in:
Jukka Kurkela
2020-10-21 15:13:27 +03:00
committed by GitHub
parent bc11f10216
commit 6a72bcbeca
17 changed files with 24 additions and 23 deletions

View File

@@ -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

View File

@@ -188,7 +188,7 @@ new Chart(ctx, {
}]
},
options: {
showLines: false // disable for all datasets
showLine: false // disable for all datasets
}
});
```

View File

@@ -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

View File

@@ -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: {

View File

@@ -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);

View File

@@ -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;

View File

@@ -16,7 +16,7 @@ module.exports = {
options: {
legend: false,
title: false,
showLines: true,
showLine: true,
scales: {
x: {
display: false

View File

@@ -14,7 +14,7 @@ module.exports = {
options: {
legend: false,
title: false,
showLines: false,
showLine: false,
scales: {
x: {
display: false

View File

@@ -25,7 +25,7 @@ module.exports = {
options: {
legend: false,
title: false,
showLines: false,
showLine: false,
elements: {
line: {
borderColor: '#ff0000',

View File

@@ -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: {

View File

@@ -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: {

View File

@@ -70,7 +70,7 @@ describe('Chart.controllers.bubble', function() {
},
options: {
animation: false,
showLines: true
showLine: true
}
});

View File

@@ -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: {

View File

@@ -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)',

View File

@@ -84,7 +84,7 @@ describe('Chart.controllers.radar', function() {
labels: ['label1', 'label2', 'label3', 'label4']
},
options: {
showLines: true,
showLine: true,
legend: false,
title: false,
elements: {

View File

@@ -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');

View File

@@ -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<IArcOptions>,
ScriptableAndArrayOptions<IArcHoverOptions> {
/**
* Sweep to allow arcs to cover.
* @default 2 * Math.PI