mirror of
https://github.com/chartjs/Chart.js.git
synced 2025-12-08 20:36:08 +00:00
Align axes documentation with the changes (#7624)
This commit is contained in:
parent
572b1c737e
commit
74ef7d5718
@ -37,15 +37,15 @@ let chart = new Chart(ctx, {
|
||||
});
|
||||
```
|
||||
|
||||
## Tick Configuration Options
|
||||
## Configuration Options
|
||||
|
||||
The category scale provides the following options for configuring tick marks. They are nested in the `ticks` sub object. These options extend the [common tick configuration](index.md#tick-configuration).
|
||||
These options extend the [common configuration for all cartesian axes](index.md#configuration-options).
|
||||
|
||||
| Name | Type | Default | Description
|
||||
| ---- | ---- | ------- | -----------
|
||||
| Name | Type | Description
|
||||
| ---- | ---- | -----------
|
||||
| `min` | `string`\|`number` | | The minimum item to display. [more...](#min-max-configuration)
|
||||
| `max` | `string`\|`number` | | The maximum item to display. [more...](#min-max-configuration)
|
||||
| `labels` | `string[]` | - | An array of labels to display.
|
||||
| `min` | <code>string|number</code> | | The minimum item to display. [more...](#min-max-configuration)
|
||||
| `max` | <code>string|number</code> | | The maximum item to display. [more...](#min-max-configuration)
|
||||
|
||||
## Min Max Configuration
|
||||
|
||||
|
||||
@ -18,6 +18,8 @@ All of the included cartesian axes support a number of common options. These opt
|
||||
| `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.
|
||||
| `position` | `string` | | Position of the axis. [more...](#axis-position)
|
||||
| `axis` | `string` | | Which type of axis this is. Possible values are: `'x'`, `'y'`. If not set, this is inferred from the first character of the ID which should be `'x'` or `'y'`.
|
||||
| `min` | `number` | | User defined minimum value for the scale, overrides minimum value from data.
|
||||
| `max` | `number` | | User defined maximum value for the scale, overrides maximum value from data.
|
||||
| `offset` | `boolean` | `false` | If true, extra space is added to the both edges and the axis is scaled to fit into the chart area. This is set to `true` for a bar chart by default.
|
||||
| `gridLines` | `object` | | Grid line configuration. [more...](../styling.md#grid-line-configuration)
|
||||
| `scaleLabel` | `object` | | Scale title configuration. [more...](../labelling.md#scale-title-configuration)
|
||||
@ -45,8 +47,6 @@ The following options are common to all cartesian axes but do not apply to other
|
||||
|
||||
| Name | Type | Default | Description
|
||||
| ---- | ---- | ------- | -----------
|
||||
| `min` | `number` | | User defined minimum value for the scale, overrides minimum value from data.
|
||||
| `max` | `number` | | User defined maximum value for the scale, overrides maximum value from data.
|
||||
| `sampleSize` | `number` | `ticks.length` | The number of ticks to examine when deciding how many labels will fit. Setting a smaller value will be faster, but may be less accurate when there is large variability in label length.
|
||||
| `autoSkip` | `boolean` | `true` | If true, automatically calculates how many labels can be shown and hides labels accordingly. Labels will be rotated up to `maxRotation` before skipping any. Turn `autoSkip` off to show all labels no matter what.
|
||||
| `autoSkipPadding` | `number` | `0` | Padding between the ticks on the horizontal axis when `autoSkip` is enabled.
|
||||
|
||||
@ -29,7 +29,7 @@ The following options are provided by the time scale. You may also set options p
|
||||
| `ticks.source` | `string` | `'auto'` | How ticks are generated. [more...](#ticks-source)
|
||||
| `time.displayFormats` | `object` | | Sets how different time units are displayed. [more...](#display-formats)
|
||||
| `time.isoWeekday` | `boolean` | `false` | If true and the unit is set to 'week', then the first day of the week will be Monday. Otherwise, it will be Sunday.
|
||||
| `time.parser` | <code>string|function</code> | | Custom parser for dates. [more...](#parser)
|
||||
| `time.parser` | `string`\|`function` | | Custom parser for dates. [more...](#parser)
|
||||
| `time.round` | `string` | `false` | If defined, dates will be rounded to the start of this unit. See [Time Units](#time-units) below for the allowed units.
|
||||
| `time.tooltipFormat` | `string` | | The format string to use for the tooltip.
|
||||
| `time.unit` | `string` | `false` | If defined, will force the unit to be a certain type. See [Time Units](#time-units) section below for details.
|
||||
@ -85,7 +85,7 @@ You may specify a map of display formats with a key for each unit:
|
||||
|
||||
The format string used as a value depends on the date adapter you chose to use.
|
||||
|
||||
For example, to set the display format for the `quarter` unit to show the month and year, the following config might be passed to the chart constructor.
|
||||
For example, to set the display format for the `quarter` unit to show the month and year, the following config might be passed to the chart constructor.
|
||||
|
||||
```javascript
|
||||
var chart = new Chart(ctx, {
|
||||
|
||||
@ -20,6 +20,7 @@ The following options are common to all axes provided by Chart.js.
|
||||
| Name | Type | Default | Description
|
||||
| ---- | ---- | ------- | -----------
|
||||
| `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.
|
||||
| `reverse` | `boolean` | `false` | Reverse the scale.
|
||||
| `weight` | `number` | `0` | The weight used to sort the axis. Higher weights are further away from the chart area.
|
||||
|
||||
### Callbacks
|
||||
|
||||
@ -47,7 +47,6 @@ The tick configuration is nested under the scale configuration in the `ticks` ke
|
||||
| `font` | `Font` | Yes | `defaults.font` | See [Fonts](../general/fonts.md)
|
||||
| `major` | `object` | | `{}` | [Major ticks configuration](#major-tick-configuration).
|
||||
| `padding` | `number` | | `0` | Sets the offset of the tick labels from the axis
|
||||
| `reverse` | `boolean` | | `false` | Reverses order of tick labels.
|
||||
| `z` | `number` | | `0` | z-index of tick layer. Useful when ticks are drawn on chart area. Values <= 0 are drawn under datasets, > 0 on top.
|
||||
|
||||
The scriptable context is the same as for the [Grid Line Configuration](#grid-line-configuration).
|
||||
@ -59,4 +58,3 @@ The majorTick configuration is nested under the ticks configuration in the `majo
|
||||
| Name | Type | Default | Description
|
||||
| ---- | ---- | ------- | -----------
|
||||
| `enabled` | `boolean` | `false` | If true, major ticks are generated. A major tick will affect autoskipping and `major` will be defined on ticks in the scriptable options context.
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user