@@ -12,73 +12,77 @@ npm install vue-fusioncharts --save
1212```
1313#### cdn
1414``` html
15- <div id =" chart" >
16- <fusioncharts
17- :type =" type"
18- :data-source =" dataSource"
19- :width =" width"
20- :height =" height"
21- >
22- </fusioncharts >
23- </div >
24-
25- <script type =" text/javascript" src =" https://unpkg.com/vue@2.3.3" ></script >
26- <script type =" text/javascript" src =" https://unpkg.com/fusioncharts/fusioncharts.js" ></script >
27- <script type =" text/javascript" src =" https://unpkg.com/fusioncharts/fusioncharts.charts.js" ></script >
28- <script src =" https://unpkg.com/vue-fusioncharts@1.0.4/dist/vue-fusioncharts.min.js" ></script >
29-
30- <script type =" text/javascript" >
31- // Pass the VueFusionCharts to `Vue.use` global function
32- Vue .use (VueFusionCharts .default );
33-
34- var chart = new Vue ({
35- el: ' #chart' ,
36- data: {
37- type: ' Pie2D' ,
38- dataSource: {data: [{value: 1.9 }, {value: 2.3 }, {value: 2.1 }]},
39- width: ' 600' ,
40- height: ' 300'
41- }
42- });
43- </script >
15+ <!-- Minified -->
16+ <script src =" https://unpkg.com/vue-fusioncharts/dist/vue-fusioncharts.min.js" ></script >
17+ <!-- Source -->
18+ <script src =" https://unpkg.com/vue-fusioncharts/dist/vue-fusioncharts.js" ></script >
4419
4520```
4621
4722## Usage
48- In order to use this plugin, you need to import ` vue ` , ` vue-fusioncharts ` and ` fusioncharts ` in your application and pass the ` VueFusionCharts ` component to ` Vue.use ` global method
23+ #### Method 1
24+ In order to use this plugin, you need to call ` Vue.use ` global method and pass ` VueFusionCharts ` component followed by ` FusionCharts ` and package-specific dependencies for ` FusionCharts `
25+
4926``` js
50- // Import the required modules
5127import Vue from ' vue' ;
5228import VueFusionCharts from ' vue-fusioncharts' ;
53- // import FusionCharts modules
29+ // import FusionCharts library
5430import FusionCharts from ' fusioncharts' ;
31+ // Import `Charts` module to render a chart belonging to `FusionCharts` package
5532import Charts from ' fusioncharts/fusioncharts.charts' ;
33+ // Import `Widgets` module to render a chart belonging to `FusionWidgets` package
5634import Widgets from ' fusioncharts/fusioncharts.widgets' ;
5735
5836// Register `vue-fusioncharts` component by calling the Vue.use() global method
59- // Also pass the FusionCharts object
60- Vue .use (VueFusionCharts, {
61- core: FusionCharts,
62- modules: [Charts, Widgets]
63- });
37+ // And pass `VueFusionCharts` as a 1st argument and `FusionCharts` as a 2nd argument
38+ // and then comma separated package-specific dependencies eg Chart and Widgets.
39+ // To render a chart belonging to the Charts package and widgets belong to FusionWidgets package, pass the Charts module
40+ Vue .use (VueFusionCharts, FusionCharts, Charts, Widgets);
6441```
42+ #### Method 2
43+ Instead of passing ` FusionCharts ` specific dependency to ` Vue.use ` global method you can directly pass ` FusionCharts ` to the specific dependencies
6544
66- #### Options
67- ` vue-fusioncharts ` allows a few custom options:
6845``` js
69- Vue .use (VueFusionCharts, FusionCharts, Charts, Widgets)
46+ import Vue from ' vue' ;
47+ import VueFusionCharts from ' vue-fusioncharts' ;
48+ // import FusionCharts library
49+ import FusionCharts from ' fusioncharts' ;
50+ // Import `Charts` module to render a chart belonging to `FusionCharts` package
51+ import Charts from ' fusioncharts/fusioncharts.charts' ;
52+ // Import `Widgets` module to render a chart belonging to `FusionWidgets` package
53+ import Widgets from ' fusioncharts/fusioncharts.widgets' ;
54+
55+ Charts (FusionCharts);
56+ Widgets (FusionCharts)
57+
58+ Vue .use (VueFusionCharts, FusionCharts);
59+ ```
60+ To know which chart belongs to which package, refer the [ list of charts] ( http://www.fusioncharts.com/dev/getting-started/list-of-charts.html ) .
61+
62+ Define the component in your HTML template where you wish to render the chart
63+
64+ ``` html
65+ <div id =" chart1" >
66+ <fusioncharts
67+ :type =" type"
68+ :data-source =" dataSource"
69+ :width =" width"
70+ :height =" height"
71+ >
72+ </fusioncharts >
73+ </div >
7074```
7175
72- #### Render
73- Create the ` Vue ` instance and define all configuration required to render FusionCharts.
76+ Create the ` Vue ` instance and define all configuration required to render the chart
77+
7478``` js
7579let chart = new Vue ({
7680 el: ' #pie-chart' ,
7781 data: {
78- type: ' Pie2D' ,
79- dataSource: {data: [{value: 1.9 }, {value: 2.3 }, {value: 2.1 }]},
80- width: ' 600' ,
81- height: ' 300'
82+ type: ' Pie2D' ,
83+ dataSource: {data: [{value: 1.9 }, {value: 2.3 }, {value: 2.1 }]},
84+ width: ' 600' ,
85+ height: ' 300'
8286 }
8387});
8488```
0 commit comments