Snowy Egret

Click one legend and hide more than one dataset

Recommended Posts

I need help. My client has fusion flash charts 3.3.1-sr2.19840 and I work with it.

 

I create a chart. See attachment. I want to make user click one legend and hide more than one dataset.

 

My chart has related datasets like data for kuwait show as blue column and blue line, data for saudi arab is red column and red line.

 

I only show culumn dataset legend and hide line dataset legend. I want to click legend for kuwait and want to hide both column and line for kuwait.

 

Possible? My client requires this urgent. 

post-62485-0-28211700-1392230136_thumb.jpg

Share this post


Link to post
Share on other sites

Hi,

 

It is not possible to hide two datasets on click of a legend, as of now.

 

However, as a workaround, you may have checkboxes above/below your chart and then on click of the checkboxes you may change the XML/JSON data of the chart. In this changed data, you may set the "visible" attribute of dataset to 0 for more than one datasets. By doing this, you will be able to achieve your need.

 

Ref.

<dataset  .. visible = '0' >

 

For changing the data on client side on click a checkbox, you may use setXMLUrl or setJSONUrl on the DOM ID of the chart. For more information of the same, refer : http://docs.fusioncharts.com/charts/?JavaScript/JS_ChangeData.html

 

For a demo of using checkboxes and modify the chart, refer : http://www.fusioncharts.com/explore/client-side-data-update

 

Please note that this workaround works with JS charts only, and not with Flash charts.

 

Hope this helps.

Share this post


Link to post
Share on other sites

Hi,

 

Yes, the above mentioned workaround works with JavaScript version only.

 

Another workaround around this, which again works with JavaScript charts only, is to use "LegendItemClicked" event to trap the click event on legend and then change the XML/JSON data of the chart. In this changed data, you may set the "visible" attribute of dataset to 0 for more than one datasets. 

 

For more information on "LegendItemClicked" event, refer : http://docs.fusioncharts.com/charts/contents/index.html?JavaScript/API/Events.html

 

Hope this helps.

Share this post


Link to post
Share on other sites

Hari,

 

you know? visible="0" is working in flash also. but you only said javascript! 

 

the demo of using checkboxes is not good for me. it hiding the legend! i cannot use it. 

 

but good thank you. i learn and you learn more also he he.

Share this post


Link to post
Share on other sites

Hi,

 

Nope.."visible" attribute works only with JavaScript variant. :)

 

You can use "LegendItemClicked" event as per Haritha's earlier suggestion.

Share this post


Link to post
Share on other sites

Hari said LegendItemClicked is for Javascript I use Flash. But I find it working in flash, is it in flash ? but yes visible is not in flash. then what do i do with just legenditemclicked? i cannt use visible.

Share this post


Link to post
Share on other sites

Hey,

 

"visible" attribute and "LegendItemClicked" event are supported only for JavaScript charts. 

 

For Flash, we do not have any workarounds to suggest. Since we are moving out of Flash, new features/events are developed for JavaScript charts only.

 

As a suggestion, you can move to JavaScript version to ensure that your charts work the same across devices.

 

Hope this helps. :)

Share this post


Link to post
Share on other sites

my client will not go Javascript now. she is obsessed and her page is internal so her team use it internal.

 

so i came to a good workround with flash. opposite to you saying "LegendItemClicked" supported only for JavaScript charts i came "LegendItemCilcked" woking for flash! my luck may be. you try flash with LegendItemClicked? and i use it now with a good workround. my client is happy with my workround.  goodnight

 

 

 

Share this post


Link to post
Share on other sites

Hi,

 

Oops...."visible" attribute works only for JS charts and "LegendItemClicked" event are supported by Flash/JavaScript charts. 

 

Glad to know you have identified a solution to satisfy your client. :) 

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