Skip to content
This repository was archived by the owner on Dec 15, 2024. It is now read-only.

Commit 65bee5f

Browse files
Adding type value and fix options value
1 parent 3d8ad1c commit 65bee5f

2 files changed

Lines changed: 18 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [2.1.0] - 2020-12-23
10+
11+
### Changed
12+
13+
- Add `type` value. `line` by default.
14+
15+
### Fixed
16+
17+
- Fix `options` value.
18+
919
## [2.0.0] - 2020-12-05
1020

1121
### Added

src/index.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,21 @@ import Chart from 'chart.js'
44
export default class extends Controller {
55
static targets = ['canvas']
66
static values = {
7+
type: String,
78
data: Object,
89
options: Object
910
}
1011

1112
connect () {
1213
const element = this.hasCanvasTarget ? this.canvasTarget : this.element
1314

14-
this.chart = new Chart(element.getContext('2d'), this.chartData, {
15-
...this.optionsValue,
16-
...this.defaultOptions
15+
this.chart = new Chart(element.getContext('2d'), {
16+
type: this.typeValue || 'line',
17+
data: this.chartData,
18+
options: {
19+
...this.defaultOptions,
20+
...this.optionsValue
21+
}
1722
})
1823
}
1924

0 commit comments

Comments
 (0)