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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:19:33+00:00 2026-06-06T14:19:33+00:00

Can I´m asking for advice. I have function which should return javascript object function

  • 0

Can I´m asking for advice. I have function which should return javascript object

function get_temp(){
    var datasets_temp = {
        "sens1": {data: [[1340803113,22.9],[1340803474,23],[1340803836,23],[1340804197,23.1]] },        
        "sens2": {data: [[1340846482,23],[1340846843,23],[1340847204,23],[1340847566,23]] },
        "sens3": {data: [[1340868157,23.1],[1340868518,22],[1340868879,23.2],[1340869241,23.2]] }};
  return datasets_temp; 
}

Drawing graph:

var plot = $.plot($("#temp_graph"), get_temp(), $.extend(true, {}, options, {
        xaxis: {min: 0, max: 50}}));

I don´t know where is problem why is it not working.

  • 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-06T14:19:35+00:00Added an answer on June 6, 2026 at 2:19 pm

    You are on the right track, but the series data needs to be an array of series objects, not just one object with each set of data being a property of it.

    What you should have is something like this:

    var dataset_temp = [  //an array
      {   //of series objects
         label: 'sens1',
         data: [[1340803113,22.9],[1340803474,23],[1340803836,23],[1340804197,23.1]]
      },
      {
         label: 'sens2',
         data:  [[1340846482,23],[1340846843,23],[1340847204,23],[1340847566,23]]
      },
      {
         label: 'sens3',
         data: [[1340868157,23.1],[1340868518,22],[1340868879,23.2],[1340869241,23.2]]
      }
    ];
    

    You have another problem, which is that you are obviously plotting the x-axis as time, but your timestamps (i.e. 1340846482) are not javascript timestamps, they are “unix” ones. What you need to do is multiply every timestamp by 1000 (i.e. 1340846482000 is correct), because javascript counts them in milliseconds, not seconds. See the text in this example for other caveats.

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

Sidebar

Related Questions

How can you check an empty tag -field by Javascript like in asking questions
I'm working on a new project which has some complex javascript. I can't post
sorry a basic question and I have resorted to asking as I can't find
I have written an application which outputs data as XML. However, it would be
We have customers asking for apps that can run on both iPhone and Android.
I can't believe I'm asking this but, is there any way to get Chrome
I'm asking and answering this question so that I can find it again in
I'm asking this question, because I can't figure out when I could find an
I can write something, I'm asking if something is already built into jQuery.
I can't get around a peculiar problem with SimpleOpenNI for Processing ao I'm asking

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.