diff --git a/docs/charts/line.md b/docs/charts/line.md
index ac141b2e117..77fc1356e3e 100644
--- a/docs/charts/line.md
+++ b/docs/charts/line.md
@@ -166,7 +166,7 @@ If the `steppedLine` value is set to anything other than false, `lineTension` wi
## Configuration Options
-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.
+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.
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
diff --git a/docs/charts/radar.md b/docs/charts/radar.md
index 6b33533047b..67c56065794 100644
--- a/docs/charts/radar.md
+++ b/docs/charts/radar.md
@@ -155,7 +155,7 @@ The interaction with each point can be controlled with the following properties:
## Configuration Options
-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.
+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.
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
diff --git a/docs/configuration/README.md b/docs/configuration/README.md
index 9139d5f88e1..d9152d9f4ef 100644
--- a/docs/configuration/README.md
+++ b/docs/configuration/README.md
@@ -6,12 +6,12 @@ The configuration is used to change how the chart behaves. There are properties
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.
-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.
+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.
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.
```javascript
-Chart.defaults.global.hover.mode = 'nearest';
+Chart.defaults.hover.mode = 'nearest';
// Hover mode is set to nearest because it was not overridden here
var chartHoverModeNearest = new Chart(ctx, {
@@ -38,7 +38,7 @@ Options may be configured directly on the dataset. The dataset options can be ch
- per dataset: dataset.*
- per chart: options.datasets[type].*
-- or globally: Chart.defaults.global.datasets[type].*
+- or globally: Chart.defaults.datasets[type].*
where type corresponds to the dataset type.
@@ -48,7 +48,7 @@ The following example would set the `showLine` option to 'false' for all line da
```javascript
// Do not show lines for all datasets by default
-Chart.defaults.global.datasets.line.showLine = false;
+Chart.defaults.datasets.line.showLine = false;
// This chart would show a line only for the third dataset
var chart = new Chart(ctx, {
diff --git a/docs/configuration/animations.md b/docs/configuration/animations.md
index 89e40ed9cd7..d642fb3de10 100644
--- a/docs/configuration/animations.md
+++ b/docs/configuration/animations.md
@@ -4,7 +4,7 @@ Chart.js animates charts out of the box. A number of options are provided to con
## Animation Configuration
-The following animation options are available. The global options for are defined in `Chart.defaults.global.animation`.
+The following animation options are available. The global options for are defined in `Chart.defaults.animation`.
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
diff --git a/docs/configuration/elements.md b/docs/configuration/elements.md
index a74e74376ad..8f0c0e7d814 100644
--- a/docs/configuration/elements.md
+++ b/docs/configuration/elements.md
@@ -4,16 +4,16 @@ While chart types provide settings to configure the styling of each dataset, you
## Global Configuration
-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:
+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:
```javascript
-Chart.defaults.global.elements.rectangle.borderWidth = 2;
+Chart.defaults.elements.rectangle.borderWidth = 2;
```
## Point Configuration
Point elements are used to represent the points in a line, radar or bubble chart.
-Global point options: `Chart.defaults.global.elements.point`.
+Global point options: `Chart.defaults.elements.point`.
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
@@ -46,7 +46,7 @@ If the value is an image, that image is drawn on the canvas using [drawImage](ht
## Line Configuration
Line elements are used to represent the line in a line chart.
-Global line options: `Chart.defaults.global.elements.line`.
+Global line options: `Chart.defaults.elements.line`.
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
@@ -59,14 +59,14 @@ Global line options: `Chart.defaults.global.elements.line`.
| `borderDashOffset` | `number` | `0.0` | Line dash offset. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineDashOffset).
| `borderJoinStyle` | `string` | `'miter'` | Line join style. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin).
| `capBezierPoints` | `boolean` | `true` | `true` to keep Bézier control inside the chart, `false` for no restriction.
-| `cubicInterpolationMode` | `string` | `'default'` | Interpolation mode to apply. [See more...](../charts/line.md#cubicinterpolationmode)
+| `cubicInterpolationMode` | `string` | `'default'` | Interpolation mode to apply. [See more...](../charts/line.md#cubicinterpolationmode)
| `fill` | boolean|string
| `true` | How to fill the area under the line. See [area charts](../charts/area.md#filling-modes).
| `stepped` | `boolean` | `false` | `true` to show the line as a stepped line (`tension` will be ignored).
## Rectangle Configuration
Rectangle elements are used to represent the bars in a bar chart.
-Global rectangle options: `Chart.defaults.global.elements.rectangle`.
+Global rectangle options: `Chart.defaults.elements.rectangle`.
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
@@ -78,7 +78,7 @@ Global rectangle options: `Chart.defaults.global.elements.rectangle`.
## Arc Configuration
Arcs are used in the polar area, doughnut and pie charts.
-Global arc options: `Chart.defaults.global.elements.arc`.
+Global arc options: `Chart.defaults.elements.arc`.
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
diff --git a/docs/configuration/layout.md b/docs/configuration/layout.md
index 375a480702f..80c2dfed3b1 100644
--- a/docs/configuration/layout.md
+++ b/docs/configuration/layout.md
@@ -1,6 +1,6 @@
# Layout Configuration
-The layout configuration is passed into the `options.layout` namespace. The global options for the chart layout is defined in `Chart.defaults.global.layout`.
+The layout configuration is passed into the `options.layout` namespace. The global options for the chart layout is defined in `Chart.defaults.layout`.
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
diff --git a/docs/configuration/legend.md b/docs/configuration/legend.md
index a61943275d2..35c75b2465f 100644
--- a/docs/configuration/legend.md
+++ b/docs/configuration/legend.md
@@ -4,7 +4,7 @@ The chart legend displays data about the datasets that are appearing on the char
## Configuration options
-The legend configuration is passed into the `options.legend` namespace. The global options for the chart legend is defined in `Chart.defaults.global.legend`.
+The legend configuration is passed into the `options.legend` namespace. The global options for the chart legend is defined in `Chart.defaults.legend`.
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
@@ -138,7 +138,7 @@ function(e, legendItem) {
Lets say we wanted instead to link the display of the first two datasets. We could change the click handler accordingly.
```javascript
-var defaultLegendClickHandler = Chart.defaults.global.legend.onClick;
+var defaultLegendClickHandler = Chart.defaults.legend.onClick;
var newLegendClickHandler = function (e, legendItem) {
var index = legendItem.datasetIndex;
diff --git a/docs/configuration/title.md b/docs/configuration/title.md
index faf722ce011..f072cb6674b 100644
--- a/docs/configuration/title.md
+++ b/docs/configuration/title.md
@@ -3,7 +3,7 @@
The chart title defines text to draw at the top of the chart.
## Title Configuration
-The title configuration is passed into the `options.title` namespace. The global options for the chart title is defined in `Chart.defaults.global.title`.
+The title configuration is passed into the `options.title` namespace. The global options for the chart title is defined in `Chart.defaults.title`.
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
diff --git a/docs/configuration/tooltip.md b/docs/configuration/tooltip.md
index 6e086a16716..7c662b2883c 100644
--- a/docs/configuration/tooltip.md
+++ b/docs/configuration/tooltip.md
@@ -2,7 +2,7 @@
## Tooltip Configuration
-The tooltip configuration is passed into the `options.tooltips` namespace. The global options for the chart tooltips is defined in `Chart.defaults.global.tooltips`.
+The tooltip configuration is passed into the `options.tooltips` namespace. The global options for the chart tooltips is defined in `Chart.defaults.tooltips`.
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
diff --git a/docs/developers/charts.md b/docs/developers/charts.md
index c96350373db..99c11f89407 100644
--- a/docs/developers/charts.md
+++ b/docs/developers/charts.md
@@ -83,7 +83,7 @@ Chart.defaults.derivedBubble = Chart.defaults.bubble;
// Sets the default dataset config for 'derivedBubble' to be the same as the bubble dataset defaults.
// It looks like a bug exists when the dataset defaults don't exist
-Chart.defaults.global.datasets.derivedBubble = Chart.defaults.global.datasets.bubble;
+Chart.defaults.datasets.derivedBubble = Chart.defaults.datasets.bubble;
// I think the recommend using Chart.controllers.bubble.extend({ extensions here });
var custom = Chart.controllers.bubble.extend({
diff --git a/docs/general/colors.md b/docs/general/colors.md
index 12d700d7d49..f86e4745f0b 100644
--- a/docs/general/colors.md
+++ b/docs/general/colors.md
@@ -1,6 +1,6 @@
# Colors
-When supplying colors to Chart options, you can use a number of formats. You can specify the color as a string in hexadecimal, RGB, or HSL notations. If a color is needed, but not specified, Chart.js will use the global default color. This color is stored at `Chart.defaults.global.defaultColor`. It is initially set to `'rgba(0, 0, 0, 0.1)'`.
+When supplying colors to Chart options, you can use a number of formats. You can specify the color as a string in hexadecimal, RGB, or HSL notations. If a color is needed, but not specified, Chart.js will use the global default color. This color is stored at `Chart.defaults.color`. It is initially set to `'rgba(0, 0, 0, 0.1)'`.
You can also pass a [CanvasGradient](https://developer.mozilla.org/en-US/docs/Web/API/CanvasGradient) object. You will need to create this before passing to the chart, but using it you can achieve some interesting effects.
diff --git a/docs/general/fonts.md b/docs/general/fonts.md
index a476ca894a2..608e377a846 100644
--- a/docs/general/fonts.md
+++ b/docs/general/fonts.md
@@ -1,11 +1,11 @@
# Fonts
-There are 4 special global settings that can change all of the fonts on the chart. These options are in `Chart.defaults.global`. The global font settings only apply when more specific options are not included in the config.
+There are 4 special global settings that can change all of the fonts on the chart. These options are in `Chart.defaults`. The global font settings only apply when more specific options are not included in the config.
For example, in this chart the text will all be red except for the labels in the legend.
```javascript
-Chart.defaults.global.defaultFontColor = 'red';
+Chart.defaults.fontColor = 'red';
let chart = new Chart(ctx, {
type: 'line',
data: data,
@@ -22,10 +22,10 @@ let chart = new Chart(ctx, {
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
-| `defaultFontColor` | `Color` | `'#666'` | Default font color for all text.
-| `defaultFontFamily` | `string` | `"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif"` | Default font family for all text.
-| `defaultFontSize` | `number` | `12` | Default font size (in px) for text. Does not apply to radialLinear scale point labels.
-| `defaultFontStyle` | `string` | `'normal'` | Default font style. Does not apply to tooltip title or footer. Does not apply to chart title.
+| `fontColor` | `Color` | `'#666'` | Default font color for all text.
+| `fontFamily` | `string` | `"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif"` | Default font family for all text.
+| `fontSize` | `number` | `12` | Default font size (in px) for text. Does not apply to radialLinear scale point labels.
+| `fontStyle` | `string` | `'normal'` | Default font style. Does not apply to tooltip title or footer. Does not apply to chart title.
## Missing Fonts
diff --git a/docs/general/interactions/README.md b/docs/general/interactions/README.md
index be5ec8e239d..3f306953953 100644
--- a/docs/general/interactions/README.md
+++ b/docs/general/interactions/README.md
@@ -1,6 +1,6 @@
# Interactions
-The hover configuration is passed into the `options.hover` namespace. The global hover configuration is at `Chart.defaults.global.hover`. To configure which events trigger chart interactions, see [events](./events.md#events).
+The hover configuration is passed into the `options.hover` namespace. The global hover configuration is at `Chart.defaults.hover`. To configure which events trigger chart interactions, see [events](./events.md#events).
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
diff --git a/docs/getting-started/v3-migration.md b/docs/getting-started/v3-migration.md
index db9d5e03ff8..cf838818339 100644
--- a/docs/getting-started/v3-migration.md
+++ b/docs/getting-started/v3-migration.md
@@ -30,6 +30,17 @@ Chart.js 3.0 introduces a number of breaking changes. Chart.js 2.0 was released
* The `hover` property of scriptable options `context` object was renamed to `active` to align it with the datalabels plugin.
* The `zeroLine*` options of axes were removed. Use scriptable scale options instead.
+## Defaults
+
+* `global` namespace was removed from `defaults`. So `Chart.defaults.global` is now `Chart.defaults`
+* `default` prefix was removed from defaults. For example `Chart.defaults.global.defaultColor` is now `Chart.defaults.color`
+ * `defaultColor` was renamed to `color`
+ * `defaultFontColor` was renamed to `fontColor`
+ * `defaultFontFamily` was renamed to `fontFamily`
+ * `defaultFontSize` was renamed to `fontSize`
+ * `defaultFontStyle` was renamed to `fontStyle`
+ * `defaultLineHeight` was renamed to `lineHeight`
+
### Options
* `scales.[x/y]Axes` arrays were removed. Scales are now configured directly to `options.scales` object with the object key being the scale Id.
diff --git a/samples/animations/loop.html b/samples/animations/loop.html
index 15d743a85d3..3090aa05e19 100644
--- a/samples/animations/loop.html
+++ b/samples/animations/loop.html
@@ -71,7 +71,7 @@
}
};
}
- return Chart.defaults.global.animation;
+ return Chart.defaults.animation;
},
elements: {
point: {
diff --git a/samples/tooltips/custom-line.html b/samples/tooltips/custom-line.html
index 0c01179f711..c76226a2332 100644
--- a/samples/tooltips/custom-line.html
+++ b/samples/tooltips/custom-line.html
@@ -38,7 +38,7 @@