Sign in to follow this  
rock.huang

Can't reload the charter after hiding it with javascript

Recommended Posts

Guest Sashibhusan

Hi,

 

Welcome to FusionCharts Forum.

 

Could you please provide the code snippet of "how you are trying to hide/show the chart using JavaScript", so that we may better help you?

 

Awaiting your valuable inputs.

Share this post


Link to post
Share on other sites

The charters are in  <div id="chart_box" ></div>
and i use a hide/show button to control it.
the code as follows:

 

          $(document).ready(function(){
                $("#show-chart-btn").click(function(){
                    if($(this).text()=='Hide') {
                        $(this).text('Show');
                        $("#chart_box").hide();
        
                    } else {
                           $(this).text('Hide');
                        $("#chart_box").show();  
                 
                    }
                });

            });


After i hide the #chart_box and try to  show it again. The flash charter show "invalid data." and the data lost.

seem only in Firfox, IE is ok.

Share this post


Link to post
Share on other sites

The charters are in  <div id="chart_box" ></div>

and i use a hide/show button to control it.

the code as follows:

 

 

          $(document).ready(function(){
                $("#show-chart-btn").click(function(){
                    if($(this).text()=='Hide') {
                        $(this).text('Show');
                        $("#chart_box").hide();
        
                    } else {
                           $(this).text('Hide');
                        $("#chart_box").show();  
                 
                    }
                });

            });

After i hide the #chart_box and try to  show it again. The flash charter show "invalid data." and the data lost.

 

seem only in Firfox, IE is ok.

Hi,

 

We have been working on his issue. The core problem related to this issue is Flash Player is automatically removing all the externalInterface functions (for updating chart's data etc.) of the Flash chart when resized or it is hidden and shown again or in other certain similar situations. We have tried to over-write this situation by forcefully injecting all behaviors that Flash Player does automatically. However, we are unable to fix this as of now.

 

Hence, for the time-being we have come up to the following work-around (considering that the code now renders the chart once and updates only the data in rest of the cases):

 

Please always call chart.render() once when the externalInterface is missing.

 

The code would be similar to this:

if (typeof chart.ref.setDataXML != "function") {
                chart.render();
}
chart.ref.setDataXML(xmlString);

Please share your feedback on this. Awaiting your reply.

Share this post


Link to post
Share on other sites

Thanks for your reply, have solve the problem.

Just change the execution sequence.

render the charter first and set the xmlurl later.

Before: 

this.myChart.setXMLUrl(flashVars.data_file);
this.myChart.render(this.config.chartCont);


Now:

this.myChart.render(this.config.chartCont);

this.myChart.setXMLUrl(flashVars.data_file); 
 

Tested on IE,OPEAR,CHROME,FIREFOX

Share this post


Link to post
Share on other sites

Thanks for your reply, have solve the problem.

 

Just change the execution sequence.

 

render the charter first and set the xmlurl later.

 

Before: 

this.myChart.setXMLUrl(flashVars.data_file);

this.myChart.render(this.config.chartCont);

 

Now:

this.myChart.render(this.config.chartCont);

this.myChart.setXMLUrl(flashVars.data_file); 

 

Tested on IE,OPEAR,CHROME,FIREFOX

Hi,

 

Glad that your issue is resolved.

 

Happy FusionCharting! :)

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
Sign in to follow this