Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 13 additions & 16 deletions docs/data/charts/axis/axis.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,25 @@ That's why in most of the demos with single x and y axis you will not see defini
Those demos use the defaultized values.
:::

### Axis type
### Axis type and data

The axis type is specified by its property `scaleType` which expect one of the following values:
The axis type is specified by its property `scaleType`.
Axis definition object has a `data` property which expects an array of value coherent with the `scaleType`, as shown in the table below:

- `'band'`: Split the axis in equal band. Mostly used for bar charts.
- `'point'`: Split the axis in equally spaced points. Mostly used for line charts on categories.
- `'linear'`, `'log'`, `'sqrt'`: Map numerical values to the space available for the chart. `'linear'` is the default behavior.
- `'time'`, `'utc'`: Map JavaScript `Date()` object to the space available for the chart.

### Axis data

The axis definition object also includes a `data` property.
Which expects an array of value coherent with the `scaleType`:

- For `'linear'`, `'log'`, or `'sqrt'` it should contain numerical values
- For `'time'` or `'utc'` it should contain `Date()` objects
- For `'band'` or `'point'` it can contain `string`, or numerical values
| `scaleType` | Description | Common usage | Expected array data type |
|:------------|:------------|:-------------|:------------------------|
| `'band'` | Split the axis in equal bands | Bar charts, categorical data | String or numerical values |
| `'point'` | Split the axis in equally spaced points | Line charts on categories | String or numerical values |
| `'linear'` | Map numerical values linearly to the available space | Standard numerical data | Numerical values |
| `'log'` | Map numerical values using logarithmic scale | Data with large range | Numerical values |
| `'sqrt'` | Map numerical values using square root scale | Data that needs variance stabilization | Numerical values |
| `'time'` | Map JavaScript `Date()` objects to the available space | Time series data | JavaScript `Date()` objects |
| `'utc'` | Map JavaScript `Date()` objects in UTC to the available space | Time series data in UTC | JavaScript `Date()` objects |

Some series types also require specific axis attributes:

- line plots require an `xAxis` to have `data` provided
- bar plots require an `xAxis` with `scaleType="band"` and some `data` provided.
- bar plots require an `xAxis` with `scaleType='band'` and some `data` provided.

### Axis formatter

Expand Down
Loading