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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:22:57+00:00 2026-06-13T00:22:57+00:00

Can someone please point out what I’m missing here? I’m trying to generate a

  • 0

Can someone please point out what I’m missing here? I’m trying to generate a flot chart with the following function (which is called on success of the $.getJSON function in the page). At the moment, the chart is not loading at all and I get a parse error. If I removed this function, the parse error disappears, so I’m sure it’s this function causing the problem but I can’t see where!

function plotLineGraph(theData){
var myData = theData['data'];
var myDates = theData['dates'];
var d1 = [
          myData[0],  myData[1],  myData[2],  myData[3],  myData[4],
          myData[5],  myData[6],  myData[7],  myData[8],  myData[9],
          myData[10], myData[11], myData[12], myData[13], myData[14],
          myData[15], myData[16], myData[17], myData[18], myData[19],
          myData[20], myData[21], myData[22], myData[23], myData[24],
          myData[25], myData[26], myData[27], myData[28], myData[29]
          ];
$.plot($("#placeholder"), [
    {label: "rating",  data: d1}
    ], {
        series: {
            lines: { show: true },
            points: { show: true }
        },
        xaxis: {
            ticks:[
            myDates[0],  myDates[1],  myDates[2],  myDates[3],  myDates[4],
            myDates[5],  myDates[6],  myDates[7],  myDates[8],  myDates[9],
            myDates[10], myDates[11], myDates[12], myDates[13], myDates[14],
            myDates[15], myDates[16], myDates[17], myDates[18], myDates[19],
            myDates[20], myDates[21], myDates[22], myDates[23], myDates[24],
            myDates[25], myDates[26], myDates[27], myDates[28], myDates[29]
            ]
        },
        yaxis: {
            ticks: 5,
            min: 0,
            max: 5
        },
        grid: {
            backgroundColor: { colors: ["#fff", "#eee"] }
        }
});
}

EDIT:

The $.getJSON function returns the following JSON:

{
"data": [[1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0], [8, 0], [9, 0], [10, 0], [11, 0], [12, 0], [13, 0], [14, 0], [15, 0], [16, 0], [17, 0], [18, 0], [19, 0], [20, 0], [21, 0], [22, 0], [23, 3], [24, 3], [25, 2], [26, 0], [27, 0], [28, 0], [29, 0], [30, 0]],
"dates": [[1, '10/9'], [2, '11/9'], [3, '12/9'], [4, '13/9'], [5, '14/9'], [6, '15/9'], [7, '16/9'], [8, '17/9'], [9, '18/9'], [10, '19/9'], [11, '20/9'], [12, '21/9'], [13, '22/9'], [14, '23/9'], [15, '24/9'], [16, '25/9'], [17, '26/9'], [18, '27/9'], [19, '28/9'], [20, '29/9'], [21, '30/9'], [22, '1/10'], [23, '2/10'], [24, '3/10'], [25, '4/10'], [26, '5/10'], [27, '6/10'], [28, '7/10'], [29, '8/10'], [30, '9/10']]
}

EDIT 2:

Thanks Brendan. The call is here (it is part of a larger function which uses the same syntax to correctly generate a few other pie charts):

$.getJSON('/last-month-daily-average-for-products/' 
          + theProductUuid + '/', plotLineGraph);

As for the disassembling/reassembling of the JSON…. No particular reason, no. All I need to do is get the relevant data from the JSON into the correct parts of the flot function, so feel free to correct anything which is inefficient as well as incorrect!!

  • 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-13T00:22:58+00:00Added an answer on June 13, 2026 at 12:22 am

    There’s nothing wrong with any of the code you have provided. It works perfectly.

    See it in action here: http://jsfiddle.net/ryleyb/eJ2h8/

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

Sidebar

Related Questions

Can someone please point me out a hash function (preferably an implementation) which would
I'm using the following function but it does work, can someone please point out
Can someone please point out what I am doing wrong in the following code?
Can someone please point out some books or online resources which explain in detail
Can someone please point out whats going wrong here: The code below loops through
it's assembler right? can someone please point out the progression that we've had in
Could someone please point out a site where I can find an algorithm to
What kind of data structures are these? Can someone please point out any links
I am new to ruby and rails. Can someone please point out what is
Can someone please point me in the right direction? I am trying to serialize

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.