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
Copy file name to clipboardExpand all lines: README.md
+96Lines changed: 96 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -177,6 +177,102 @@ In `index.html`
177
177
```
178
178
Load it in browser , Chart should get displayed
179
179
180
+
### Listening to events
181
+
182
+
Fusincharts events can be subscribed by attaching scope functions to event attributes.
183
+
All the events attributes start with `fcevent-`
184
+
followed by the event name in lowercase
185
+
186
+
Usage in template :
187
+
188
+
```xml
189
+
<fusioncharts
190
+
width="400"
191
+
height="400"
192
+
type="column2d"
193
+
datasource="{{myDataSource}}"
194
+
fcevent-dataplotrollover="rollover(event, args)">
195
+
</fusioncharts>
196
+
```
197
+
In the given above template, `rollover` is the scope function that needs to be defined in the controller's code.
198
+
199
+
For more on this read [here](https://www.fusioncharts.com/dev/api/fusioncharts/fusioncharts-events)
200
+
201
+
```
202
+
var app = angular.module('myApp', ['ng-fusioncharts']);
203
+
204
+
app.controller('MyController', function($scope){
205
+
$scope.myDataSource = {
206
+
"chart": {
207
+
"caption": "Countries With Most Oil Reserves [2017-18]",
208
+
"subCaption": "In MMbbl = One Million barrels",
209
+
"xAxisName": "Country",
210
+
"yAxisName": "Reserves (MMbbl)",
211
+
"numberSuffix": "K",
212
+
"theme": "fusion"
213
+
},
214
+
"data": [
215
+
{ "label": "Venezuela", "value": "290" },
216
+
{ "label": "Saudi", "value": "260" },
217
+
{ "label": "Canada", "value": "180" },
218
+
{ "label": "Iran", "value": "140" },
219
+
{ "label": "Russia", "value": "115" },
220
+
{ "label": "UAE", "value": "100" },
221
+
{ "label": "US", "value": "30" },
222
+
{ "label": "China", "value": "30" }
223
+
]
224
+
};
225
+
226
+
$scope.rollover = function(event, name){
227
+
console.log(event, name);
228
+
}
229
+
});
230
+
```
231
+
232
+
Get the list of fusioncharts' [events](https://www.fusioncharts.com/dev/advanced-chart-configurations/events/classifying-events)
233
+
234
+
### Chart API
235
+
236
+
Using api of charts involves getting the FusionCharts chart instance from the ```initialized``` event. It provides the chart object as a parameter which can be operated upon later.
0 commit comments