Skip to content

Commit 3b20517

Browse files
committed
Remove global from defaults
1 parent 5d94cac commit 3b20517

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+482
-521
lines changed

docs/charts/line.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ If the `steppedLine` value is set to anything other than false, `lineTension` wi
166166

167167
## Configuration Options
168168

169-
The line chart defines the following configuration options. These options are merged with the global chart configuration options, `Chart.defaults.global`, to form the options passed to the chart.
169+
The line chart defines the following configuration options. These options are merged with the global chart configuration options, `Chart.defaults`, to form the options passed to the chart.
170170

171171
| Name | Type | Default | Description
172172
| ---- | ---- | ------- | -----------

docs/charts/radar.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ The interaction with each point can be controlled with the following properties:
155155

156156
## Configuration Options
157157

158-
The radar chart defines the following configuration options. These options are merged with the global chart configuration options, `Chart.defaults.global`, to form the options passed to the chart.
158+
The radar chart defines the following configuration options. These options are merged with the global chart configuration options, `Chart.defaults`, to form the options passed to the chart.
159159

160160
| Name | Type | Default | Description
161161
| ---- | ---- | ------- | -----------

docs/configuration/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ The configuration is used to change how the chart behaves. There are properties
66

77
This concept was introduced in Chart.js 1.0 to keep configuration [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), and allow for changing options globally across chart types, avoiding the need to specify options for each instance, or the default for a particular chart type.
88

9-
Chart.js merges the options object passed to the chart with the global configuration using chart type defaults and scales defaults appropriately. This way you can be as specific as you would like in your individual chart configuration, while still changing the defaults for all chart types where applicable. The global general options are defined in `Chart.defaults.global`. The defaults for each chart type are discussed in the documentation for that chart type.
9+
Chart.js merges the options object passed to the chart with the global configuration using chart type defaults and scales defaults appropriately. This way you can be as specific as you would like in your individual chart configuration, while still changing the defaults for all chart types where applicable. The global general options are defined in `Chart.defaults`. The defaults for each chart type are discussed in the documentation for that chart type.
1010

1111
The following example would set the hover mode to 'nearest' for all charts where this was not overridden by the chart type defaults or the options passed to the constructor on creation.
1212

1313
```javascript
14-
Chart.defaults.global.hover.mode = 'nearest';
14+
Chart.defaults.hover.mode = 'nearest';
1515

1616
// Hover mode is set to nearest because it was not overridden here
1717
var chartHoverModeNearest = new Chart(ctx, {
@@ -38,7 +38,7 @@ Options may be configured directly on the dataset. The dataset options can be ch
3838

3939
- per dataset: dataset.*
4040
- per chart: options.datasets[type].*
41-
- or globally: Chart.defaults.global.datasets[type].*
41+
- or globally: Chart.defaults.datasets[type].*
4242

4343
where type corresponds to the dataset type.
4444

@@ -48,7 +48,7 @@ The following example would set the `showLine` option to 'false' for all line da
4848

4949
```javascript
5050
// Do not show lines for all datasets by default
51-
Chart.defaults.global.datasets.line.showLine = false;
51+
Chart.defaults.datasets.line.showLine = false;
5252

