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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:47:10+00:00 2026-06-09T01:47:10+00:00

This chart is built on the fly once a submit button is called. The

  • 0

This chart is built on the fly once a submit button is called. The chart renders with proper series names but no lines are displayed.
I have a $.get call in my Highcharts chart like this:

series: [           
    <% {"WEB1" => Farm.WEB,
        "CAT1" => Farm.CAT,
        "ELK1" => Farm.ELK,
           }.each do |name, farm| %>
    {
    name: "<%= name %>",
    pointInterval: <%= 1.day * 1000 %>,
    pointStart: document.forms["myform"]["from"].value,
    data: $.get("/farm/1", {
        scope: "<%= name %>", 
        from: document.forms["myform"]["from"].value, 
        to: document.forms["myform"]["to"].value 
        }
          })
    },
    <% end %>]

Which is designed to return this custom json hash:

[{"x":"2012-07-10T17:00:00Z","y":0.015}]

This all works. The get returns the proper hash. But Highcharts does not like this. Does anyone have any suggestions as to how I can get this properly formatted? Thanks in advance!

EDIT

This is what I’m thinking.. but it doesn’t work..

 function(data){
        var arr = new Array();
            $.each(data, function(index,obj) {
               arr.push(obj.y);
       });setData(arr);
  • 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-09T01:47:11+00:00Added an answer on June 9, 2026 at 1:47 am

    You are simply, doing it wrong. This is not how ajax works. AJAX is asynchronous and hence doesn’t return anything, but makes a callback instead.

    data: $.get(...)
    

    is the problem, as $.get doesnt return anything immediately, but neither does it block or interrupt the js processing, and hence browser continues executing the next block of js, even before your ajax call gets completed.

    This is how you would generally do it. You first make the $.get call, and on completion of it, you create the chart.

    $.get("/farm/1", {
        scope: "<%= name %>", 
        from: document.forms["myform"]["from"].value, 
        to: document.forms["myform"]["to"].value 
        },function(data){
              // use the data that was received to build the highchart
              chart=....
          }
    });
    

    http://api.jquery.com/jQuery.get/

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

Sidebar

Related Questions

This chart is displayed very nice but the log is not nice at all.
Using series.add(180, 1); produces a perfectly valid chart like this (little red dot at
This chart has been linked a number of times on blogs that I follow
I have this chart in which if any point in graphs exceeds specific limit
I'm trying to output the unicode latin cross character described in this chart :
For example we have this line chart at Google Code API there is a
I have two issues in this google chart. I want to either get rid
I have been working on getting this seat mapping chart for a while and
I am plotting a financial candlestick chart using this MATLAB function: http://www.mathworks.com/help/toolbox/finance/candlefts.html How do
Currently I have a stacked bar chart like this ( jsfiddle demo ) I

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.