killerface

Issue with loading new Data

Recommended Posts

Hello,

 

I am currently rendering a MSCombi2D chart. (Javascript). I am pulling the data in using JSON, and have given the user the ability to choose between different datasets.

 

My issue is that when another dataset is selected the chart will display the "Retriving data. Please wait" for about 1 second (which is fine). It will then display the old graph for about 3 seconds and then flashes/renders to the new one. (The issue)

 

Is there anyway to prevent the old graph from being displayed again? (If the Retriving data. Please Wait message continues to be displayed that would be fine.)

 

Please let me know if you need more information.

 

Thanks!

 

(Version is  fusioncharts/3.3.1-sr2.19840)

Edited by killerface

Share this post


Link to post
Share on other sites

Thanks for the reply. It looks like I've managed to get the result that I want by disposing of the old chart and then inserting the new one. Is there a more graceful way to do this though?

 

Previous Code Used to update the chart:

    $('#change_campaign').change(function() {
        $("#chart_callsmade").updateFusionCharts({
            type: "MSCombi2D",
            width: "814",
            height: "384",
            id: "lineId",
            dataFormat: "jsonurl",
            dataSource: analytics_urls[1] + $('#change_campaign').val() /*"../getListenership/" */
        });
        $('#campaign_name_label').html($("#change_campaign option:selected").text());
    });

 

 

New code:

    $('#change_campaign').change(function() {
        $("#chart_listenership").children().first().dispose();
        $("#chart_listenership").insertFusionCharts({

            type: "MSCombi2D",
            width: "814",
            height: "384",
            id: "lineId",

            dataFormat: "jsonurl",
            dataSource: analytics_urls[1] + $('#change_campaign').val() /*"../getListenership/" */
        });
        $('#campaign_name_label').html($("#change_campaign option:selected").text());
    });
 

Share this post


Link to post
Share on other sites
Guest Rishab

Hi,

I suggest you to use FusionCharts Jquery API class method - updateFusionCharts() for updating chart configurations of an existing chart at run-time.

The attached item is the sample implementation of the above mentioned method.

If still your persists, please provide me the code of your application that may help in comprehension.

 

 

jquery.zip

Share this post


Link to post
Share on other sites

Hey,

 

Thanks, I had tried that (if you look in the code above), but guess it was acting weird because of all the extra prarmeters. When I drop it down to just the new dataSource it worked fine!

 

Thanks again.

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