5353
// This chart would show a line only for the third dataset
5454
var chart = new Chart(ctx, {

docs/configuration/animations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Chart.js animates charts out of the box. A number of options are provided to con
44

55
## Animation Configuration
66

7-
The following animation options are available. The global options for are defined in `Chart.defaults.global.animation`.
7+
The following animation options are available. The global options for are defined in `Chart.defaults.animation`.
88

99
| Name | Type | Default | Description
1010
| ---- | ---- | ------- | -----------

docs/configuration/elements.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ While chart types provide settings to configure the styling of each dataset, you
44

55
## Global Configuration
66

7-
The element options can be specified per chart or globally. The global options for elements are defined in `Chart.defaults.global.elements`. For example, to set the border width of all bar charts globally you would do:
7+
The element options can be specified per chart or globally. The global options for elements are defined in `Chart.defaults.elements`. For example, to set the border width of all bar charts globally you would do:
88

99
```javascript
10-
Chart.defaults.global.elements.rectangle.borderWidth = 2;
10+
Chart.defaults.elements.rectangle.borderWidth = 2;
1111
```
1212

1313
## Point Configuration
1414
Point elements are used to represent the points in a line, radar or bubble chart.
1515

16-
Global point options: `Chart.defaults.global.elements.point`.
16+
Global point options: `Chart.defaults.elements.point`.
1717

1818
| Name | Type | Default | Description
1919
| ---- | ---- | ------- | -----------
@@ -46,7 +46,7 @@ If the value is an image, that image is drawn on the canvas using [drawImage](ht
4646
## Line Configuration
4747
Line elements are used to represent the line in a line chart.
4848

49-
Global line options: `Chart.defaults.global.elements.line`.
49+
Global line options: `Chart.defaults.elements.line`.
5050

5151
| Name | Type | Default | Description
5252
| ---- | ---- | ------- | -----------
@@ -59,14 +59,14 @@ Global line options: `Chart.defaults.global.elements.line`.
5959
| `borderDashOffset` | `number` | `0.0` | Line dash offset. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineDashOffset).
6060
| `borderJoinStyle` | `string` | `'miter'` | Line join style. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin).
6161
| `capBezierPoints` | `boolean` | `true` | `true` to keep Bézier control inside the chart, `false` for no restriction.
62-
| `cubicInterpolationMode` | `string` | `'default'` | Interpolation mode to apply. [See more...](../charts/line.md#cubicinterpolationmode)
62+
| `cubicInterpolationMode` | `string` | `'default'` | Interpolation mode to apply. [See more...](../charts/line.md#cubicinterpolationmode)
6363
| `fill` | <code>boolean&#124;string</code> | `true` | How to fill the area under the line. See [area charts](../charts/area.md#filling-modes).
6464
| `stepped` | `boolean` | `false` | `true` to show the line as a stepped line (`tension` will be ignored).
6565

6666
## Rectangle Configuration
6767
Rectangle elements are used to represent the bars in a bar chart.
6868

69-
Global rectangle options: `Chart.defaults.global.elements.rectangle`.
69+
Global rectangle options: `Chart.defaults.elements.rectangle`.
7070

7171
| Name | Type | Default | Description
7272
| ---- | ---- | ------- | -----------
@@ -78,7 +78,7 @@ Global rectangle options: `Chart.defaults.global.elements.rectangle`.
7878
## Arc Configuration
7979
Arcs are used in the polar area, doughnut and pie charts.
8080

81-
Global arc options: `Chart.defaults.global.elements.arc`.
81+
Global arc options: `Chart.defaults.elements.arc`.
8282

8383
| Name | Type | Default | Description
8484
| ---- | ---- | ------- | -----------

docs/configuration/layout.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Layout Configuration
22

3-
The layout configuration is passed into the `options.layout` namespace. The global options for the chart layout is defined in `Chart.defaults.global.layout`.
3+
The layout configuration is passed into the `options.layout` namespace. The global options for the chart layout is defined in `Chart.defaults.layout`.
44

55
| Name | Type | Default | Description
66
| ---- | ---- | ------- | -----------

docs/configuration/legend.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ The chart legend displays data about the datasets that are appearing on the char
44

55
## Configuration options
66

7-
The legend configuration is passed into the `options.legend` namespace. The global options for the chart legend is defined in `Chart.defaults.global.legend`.
7+
The legend configuration is passed into the `options.legend` namespace. The global options for the chart legend is defined in `Chart.defaults.legend`.
88

99
| Name | Type | Default | Description
1010
| ---- | ---- | ------- | -----------
@@ -138,7 +138,7 @@ function(e, legendItem) {
138138
Lets say we wanted instead to link the display of the first two datasets. We could change the click handler accordingly.
139139

140140
```javascript
141-
var defaultLegendClickHandler = Chart.defaults.global.legend.onClick;
141+
var defaultLegendClickHandler = Chart.defaults.legend.onClick;
142142
var newLegendClickHandler = function (e, legendItem) {
143143
var index = legendItem.datasetIndex;
144144

docs/configuration/title.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
The chart title defines text to draw at the top of the chart.
44

55
## Title Configuration
6-
The title configuration is passed into the `options.title` namespace. The global options for the chart title is defined in `Chart.defaults.global.title`.
6+
The title configuration is passed into the `options.title` namespace. The global options for the chart title is defined in `Chart.defaults.title`.
77

88
| Name | Type | Default | Description
99
| ---- | ---- | ------- | -----------

docs/configuration/tooltip.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Tooltip Configuration
44

5-
The tooltip configuration is passed into the `options.tooltips` namespace. The global options for the chart tooltips is defined in `Chart.defaults.global.tooltips`.
5+
The tooltip configuration is passed into the `options.tooltips` namespace. The global options for the chart tooltips is defined in `Chart.defaults.tooltips`.
66

77
| Name | Type | Default | Description
88
| ---- | ---- | ------- | -----------

docs/developers/charts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Chart.defaults.derivedBubble = Chart.defaults.bubble;
8383

8484
// Sets the default dataset config for 'derivedBubble' to be the same as the bubble dataset defaults.
8585
// It looks like a bug exists when the dataset defaults don't exist
86-
Chart.defaults.global.datasets.derivedBubble = Chart.defaults.global.datasets.bubble;
86+
Chart.defaults.datasets.derivedBubble = Chart.defaults.datasets.bubble;
8787

8888
// I think the recommend using Chart.controllers.bubble.extend({ extensions here });
8989
var custom = Chart.controllers.bubble.extend({

0 commit comments

Comments
 (0)