You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Remove Vue dependency and change extends
Signed-off-by: Jakub Juszczak <[email protected]>
* π Release new version 3.0.0-rc0
* β¬οΈ Update examples
* π Update README.md
* β¬οΈ Update examples
* β¬οΈ Update englishd docs
* β¬οΈ Update transalted docs with current code examples
* π₯ Remove dist files from gitignore
* β¬οΈ Update dependencies vue and chartjs
* Change private data
Implements apertureless#182. The private chart instance is now in the vue.js data model. And can be accessed over `this.$data._chart`
Updated unit tests
* π Update docs with private data
* β¨ Add codeclimate ignore
* β¬οΈ Update codeclimate
* β¬οΈ Update codeclimate
* β¬οΈ Update codeclimate
Add build and config folders to ignore
You can use `vue-chartjs` directly in the browser without any build setup. Like in this [codepen](https://codepen.io/apertureless/pen/vxWbqB?editors=1010). For this case, please use the `vue-chartjs.full.min.js` which is the minified version. It has Vue.js and Chart.js bundled into it. And bundled to a UMD Module. So you only need that one file.
61
+
You can use `vue-chartjs` directly in the browser without any build setup. Like in this [codepen](https://codepen.io/apertureless/pen/zEvvWM). For this case, please use the `vue-chartjs.full.min.js` which is the minified version. It has Chart.js bundled into it. And bundled to a UMD Module. So you only need that one file.
If you're using Gulp, Browserify or Webpack 1 the entry is `vue-chartjs.js` which is __transpiled__ and __bundled__ UMD Module.
68
87
69
-
However Vue.js and Chart.js are `peerDependencies` so you have to install them separately. In most projects you will have `Vue.js` already installed anyways. This way, you can have different versions of Vue.js and Chart.js then in this package.
88
+
However Chart.js is a `peerDependencies` so you have to install it separately. In most projects This way, you can have different versions of Chart.js then in this package.
70
89
71
90
### Webpack 2
72
91
If you're using Webpack 2 it will automatically use the `jsnext:main` / `module` entry point. Which is `es/index.js`
73
-
It is a __transpiled__ es version of the source. And is not __bundled__ to a module. This way you three shaking will work. Like in the bundled version, `Vue.js` and `Chart.js`are`peerDependencies` and need to be installed.
92
+
It is a __transpiled__ es version of the source. And is not __bundled__ to a module. This way you three shaking will work. Like in the bundled version, `Chart.js`is a`peerDependencies` and need to be installed.
74
93
75
94
76
95
## How to use
77
96
78
-
You need to import the base chart class and extend it. This gives much more flexibility when working with different data. You can pass the data over props or vue-resource.
97
+
You need to import the component and then either use `extends` or `mixins` and add it.
79
98
80
99
You can import the whole package or each module individual.
81
100
@@ -90,7 +109,8 @@ Just create your own component.
90
109
// CommitChart.js
91
110
import { Bar } from'vue-chartjs'
92
111
93
-
exportdefaultBar.extend({
112
+
exportdefault {
113
+
extends: Bar,
94
114
mounted () {
95
115
// Overwriting base render method with actual data.
96
116
this.renderChart({
@@ -104,7 +124,7 @@ export default Bar.extend({
104
124
]
105
125
})
106
126
}
107
-
})
127
+
}
108
128
```
109
129
110
130
Then simply import and use your own extended component and use it like a normal vue component
@@ -118,15 +138,16 @@ import CommitChart from 'path/to/component/CommitChart'
118
138
You can overwrite the default chart options. Just pass the options object as a second paramenter to the render method
119
139
120
140
```javascript
121
-
// MonthlyIncome.js
141
+
// MonthlyIncome.vue
122
142
import { Line } from'vue-chartjs'
123
143
124
-
exportdefaultLine.extend({
144
+
exportdefault {
145
+
extends: Line,
125
146
props: ['data', 'options'],
126
147
mounted () {
127
148
this.renderChart(this.data, this.options)
128
149
}
129
-
})
150
+
}
130
151
```
131
152
132
153
Use it in your vue app
@@ -163,13 +184,14 @@ However keep in mind the limitations of vue and javascript for mutations on arra
0 commit comments