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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:33:28+00:00 2026-06-02T23:33:28+00:00

I have a program that get sensors data from a Como database and put

  • 0

I have a program that get sensors data from a Como database and put in a html page a graph. Now the graph is implemented with Google Graph API, but i have to switch to Highcharts.

I have a function that converts json data in Google format

    function json2gdt(data) {
    // Build a google.DataTable
    var gdt = new google.visualization.DataTable();
    gdt.addColumn('datetime', 'Time');
    gdt.addColumn('number', 'value');
    gdt.addRows(data.length*2);
    var prev = data[0][1];
    for (var i=0; i<data.length; i++) {
    ts = data[i][0] * 1000
        gdt.setValue(i*2, 0, new Date(ts));
    gdt.setValue(i*2, 1, prev); 
        gdt.setValue(i*2+1, 0, new Date(ts));
        gdt.setValue(i*2+1, 1, data[i][1]);
    prev = data[i][1];
    }
    return gdt;
}

Then I have a function that visualize in the html page the graph:

function visualize(json_response) {
var err = json_response['error'];
if (err) {
  $("#chart_div").html("<div class='alert'>" + err + "</div>");
  return;
}
var data = json_response['data'];
if (data.length == 0) {
  $("#chart_div").html("<div class='info'>No data received from this sensor!</div>");
  return;
}
// Convert Data to a step function
//var step_data = json2step(data);
var gdt = json2gdt(data);
var start;
if (data && data.length != 0) 
// TODO: fix this to actually compute the half of the time period
start = new Date(data[Math.floor(data.length / 2)][0] * 1000);
// draw our data in the widget
if (chart == null) {
    chart = new google.visualization.AnnotatedTimeLine(document.getElementById('chart_div'));
}
// TODO: compute tickness as a function of the time interval
chart.draw(gdt, {displayAnnotations: false, 
        displayZoomButtons: true, 
        thickness: 2,
        fill: 10,
                {% if net.ntype == "ztc" and sens.type == 2 %}
                  colors: ['#F00000'],
          scaleType: 'fixed', 
          min: 0,
          max: 1,
        {% else %}
                  scaleType: 'maximized', 
                {% end %}
        allowRedraw: true,
        displayExactValues: true,
        zoomStartTime: start});

}

Finally this is a bit of json data file..

#master: sender-64bit-addr receiver-timestamp *;OPCODE;sender-timestamp;sender-seq-num;payload-length;payload#
#master: input file (re)opened at 4f708e9d
#master: child [pid=6884]  started  at 4f708eb1
0000000000000000 4f708eb2 *ZTCR;00000004;00000002;16;9755080000010000000000#
0000000000000000 4f708eb2 *ZTCR;00000004;00000003;10;9634050010000003#
0000000000000000 4f708eb2 *ZTCR;00000005;00000004;0A;97410200EA#
0000000000000000 4f708eb3 *ZTCR;00000005;00000005;10;9634050010000003#

Can anyone help me? i have to change the data format for highcharts or it’s the same for google graph?

  • 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-02T23:33:30+00:00Added an answer on June 2, 2026 at 11:33 pm

    The json object is like this:

    "{ 
    'data' : [
                  [1, 10], 
                  [2, 11], 
                  [3, 12]
     ]
     }"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program in j2me that get strings and data from an wml/asp
I have a small IOS program and that get a time from a database
I have a program that needs to store data values and periodically get the
I have a program that takes data from an excel file and manipulates it
If I have a program that is using scanf to get user inputted data:
I have a program that will get messages from a server and store them
I have a program that makes use of the following method to get a
I have a program that saves images, but when I debug it I get
I have written a program that uses qhttp to get a webpage. This works
I have a small program that I'm trying to create to get ip addresses

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.