```javascript
var myLineChart = new Chart(ctx, {
type: 'line',
- data: data,
+ data: data,
options: options
});
```
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
});
```
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,
-
- 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",
- }],
- }
-};
-```
+The default options for line chart are defined in `Chart.defaults.Line`.
+
+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.
```javascript
new Chart(ctx, {
type: 'line',
- data: data,
+ data: data,
options: {
xAxes: [{
show: false