Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8068409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:40:35+00:00 2026-06-05T12:40:35+00:00

I have an object charts , var charts = { chart1 : function (){

  • 0

I have an object charts,

 var charts = {
        chart1 : function (){
            return {
                key1 : value1,
                key2: value2,
                key3, value3
            }
        },
        chart2 : function(){
            return {
                key1 : value1,
                key2: value2,
                key3, value3
            }
        },
        chart3 : function(){
            return {
                key1 : value1,
                key2: value2,
                key3, value3
            }
        } 
    }

A function callback

function callback(instance){
    .....
    .....
}

I can draw chart chart1 like this,

var chart = new Highcharts.Chart(charts.chart1(),callback);
// callback is a function which gets called when drawing of chart is completed.

And all charts like this,

 for(chart in charts){
        if(charts.hasOwnProperty(chart)){
            new Highcharts.Chart(charts.chart(),callback);
        }
    }

But, drawing a lot of charts simultaneously hangs firefox.
So, I want to call charts one by one on callback of previous chart.
(When drawing of one is completed, draw the second one and so on…)

I can achieve this by creating an array having names of each chart. On callback function, I will increment the index and call the next chart.

Here’s the question,

How can I draw all charts without manually creating a list of chart names ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T12:40:37+00:00Added an answer on June 5, 2026 at 12:40 pm

    You can create an iterable array of all the keys in your object and then cycle through them one by one as each chart is done being constructed:

    function makeAllCharts() {
        // make list of charts
        var chartList = [], pos = 0;
        for (chart in charts) {
            chartList.push(chart);
        }
    
        function nextChart() {
            if (pos < chartList.length) {
                var key = chartList[pos++];
                new Highcharts.Chart(charts[key](), function() {
                    callback();
                    nextChart();
                });
            }
        } 
        nextChart();
    }
    

    Because you can’t iterate a list of keys directly from the object one at a time without a for (x in y) loop, you do need to create the intermediate array that can be iterated by incrementing the index.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: var words = new Object(); $(li.words).each(function(){ var thisId =
In a Django template, I have a function function show_graph(i){ $(#+i+seegraph).click(function(){ $(#+i+graph).show(); var qaa
I have object A which contains multiple instances of object B, which in turn
I have two tables: object that has object_id column and avalues that have object_id
I think I read somewhere that some modules only have object oriented interfaces (
I have an object, called Account, and there is a campaign source associated with
I have an object Document with nested Properties (Name, Value) collection. Now I want
I have shared object A.so which statically links to libssl.a & another shared object
I have this object: stdClass Object ( [daily_inventoryID] => 1 [inventory_timestamp] => 2012-06-08 14:35:42
I have an object that cannot be copied, a NetGame because it has a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.