From: Evert Timberg Date: Sat, 13 Mar 2021 17:49:09 +0000 (-0500) Subject: Rename scale `gridLines` options to be clearer (#8628) X-Git-Tag: v3.0.0-beta.14~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6ac89cbb252a6a0a383f2f85a332f3db87b6f3fc;p=thirdparty%2FChart.js.git Rename scale `gridLines` options to be clearer (#8628) * Rename `options.gridLines` to `options.grid` * Rename `offsetGridLines` to `offset` --- diff --git a/docs/docs/axes/_common.md b/docs/docs/axes/_common.md index 1e9ba6450..057b4988f 100644 --- a/docs/docs/axes/_common.md +++ b/docs/docs/axes/_common.md @@ -7,7 +7,7 @@ Namespace: `options.scales[scaleId]` | `type` | `string` | | Type of scale being employed. Custom scales can be created and registered with a string key. This allows changing the type of an axis for a chart. | `backgroundColor` | [`Color`](../general/colors.md) | | Background color of the scale area. | `display` | `boolean`\|`string` | `true` | Controls the axis global visibility (visible when `true`, hidden when `false`). When `display: 'auto'`, the axis is visible only if at least one associated dataset is visible. -| `gridLines` | `object` | | Grid line configuration. [more...](./styling.mdx#grid-line-configuration) +| `grid` | `object` | | Grid line configuration. [more...](./styling.mdx#grid-line-configuration) | `min` | `number` | | User defined minimum number for the scale, overrides minimum value from data. [more...](./index.mdx#axis-range-settings) | `max` | `number` | | User defined maximum number for the scale, overrides maximum value from data. [more...](./index.mdx#axis-range-settings) | `reverse` | `boolean` | `false` | Reverse the scale. diff --git a/docs/docs/axes/styling.mdx b/docs/docs/axes/styling.mdx index 6e6f479ca..e4f0bdf40 100644 --- a/docs/docs/axes/styling.mdx +++ b/docs/docs/axes/styling.mdx @@ -8,7 +8,7 @@ There are a number of options to allow styling an axis. There are settings to co ## Grid Line Configuration -Namespace: `options.scales[scaleId].gridLines`, it defines options for the grid lines that run perpendicular to the axis. +Namespace: `options.scales[scaleId].grid`, it defines options for the grid lines that run perpendicular to the axis. | Name | Type | Scriptable | Indexable | Default | Description | ---- | ---- | :-------------------------------: | :-----------------------------: | ------- | ----------- @@ -23,7 +23,7 @@ Namespace: `options.scales[scaleId].gridLines`, it defines options for the grid | `drawOnChartArea` | `boolean` | | | `true` | If true, draw lines on the chart area inside the axis lines. This is useful when there are multiple axes and you need to control which grid lines are drawn. | `drawTicks` | `boolean` | | | `true` | If true, draw lines beside the ticks in the axis area beside the chart. | `lineWidth` | `number` | Yes | Yes | `1` | Stroke width of grid lines. -| `offsetGridLines` | `boolean` | | | `false` | If true, grid lines will be shifted to be between labels. This is set to `true` for a bar chart by default. +| `offset` | `boolean` | | | `false` | If true, grid lines will be shifted to be between labels. This is set to `true` for a bar chart by default. | `tickBorderDash` | `number[]` | | | | Length and spacing of the tick mark line. If not set, defaults to the grid line `borderDash` value. | `tickBorderDashOffset` | `number` | Yes | Yes | | Offset for the line dash of the tick mark. If unset, defaults to the grid line `borderDashOffset` value | `tickColor` | [`Color`](../general/colors.md) | Yes | Yes | | Color of the tick line. If unset, defaults to the grid line color. diff --git a/docs/docs/charts/bar.mdx b/docs/docs/charts/bar.mdx index cce21feb2..555fe38e5 100644 --- a/docs/docs/charts/bar.mdx +++ b/docs/docs/charts/bar.mdx @@ -213,7 +213,7 @@ The bar chart sets unique default values for the following configuration from th | Name | Type | Default | Description | ---- | ---- | ------- | ----------- | `offset` | `boolean` | `true` | If true, extra space is added to both edges and the axis is scaled to fit into the chart area. -| `gridLines.offsetGridLines` | `boolean` | `true` | If true, the bars for a particular data point fall between the grid lines. The grid line will move to the left by one half of the tick interval. If false, the grid line will go right down the middle of the bars. [more...](#offsetgridlines) +| `grid.offset` | `boolean` | `true` | If true, the bars for a particular data point fall between the grid lines. The grid line will move to the left by one half of the tick interval. If false, the grid line will go right down the middle of the bars. [more...](#offsetgridlines) ### Example scale configuration @@ -221,15 +221,15 @@ The bar chart sets unique default values for the following configuration from th options = { scales: { x: { - gridLines: { - offsetGridLines: true + grid: { + offset: true } } } }; ``` -### offsetGridLines +### Offset Grid Lines If true, the bars for a particular data point fall between the grid lines. The grid line will move to the left by one half of the tick interval, which is the space between the grid lines. If false, the grid line will go right down the middle of the bars. This is set to true for a category scale in a bar chart while false for other scales or chart types by default. diff --git a/docs/docs/getting-started/v3-migration.md b/docs/docs/getting-started/v3-migration.md index e0fcc7d72..1a21a275b 100644 --- a/docs/docs/getting-started/v3-migration.md +++ b/docs/docs/getting-started/v3-migration.md @@ -229,7 +229,9 @@ Animation system was completely rewritten in Chart.js v3. Each property can now #### Ticks -* `options.gridLines.tickMarkLength` was renamed to `options.gridLines.tickLength`. +* `options.gridLines` was renamed to `options.grid` +* `options.gridLines.offsetGridLines` was renamed to `options.grid.offset`. +* `options.gridLines.tickMarkLength` was renamed to `options.grid.tickLength`. * `options.ticks.fixedStepSize` is no longer used. Use `options.ticks.stepSize`. * `options.ticks.major` and `options.ticks.minor` were replaced with scriptable options for tick fonts. * `Chart.Ticks.formatters.linear` was renamed to `Chart.Ticks.formatters.numeric`. diff --git a/samples/charts/bar/multi-axis.html b/samples/charts/bar/multi-axis.html index c73f6fe81..30672f5c8 100644 --- a/samples/charts/bar/multi-axis.html +++ b/samples/charts/bar/multi-axis.html @@ -86,7 +86,7 @@ type: 'linear', display: true, position: 'right', - gridLines: { + grid: { drawOnChartArea: false } }, diff --git a/samples/charts/line/multi-axis.html b/samples/charts/line/multi-axis.html index 52b05d5c0..66c12e8d6 100644 --- a/samples/charts/line/multi-axis.html +++ b/samples/charts/line/multi-axis.html @@ -84,7 +84,7 @@ position: 'right', // grid line settings - gridLines: { + grid: { drawOnChartArea: false, // only want the grid lines for one axis to show up }, }, diff --git a/samples/charts/scatter/multi-axis.html b/samples/charts/scatter/multi-axis.html index 0708b0188..63a031a61 100644 --- a/samples/charts/scatter/multi-axis.html +++ b/samples/charts/scatter/multi-axis.html @@ -125,7 +125,7 @@ } }, - gridLines: { + grid: { drawOnChartArea: false, // only want the grid lines for one axis to show up } } diff --git a/samples/scales/financial.html b/samples/scales/financial.html index 884753901..20a6a4371 100644 --- a/samples/scales/financial.html +++ b/samples/scales/financial.html @@ -173,7 +173,7 @@ }, y: { type: 'linear', - gridLines: { + grid: { drawBorder: false }, title: { diff --git a/samples/scales/gridlines-display.html b/samples/scales/gridlines-display.html index 15d2639a9..83bec9305 100644 --- a/samples/scales/gridlines-display.html +++ b/samples/scales/gridlines-display.html @@ -29,7 +29,7 @@