1
- # Vue-FusionCharts
2
1
3
- > FusionCharts component for Vue
2
+ #### [ Demos and Documentation] ( https://fusioncharts.github.io/vue-fusioncharts/ )
3
+
4
+ # Vue-FusionCharts
4
5
5
- The Vue-FusionCharts component lets you easily include FusionCharts in your Vue.js projects.
6
+ A simple and lightweight ` VueJS ` component for ` FusionCharts ` JavaScript Charting Library. The ` Vue-FusionCharts ` wrapper lets you easily include FusionCharts in your ` VueJS ` projects.
6
7
7
8
## Installation
8
9
@@ -18,17 +19,17 @@ npm install vue-fusioncharts --save
18
19
yarn add vue-fusioncharts
19
20
```
20
21
21
- ### manual
22
+ ### VanillaJS
22
23
23
- Download [ ` vue-fusioncharts.js ` ] ( https://github .com/fusioncharts/vue-fusioncharts/blob/feature/plugin-development /dist/vue-fusioncharts.js ) and include it in the HTML ` <script> ` tag.
24
+ Download [ ` vue-fusioncharts.js ` ] ( https://rawgit .com/fusioncharts/vue-fusioncharts/master /dist/vue-fusioncharts.js ) and include it in the HTML ` <script> ` tag.
24
25
25
26
``` html
26
- <script src =' path/to/vue-fusioncharts/dist/ vue-fusioncharts.js' type =' text/javascript' ></script >
27
+ <script src =' vue-fusioncharts.js' type =' text/javascript' ></script >
27
28
```
28
29
29
- ## Usage
30
+ ## Getting Started
30
31
31
- ### ES6 Modules (Recommended)
32
+ ### ES6 Module
32
33
33
34
``` js
34
35
import Vue from ' vue' ;
@@ -39,22 +40,21 @@ import FusionCharts from 'fusioncharts'
39
40
import Charts from ' fusioncharts/fusioncharts.charts'
40
41
41
42
// resolve charts dependency
42
- Chart (FusionCharts);
43
+ Charts (FusionCharts);
43
44
44
45
// register VueFusionCharts component
45
46
Vue .use (VueFusionCharts, FusionCharts);
46
47
```
47
48
48
- ### CommonJS Modules
49
+ ### CommonJS
49
50
50
51
``` js
51
- var Vue = require (' vue' );
52
-
53
- var VueFusionCharts = require (' vue-fusioncharts' );
52
+ const Vue = require (' vue' );
53
+ const VueFusionCharts = require (' vue-fusioncharts' );
54
54
55
55
// import FusionCharts modules and resolve dependency
56
- var FusionCharts = require (' fusioncharts' );
57
- var Charts = require (' fusioncharts/fusioncharts.charts' );
56
+ const FusionCharts = require (' fusioncharts' );
57
+ const Charts = require (' fusioncharts/fusioncharts.charts' );
58
58
59
59
// resolve charts dependency
60
60
Charts (FusionCharts);
@@ -63,7 +63,6 @@ Charts(FusionCharts);
63
63
Vue .use (VueFusionCharts, FusionCharts);
64
64
```
65
65
66
-
67
66
### AMD
68
67
69
68
``` js
@@ -83,9 +82,9 @@ require(['vue', 'vue-fusioncharts', 'fusioncharts', 'charts'], function (Vue, Vu
83
82
});
84
83
```
85
84
86
- ### Standalone / CDN
87
- If you are not using any bundler, you can refer the file in a script tag. The library will be available in a global object named ` VueFusionCharts ` .
85
+ ### VanillaJS
88
86
87
+ If you are not using any bundler, you can refer the file in a script tag. The library will be available in a global object named ` VueFusionCharts ` .
89
88
90
89
``` html
91
90
<head >
@@ -96,77 +95,78 @@ If you are not using any bundler, you can refer the file in a script tag. The li
96
95
</head >
97
96
98
97
<body >
99
- <div id =' chart' >
100
- <fusioncharts :options =" pieChartConfig" ></fusioncharts >
101
- <p class =" message-box" >The value that you have selected is: {{displayValue}} </p >
98
+
99
+ <div id =" app" >
100
+ <fusioncharts
101
+ :type =" type"
102
+ :width =" width"
103
+ :height =" height"
104
+ :dataFormat =" dataFormat"
105
+ :dataSource =" dataSource"
106
+ :events =" events" >
107
+ </fusioncharts >
108
+ <p >Display Value: {{displayValue}}</p >
102
109
</div >
103
110
104
- <style >
105
- .message-box {
106
- text-align : center ;
107
- margin-top : 0px ;
108
- background-color : #F5FBFF ;
109
- width : 500px ;
110
- color : #006BB8 ;
111
- padding : 5px 10px ;
112
- box-sizing : border-box ;
113
- border : 1px solid #B8E1FF ;
114
- }
115
- </style >
116
-
117
111
<script >
118
- // Use VueFusionCharts component by calling the Vue.use() global method:
112
+ // Use VueFusionCharts component by calling the Vue.use() method:
119
113
Vue .use (VueFusionCharts);
120
114
115
+ const myDataSource = {
116
+ chart: {
117
+ caption: ' Vue FusionCharts Sample' ,
118
+ theme: ' fint'
119
+ }
120
+ data: [{value: 1.9 }, {value: 2.3 }, {value: 2.1 }]
121
+ }
121
122
// bootstrap the demo
122
- var chart = new Vue ({
123
+ var app = new Vue ({
123
124
el: ' #chart' ,
124
125
data: {
125
- pieChartConfig: {
126
126
type: ' Pie2D' ,
127
127
width: ' 500' ,
128
128
height: ' 300' ,
129
129
dataFormat: ' json' ,
130
- dataSource: {
131
- chart: {
132
- caption: ' Vue FusionCharts Sample' ,
133
- theme: ' fint'
134
- },
135
- data: [{value: 1.9 }, {value: 2.3 }, {value: 2.1 }]
136
- },
137
- displayValue: ' nothing' ,
130
+ dataSource: myDataSource,
138
131
events: {
139
132
dataplotRollover : function (ev , props ) {
140
- chart .displayValue = props .displayValue
133
+ app .displayValue = props .displayValue
141
134
}
142
- }
143
- },
144
- displayValue : ' nothing '
135
+ },
136
+ displayValue : ' '
137
+ }
145
138
}
146
139
});
147
140
</script >
148
141
</body >
149
142
```
150
143
Click [ here] ( https://jsfiddle.net/rohitcoolblog/5Lt720a9/ ) to view the live example.
151
144
152
- ## Register ` vue-fusioncharts ` component
153
- ### Use the ` Vue.use ` global method to register the component globally
145
+ ## Register ` vue-fusioncharts ` Component
146
+
147
+ ### Register Globally
148
+
149
+ Use the ` Vue.use ` method to register the component globally.
150
+
154
151
``` js
155
152
Vue .use (VueFusionCharts, FusionCharts, Charts);
156
153
```
157
- ### Use the ` Vue.component ` method to register the component locally
154
+
155
+ ### Register Locally
156
+
157
+ Use the ` Vue.component ` method to register the component locally.
158
+
158
159
``` js
159
160
// es6 style
160
- import {FCComponent } from ' vue-fusioncharts'
161
+ import { FCComponent } from ' vue-fusioncharts'
161
162
162
163
// CommpnJS
163
- var FCComponent = require (' vue-fusioncharts' ).FCComponent ;
164
+ const FCComponent = require (' vue-fusioncharts' ).FCComponent ;
164
165
165
166
Vue .component (' fusioncharts' , FCComponent);
166
-
167
167
```
168
168
169
- ### props
169
+ ### Component Props
170
170
171
171
* ` options `
172
172
@@ -221,11 +221,10 @@ Vue.component('fusioncharts', FCComponent);
221
221
</tbody>
222
222
</table >
223
223
224
+ ## Contributing
224
225
225
-
226
- ## Development
227
226
* Clone the repository.
228
- * Install dependency.
227
+ * Install dependencies
229
228
* Run ` npm start ` to start the dev server.
230
229
* Open ` http://localhost:8080/ ` in your browser.
231
230
@@ -236,3 +235,4 @@ $ npm install
236
235
$ npm start
237
236
```
238
237
238
+ ### [ Demos and Documentation] ( https://fusioncharts.github.io/vue-fusioncharts/ )
0 commit comments