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

  • Home
  • SEARCH
  • 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 1076291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:23:36+00:00 2026-05-16T21:23:36+00:00

A way that doesn’t hog resources, just stops execution for 1 second then executes?

  • 0

A way that doesn’t hog resources, just stops execution for 1 second then executes?

What I want to do is dynamically move a Google gauge from one value to another, creating the effect of it moving to the value instead of jumping to it.

i.e. –

for(original_value; original_value < new_value; original_value++)
{
    data.setValue(0, 1, original_value);
    delay half a second here in JavaScript?
}  

Is this an OK way of doing this or is something closer to what the demo is doing is extremely better? :
How to: Dynamically move Google Gauge?

  • 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-05-16T21:23:37+00:00Added an answer on May 16, 2026 at 9:23 pm

    No. JavaScript in web browsers is not only single threaded, but it shares the same thread with the browser rendering. If your JavaScript code were to block, the browser UI would become unresponsive during that period.

    The typical way to tackle time-based events in JavaScript is by using asynchronous timers. John Resig wrote an intresting article a while ago called “How JavaScript Timers Work“, which you may want to check out.


    UPDATE:

    Are you using the Google Visualization API for the guages? If so, it seems to me that Google already handles the smooth animation that you’re trying to achieve. Try the following in the Google Code Playground (keep an eye on the Network gauge):

    function drawVisualization() {
      // Create and populate the data table.
      var data = new google.visualization.DataTable();
      var chart;
    
      data.addColumn('string', 'Label');
      data.addColumn('number', 'Value');
      data.addRows(3);
      data.setValue(0, 0, 'Memory');
      data.setValue(0, 1, 80);
      data.setValue(1, 0, 'CPU');
      data.setValue(1, 1, 55);
      data.setValue(2, 0, 'Network');
      data.setValue(2, 1, 68);
    
      // Change the value of the Network Gauge after 3 seconds.
      setTimeout(function () { data.setValue(2, 1, 20); chart.draw(data); }, 3000);
    
      // Create and draw the visualization.
      chart = new google.visualization.Gauge(document.getElementById('visualization'));
      chart.draw(data);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble finding a way to do this in a way that doesn't
I've got some code that doesn't work the way I expect, and I'd appreciate
In a similar way that modulo generates a sawtooth wave. It doesn't have to
Is there a way to recover from an unhandled exception that doesn't involve cancelling,
What's the best way to create a model in Ruby on Rails that doesn't
Which is better way to use jQuery() ? I've heard that jQuery(element) doesn't ruin
Is there an efficient way that doesn't require too much fiddling (I can cope
I'm looking for an easy way that doesn't involve using something like Indy to
I've noticed that the C# compiler doesn't infer second generic parameter. Example: C++ template
How do I make Gvim word wrap in such a way that doesn't break

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.