Skip to content

Commit 624fb36

Browse files
committed
VueFusionCharts plugin basic structure ready
1 parent dc51bd3 commit 624fb36

18 files changed

+4498
-46
lines changed

.babelrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"plugins": [
3+
"add-module-exports",
4+
],
5+
"presets": ["es2015"]
6+
}

.eslintrc.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
module.exports = {
2+
"env": {
3+
"browser": true,
4+
"es6": true,
5+
"node": true
6+
},
7+
"extends": "eslint:recommended",
8+
"parserOptions": {
9+
"sourceType": "module"
10+
},
11+
"rules": {
12+
"indent": [
13+
"error",
14+
4
15+
],
16+
"linebreak-style": [
17+
"error",
18+
"unix"
19+
],
20+
"quotes": [
21+
"error",
22+
"single"
23+
],
24+
"semi": [
25+
"error",
26+
"always"
27+
]
28+
}
29+
};

.gitignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Logs
2+
logs
3+
*.log
4+
5+
# Runtime data
6+
pids
7+
*.pid
8+
*.seed
9+
10+
# Coverage tools
11+
lib-cov
12+
coverage
13+
coverage.html
14+
.cover*
15+
16+
# Dependency directory
17+
node_modules
18+
bower_components
19+
20+
# Example build directory
21+
# example/dist
22+
.publish
23+
24+
# Editor and other tmp files
25+
*.swp
26+
*.un~
27+
*.iml
28+
*.ipr
29+
*.iws
30+
*.sublime-*
31+
.idea/
32+
*.DS_Store

.npmignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Node
2+
node_modules/*
3+
npm-debug.log
4+
5+
# Windows
6+
Thumbs.db
7+
Desktop.ini
8+
9+
# Mac
10+
.DS_Store
11+
**/.DS_Store
12+
13+
# Example files
14+
example/

README.md

Lines changed: 50 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -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
5127
import Vue from 'vue';
5228
import VueFusionCharts from 'vue-fusioncharts';
53-
// import FusionCharts modules
29+
// import FusionCharts library
5430
import FusionCharts from 'fusioncharts';
31+
// Import `Charts` module to render a chart belonging to `FusionCharts` package
5532
import Charts from 'fusioncharts/fusioncharts.charts';
33+
// Import `Widgets` module to render a chart belonging to `FusionWidgets` package
5634
import 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
7579
let 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

Comments
 (0)