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
@@ -24,12 +25,24 @@ Install the `zingchart-vue` package via npm
24
25
25
26
`npm install zingchart-vue`
26
27
28
+
## 2. Include the `zinchart` package in your project
29
+
30
+
The `zingchart` package is a **DIRECT** dependency of `zingchart-vue` but you can also update this package outside of this component. Meaning the wrapper is no longer tied to a ZingChart library version, but just the component itself.
31
+
32
+
You can import the library like so:
33
+
34
+
```javascript
35
+
// import the es6 version
36
+
import'zingchart/es6';
37
+
```
27
38
28
-
## 2. Include the component in your project
39
+
## 3. Include the component in your project
29
40
30
-
You can either include the `zingchart-vue` component to your project globally or locally per component. **DO NOT HAVE to import zingchart since it is a direct dependency of `zingchart-vue`**
41
+
You can either include the `zingchart-vue` component to your project globally or locally per component. **Import the component AFTER ZingChart since it is a DIRECT dependency.**
31
42
32
43
```js
44
+
// import the es6 version
45
+
import'zingchart/es6';
33
46
// import the component AFTER ZingChart since it is a DIRECT dependency
34
47
importzingchartVuefrom'zingchart-vue';
35
48
```
@@ -38,6 +51,24 @@ import zingchartVue from 'zingchart-vue';
38
51
39
52
In your main app file, add the following lines of code:
40
53
54
+
```js
55
+
importVuefrom'vue';
56
+
// import the es6 version
57
+
import'zingchart/es6';
58
+
importzingchartVuefrom'zingchart-vue';
59
+
60
+
// install globally to app
61
+
Vue.component('zingchart', zingchartVue)
62
+
```
63
+
64
+
This will register the zingchart component globally throughout your application. While the easiest installation option, this will load ZingChart immediately on your user's first load of the application - regardless if a chart is on the first page or not. We recommend this approach if ZingChart is used heavily across multiple pages.
65
+
66
+
67
+
68
+
### Globally and locally
69
+
70
+
You can also register the `zingChartVue` component globally and then import just `zingchart/es6` locally per each component that uses charts.
71
+
41
72
```js
42
73
importVuefrom'vue';
43
74
importzingchartVuefrom'zingchart-vue';
@@ -46,14 +77,20 @@ import zingchartVue from 'zingchart-vue';
46
77
Vue.component('zingchart', zingchartVue)
47
78
```
48
79
49
-
This will register the zingchart component globally throughout your application. While the easiest installation option, this will load ZingChart immediately on your user's first load of the application - regardless if a chart is on the first page or not. We reccomend this approach if ZingChart is used heavily across multiple pages.
80
+
Then inside the component you import the `zingchart/es6` library.
81
+
82
+
```js
83
+
import'zingchart/es6';
50
84
85
+
exportdefault {...}
86
+
```
51
87
52
88
### Locally per component
53
89
54
90
In each component where ZingChart is being used, include the following in your component's configuration:
55
91
56
92
```js
93
+
import'zingchart/es6';
57
94
importzingchartVuefrom'zingchart-vue';
58
95
59
96
{
@@ -74,10 +111,9 @@ ZingChart comes bundled with your common chart types such as line, column, pie,
74
111
For example, adding a depth chart to your vue component will require an additional import. Note, you must import from the `modules-es6` directory in the zingchart package.
zingchart.DEV.KEEPSOURCE=0; // prevents lib from storing the original data package
130
165
zingchart.DEV.COPYDATA=0; // prevents lib from creating a copy of the data package
131
166
132
167
// ZC object for license key
133
-
ZC.LICENSEKEY= ['abcdefghijklmnopqrstuvwxy'];
168
+
zingchart.LICENSE= ['abcdefghijklmnopqrstuvwxy'];
134
169
135
170
exportdefault {
136
171
components: {
@@ -139,6 +174,7 @@ export default {
139
174
}
140
175
```
141
176
177
+
142
178
## Usage
143
179
144
180
The `zingchart-vue` component can be included into template as an element. Below is a simple example of a line chart:
@@ -197,13 +233,12 @@ The configuration object to pass to the chart. This can be a `graphset` object (
197
233
198
234
### `series`[array] (optional)
199
235
200
-
Accepts an array of series objects, and overrides a series if it was supplied into the config object. Varies by chart type used - Refer to the ZingChart documentation for more details.
236
+
Accepts an array of series objects, and overrides a series if it was supplied into the config object. Varries by chart type used - Refer to the ZingChart documentation for more details.
201
237
202
238
### `id`[string] (optional)
203
239
204
240
The id for the DOM element for ZingChart to attach to. If no id is specified, the id will be autogenerated in the form of zingchart-auto-#
205
241
206
-
207
242
### `output`[string] (optional)
208
243
209
244
The render type of the chart. **The default is `svg`** but you can also pass the string `canvas` to render the charts in canvas.
0 commit comments