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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:04:50+00:00 2026-05-27T11:04:50+00:00

Here is what I’m struggling with today: I’m trying to draw a graph using

  • 0

Here is what I’m struggling with today:

I’m trying to draw a graph using jqPlot library.
The sql query outputs data which is converted to json in php by using json_encode and saved in hidden form field. This works fine and the actual field contains:

[["2011-12-10 12:01:00",271],["2011-12-10 12:13:05",132],["2011-12-11 12:17:55",388],["2011-12-10 22:03:40",5],["2011-12-11 12:10:54",830]]

Then the data from the form is retrieved in javascript by using:

var data = document.getElementById("dataarray").value;

in order to use it as a data for jqPlot later on.
The data variable is correctly formatted and when checked with document.write(data);, outputs correct data in json format but whenever I place it inside the plot1 variable to use data for the graph it throws an error [object Object] in Safari and Uncaught #<Object> in Firefox.

The whole javascript code is as follows:

$(document).ready(function(){

    var data = document.getElementById("dataarray").value;  


    var test = [["2011-12-10 12:01:00",271],["2011-12-10 12:13:05",132],["2011-12-11 12:17:55",388],["2011-12-10 22:03:40",5],["2011-12-11 12:10:54",830]];
    var plot1 = $.jqplot("chart_personal_2", [data], {
          title:"Data Point Highlighting",
          axes:{
        xaxis:{
          renderer:$.jqplot.DateAxisRenderer,
          numberTicks: 3,
          tickOptions:{
            formatString:"%d/%m/%Y %H:%M:%S"
          } 
        },
        yaxis:{
        label: "Elevation(m)",
          tickOptions:{
             showMark: true
            }
        }
          },
          highlighter: {
        show: true,
        sizeAdjust: 7.5
          },
          cursor: {
        show: false
          }
      });
});

I even tried output = String(data); but it did not work either.
I’m assuming that my data variable is an object that cannot be used as source data for jqPlot graph, it needs to be converted to string prior use? Correct me if I’m wrong.

Hope somebody knows how to work it out without, thanks in advance!

  • 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-27T11:04:51+00:00Added an answer on May 27, 2026 at 11:04 am

    You are retrieving it as String, but jqPlot expect Array, so you have to run eval on it:

    var data = document.getElementById("dataarray").value;
    eval('data = '+data+';');
    

    or better solution: don’t save it to hidden input, but make JS variable from php:

    echo "<script type='text/javascript'> var data = ".json_encode($data).";</script>";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the issue I am having: I have a large query that needs
Here is my code, which takes two version identifiers in the form 1, 5,
Here's my scenario. I've got SharePoint 2010 running on one server, with an SQL
Here is the code I'm using http://jsbin.com/evike5/edit When the jQuery UI dialog is fired
Here is my query: SELECT * FROM [GeoName] WHERE ((-26.3665122100029-Lat)*(-26.3665122100029-Lat))+((27.5978928658078-Long)*(27.5978928658078-Long)) < 0.005 ORDER BY
Here's a query that works fine: SELECT rowid as msg_rowid, a, b, c FROM
here's what we have today: * NxM grid of points in 3D * we
Here's the flow that I am trying to achieve: 1) User uploads an audio
Here is what I am trying to achieve in PHP: I have this string:
Here is my simplified data structure: Object1.h template <class T> class Object1 { private:

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.