mirror of
https://github.com/chartjs/Chart.js.git
synced 2026-03-20 23:26:53 +01:00
Update line chart documentation options to table.
This commit is contained in:
@@ -15,7 +15,7 @@ Often, it is used to show trend data, and the comparison of two data sets.
|
||||
```javascript
|
||||
var myLineChart = new Chart(ctx, {
|
||||
type: 'line',
|
||||
data: data,
|
||||
data: data,
|
||||
options: options
|
||||
});
|
||||
```
|
||||
@@ -23,7 +23,7 @@ var myLineChart = new Chart(ctx, {
|
||||
Alternatively a line chart can be created using syntax similar to the v1.0 syntax
|
||||
```javascript
|
||||
var myLineChart = Chart.Line(ctx, {
|
||||
data: data,
|
||||
data: data,
|
||||
options: options
|
||||
});
|
||||
```
|
||||
@@ -113,37 +113,22 @@ The label key on each dataset is optional, and can be used when generating a sca
|
||||
|
||||
These are the customisation options specific to Line charts. These options are merged with the [global chart configuration options](#getting-started-global-chart-configuration), and form the options of the chart.
|
||||
|
||||
```javascript
|
||||
{
|
||||
// Boolean - if true, line stack on top of each other along the y axis
|
||||
stacked: false,
|
||||
The default options for line chart are defined in `Chart.defaults.Line`.
|
||||
|
||||
hover: {
|
||||
// String - We use a label hover mode since the x axis displays data by the index in the dataset
|
||||
mode: "label"
|
||||
},
|
||||
|
||||
scales: {
|
||||
// Defines all of the x axes used in the chart. See the [scale documentation](#getting-started-scales) for details on the available options
|
||||
xAxes: [{
|
||||
// String - type of scale. Built in types are 'category' and 'linear'
|
||||
type: 'category',
|
||||
|
||||
// String - id of the axis so that data can bind to it
|
||||
id: "x-axis-1", // need an ID so datasets can reference the scale
|
||||
}],
|
||||
|
||||
// Defines all of the y axes used in the chart.
|
||||
// By default, the line chart uses a linear scale along the y axis
|
||||
yAxes: [{
|
||||
type: 'linear',
|
||||
|
||||
// String - ID of the axis for data binding
|
||||
id: "y-axis-1",
|
||||
}],
|
||||
}
|
||||
};
|
||||
```
|
||||
Name | Type | Default | Description
|
||||
--- | --- | --- | ---
|
||||
stacked | Boolean | false | If true, lines stack on top of each other along the y axis.
|
||||
*hover*.mode | String | "label" | Label's hover mode. "label" is used since the x axis displays data by the index in the dataset.
|
||||
scales | - | - | -
|
||||
*scales*.xAxes | Array | `[{type:"category","id":"x-axis-1"}]` | Defines all of the x axes used in the chart. See the [scale documentation](#getting-started-scales) for details on the available options.
|
||||
*Options for xAxes* | | |
|
||||
type | String | "category" | Type of scale. Built in types are 'category' and 'linear'.
|
||||
id | String | "x-axis-1" | Id of the axis so that data can bind to it.
|
||||
| | |
|
||||
*scales*.yAxes | Array | `[{type:"linear","id":"y-axis-1"}]` | Defines all of the x axes used in the chart. See the [scale documentation](#getting-started-scales) for details on the available options.
|
||||
*Options for yAxes* | | |
|
||||
type | String | "linear" | Type of scale. Built in types are 'category' and 'linear'.
|
||||
id | String | "y-axis-1" | Id of the axis so that data can bind to it.
|
||||
|
||||
You can override these for your `Chart` instance by passing a member `options` into the `Line` method.
|
||||
|
||||
@@ -152,7 +137,7 @@ For example, we could have a line chart display without an x axis by doing the f
|
||||
```javascript
|
||||
new Chart(ctx, {
|
||||
type: 'line',
|
||||
data: data,
|
||||
data: data,
|
||||
options: {
|
||||
xAxes: [{
|
||||
show: false
|
||||
|
||||
Reference in New Issue
Block a user