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
To attach event listeners to FusionCharts, you can use the `v-on` or `@` operator in the vue-fusioncharts component.
189
+
190
+
```html
191
+
<fusioncharts
192
+
:type="type"
193
+
:width="width"
194
+
:height="height"
195
+
:dataFormat="dataFormat"
196
+
:dataSource="dataSource"
197
+
@eventName="eventHandler">
198
+
</fusioncharts>
199
+
```
200
+
Where `eventName` can be any fusioncharts event. You can find the list of events at [fusioncharts devcenter](https://www.fusioncharts.com/dev/api/fusioncharts/fusioncharts-events)
201
+
202
+
## Working with APIs
203
+
204
+
To call APIs we will need the chart object. To get the chart object from the component we can use `ref` and retrieve it from `this.$refs[refname].chartObj`
205
+
206
+
```html
207
+
<fusioncharts
208
+
:type="type"
209
+
:width="width"
210
+
:height="height"
211
+
:dataFormat="dataFormat"
212
+
:dataSource="dataSource"
213
+
@dataPlotRollover="onDataPlotRollover"
214
+
ref="fc">
215
+
</fusioncharts>
216
+
```
217
+
Now, we can access the chart object from `this.$refs.fc.chartObj`
218
+
219
+
```js
220
+
var app =newVue({
221
+
el:'#chart',
222
+
data: {
223
+
type:'Pie2D',
224
+
width:'500',
225
+
height:'300',
226
+
dataFormat:'json',
227
+
dataSource: myDataSource,
228
+
},
229
+
methods:{
230
+
onDataPlotRollover:function (e) {
231
+
this.$refs.fc.chartObj.slicePlotItem(0);
232
+
}
233
+
}
234
+
});
235
+
```
236
+
This example will slice a Pie2d section when you rollover the chart.
214
237
215
238
## Contributing
216
239
@@ -227,3 +250,7 @@ $ npm start
227
250
```
228
251
229
252
### [Demos and Documentation](https://fusioncharts.github.io/vue-fusioncharts/)
253
+
254
+
> ### Using Legacy Webpack Templates
255
+
> If you are using legacy webpack templates using (ex: `vue init webpack-simple myProject`), you need to use the new UglifyJS webpack plugin as the default plugin doesn't support ES5+ syntaxes.
256
+
> Refer here on what to change in the webpack.config.js: https://github.com/vuejs-templates/webpack-simple/issues/166#issuecomment-354394253
0 commit comments