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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:49:12+00:00 2026-06-12T09:49:12+00:00

I am using Flot to display a graph of timeseries data on a page.

  • 0

I am using Flot to display a graph of timeseries data on a page. The chart works fine with a single dataset, however I want to add the capability of multiple data sets grouped by tags.

I have the JSON outputs formatted to what they need to be to work correctly, I am just running into a problem when combining multiple datasets prior to being plotted.

I would like to get the datasets into the seriesArray array, however with the code below that array isn’t populated when I am plotting the graph.

There is data in the tagsList array at the end of the function so I set up the seriesArray to be populated in the same manner to no avail.

What am I missing?

var plotarea = $("#placeholder");
var data;   
var plot;
var tagsList=[];
var seriesArray = [];
$.getJSON("/items/getTags.json", function(tagsJSON) {
  $.each(tagsJSON, function(key, val) {
    tagsList.push(val.name);
    $.getJSON("/data/"+val.name+".json", function(json) {
      data = [{label:val.name, data:format(json)}];
      seriesArray.push(data);
    });  
  });
  plot = $.plot(plotarea , seriesArray, {series:{ lines: {show: true},points: {show:true}},
      xaxis: {
          mode: "time",
          timeformat: "%m/%d/%y",
          tickDecimals: 0,
          minTickSize: [2,"day"]
      },
      yaxis: {
          minTickSize: 1,
          tickDecimals: 0
      }
  });
});
  • 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-12T09:49:13+00:00Added an answer on June 12, 2026 at 9:49 am

    You need to wait until all your AJAX calls to /data/tag.json are finished. You can use $.when().then() to do that.

    var plotarea = $("#placeholder");
    var data;
    var plot;
    var tagsList=[];
    var seriesArray = [];
    $.getJSON("/items/getTags.json", function(tagsJSON) {
        var deferreds = [];
        $.each(tagsJSON, function(key, val) {
            tagsList.push(val.name);
            deferreds.push($.getJSON("/data/"+val.name+".json", function(json) {
                data = [{label:val.name, data:format(json)}];
                seriesArray.push(data);
            }));
        });
        $.when(deferreds).then(function(){
            plot = $.plot(plotarea , seriesArray, {series:{ lines: {show: true},points: {show:true}},
                xaxis: {
                    mode: "time",
                    timeformat: "%m/%d/%y",
                    tickDecimals: 0,
                    minTickSize: [2,"day"]
                },
                yaxis: {
                    minTickSize: 1,
                    tickDecimals: 0
                }
            });
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to produce a line chart using Flot, but I want the data
I am using Flot to chart some data that I pull back from the
Im using jquery flot for displaying chart .... i want to show dual x-axis.....
I am using jquery flot for showing graph. Everything is working fine but vertical
I'm using Flot to plot a line graph and my data set is a
I am using flot to display a bar graph. Due to the long label
I am using a jquery flot map and i want to add a php
I use flot to display simple bar charts. I have single dataset like [
I'm using Flot to graph data and I can mimic the turning series on/off
I'd like to do a line-graph on a web-page using Javascript. I want it

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.