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

  • Home
  • SEARCH
  • 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 9219891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:13:13+00:00 2026-06-18T03:13:13+00:00

My target: I want to draw HighStock-chart with multiple series. Data is loaded by

  • 0

My target: I want to draw HighStock-chart with multiple series. Data is loaded by AJAX from data.php. The output of data.php is an JSON-Array

My problem: I don’t know hot to grab the data from JSON Array

The output is e.g

[[timestamp,value1,value2],[timestamp,value1,value2]]

Series 1 should be -> timestamp and value1

Series 2 should be -> timestamp and value2

This is my code

// Draw the chart
$(function(){

        /* The chart is drawn by getting the specific data from "data.php".
         * The configuration settings are transmitted by GET-Method. The output is an JSON-Array.  */

        $.getJSON('data.php',
        function(data) {


        chart = new Highcharts.StockChart
        ({
        chart:  {  renderTo: 'chartcontainer', type: 'line'  },
        title:  { text: 'You see the data of the last hour!' },
        xAxis: {  type: 'datetime', title: { text: 'time'  } },
        yAxis: { title: { text: 'unit'  } },
        series: [{ name: 'series1', data: data },{ name: 'series2', data: data }],

        });
    });
});

I think i have to change

series: [{ name: 'series1', data: data },{ name: 'series2', data: data }],

But I dont know in to what

  • 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-18T03:13:15+00:00Added an answer on June 18, 2026 at 3:13 am

    Iterate through all items of the data array, and populate two separate arrays:

    var series1 = [];
    var series2 = [];
    for (var i = 0; i < data.length; i++) {
      series1.push([data[0], data[1]);
      series1.push([data[0], data[2]);
    }
    

    You then have the timestamp-value pairs in each of the series arrays.

    Doing this in php might be more efficient, especially if you can replace the current json creation.

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

Sidebar

Related Questions

i want to target closest div from my anchor tag. so in order do
I want to target multiple buttons and get different value by clicking different button.
i want multiple target url to be redirected to for the different roles of
Due to multiple scripts I have on the target domain I want to redirect
If I have this: <span data-helo=1>something</span> <span data-helo=2>something different</span> and I want to target
I want to target an HTML element when BOTH the id and class selectors
So sometimes (oftentimes!) you want to target a specific .NET version (say 3.0), but
I can check for iPhone with this code: (navigator.userAgent.match(/iPhone/i)) But I want to target
I want preserve original value of target field and use json_decode to use following
I want to make a target in my MSBuild script that: Fetch SVN revision/datetime

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.