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 8745545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:02:23+00:00 2026-06-13T12:02:23+00:00

I am creating an energy usage/analysis/management application for the University I attend. There is

  • 0

I am creating an energy usage/analysis/management application for the University I attend. There is already a database online that is continuously updated with the latest electricity meter ratings for each building.

My application will have a page where all buildings are listed and can be clicked on. When a user chooses a building, the application will grab the electricity meter readings for that building and generate graphs for each meter using the ‘Highcharts’ charting library.

The backend of the application is written in Ruby (with Rails). In the HTML view that displays the page consisting of the graphs for a specific builing, I put

 <div id="graphContainer">

 </div>

in order to generate a graph.

Currently, I can generate one graph per building page just by hardcoding one instance of the above code in the view.

However, each building can have multiple electricity meters. Having not that much experience in HTML, I have no idea how to generate the graphs when I don’t know how many I need until run time.

Can anyone point me in the right direction?

  • 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-13T12:02:25+00:00Added an answer on June 13, 2026 at 12:02 pm

    Given a

    <div id="graphContainer"></div>
    

    you can target it with a highchart using

    chart1 = new Highcharts.Chart({
      chart: {
        renderTo: '#graphContainer',  //  <=== this selector here  
        type: 'bar'
      },
      //... more options and graph data
    });
    

    You don’t have to have the HTML for #graphContainer in your view initially either. You could have some

    <div id="graphs-container"></div>
    

    in your view and then via Javascript (jQuery below) you can build the container and highchart for each of the graphs needed at runtime with a simple loop.

    $(function(){
      var highcharts = [];
    
      for (var i=0; i<charts.length; i++) {
        $('#graphs-container').append($('<div id="graph-container-' + (i+1) + '"/>');
    
        var highchart = new Highcharts.Chart({
          chart: {
            renderTo: '#graph-container' + (i+1),  //  <=== this selector here  
            type: 'bar'
          },
          //... more options and graph data for chart[i]
        });
    
        highcharts.push(highchart);
      });
    });
    

    All you’d need to do is modify the above to suit your needs by sending charts to the view likely as JSON data containing everything required to render each specific graph in terms of the Highchart options needed and datasets.

    The Highcharts documentation is a great place to look, but as you suggested you also seem to have more learning in general to be doing before you’re comfortable with al this stuff.

    • http://www.highcharts.com/documentation/how-to-use
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a game in cocos2d. In this game there is an energy bar
Creating liquid layouts is an immense pain. Now, I totally understand that tables should
I creating a web application using JSF,Hibernate,Spring. I have added a filter for checking
Creating Facebook event for specific page with FB Graph API There is a thread
Creating a Drawable that is completely empty seems like a common need, as a
Creating MVC3 Razor Helper like Helper.BeginForm() says that it can be done using extension
Creating a mini-database with access, i came across this problem: For the background, i
Creating an Iphone application, I used to perform INSERT QUERY on different databases. But
Creating a calculator-like dialog, I noticed that quickly clicking on a button in IE
Creating an installer for possible remote systems so that if they do not have

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.