legendItemClicked event triggered twice

Recommended Posts

I am using v3.15 of FusionCharts and the jQuery FusionCharts plugin.
The legendItemClicked event on my chart is triggering twice when adding the event after the chart has been rendered using the jQuery method. In the jsfiddle (using version 3.13 of FusionCharts ), this does not happen. When I add it using the events property in the options, it works fine and only triggers once. 
This is how I'm adding it after the chart has been created:

var chartOptions = { }; //basic options
$('#chart-container').on('fusionchartslegenditemclicked', function(event, data){
	console.log('legend item clicked');

In the Dev Tools in chrome, it says there is only one listener, and I have confirmed this code is only being run one time. I noticed that when doing it this way, the main chart element gets the event listener 'fusionchartslegenditemclicked', but when setting the event through properties, I can't find that event listener anywhere.

These were the differences in the debug log between v3.13 and v3.15 of FusionCharts when attempting to use the jQuery method, if that helps.

Share this post

Link to post
Share on other sites



The mentioned event is getting triggered only once on clicking the legends once. Please check the below sample fiddle adding the event listener as you mentioned after rendering the chart using JQuery plugin of FusionCharts.

Sample fiddle : https://jsfiddle.net/nro4p86u/

You can refer to the above samplee fiddle. If you still face any problem, please share a sample replicating the issue.




Share this post

Link to post
Share on other sites

Is this how I should be initializing FusionCharts?

import FusionCharts from 'fusioncharts';
import Charts from 'fusioncharts/fusioncharts.charts';
import FusionTheme from 'fusioncharts/themes/fusioncharts.theme.fusion';
import * as jQueryFusioncharts from 'jquery-fusioncharts';


No matter what I do, it always triggers twice, and I can't figure out why. There isn't any difference between what's on npm and what's being used in the fiddle, is there?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now