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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:50:12+00:00 2026-06-02T08:50:12+00:00

I have an issue with Flot charts and the data that is coming from

  • 0

I have an issue with Flot charts and the data that is coming from AJAX. Basically I created arrays to display the graph but somehow I see the axis label but no data. Also how can I do a stacked or a bar graph?

Edit: Or can anybody tell me how to display data in flot using AJAX with labels on the x-axis. You can see the code here http://jsfiddle.net/DaG5W/284/. Anybody please let me know what I am doing wrong here?

Here is the code I used.

$.getJSON(url, function(output) {
    var calendar, count, fieldNames, i, j, values, xAxis;
    fieldNames = new Array();
    i = 0;
    while (i < output.length) {
      if (fieldNames.indexOf(output[i].FieldName) < 0) {
        fieldNames.push(output[i].FieldName);
      }
      i++;
    }
    calendar = new Array();
    i = 0;
    while (i < output.length) {
      if (calendar.indexOf(output[i].Calendar) < 0) {
        calendar.push(output[i].Calendar);
      }
      i++;
    }
    xAxis = [];
    i = 0;
    while (i < calendar.length) {
      xAxis.push([parseInt(i + 1), calendar[i]]);
      i++;
    }
    data = [];
    i = 0;
    while (i < fieldNames.length) {
      values = [];
      count = 0;
      j = 0;
      while (j < output.length) {
        if (fieldNames[i] === output[j].FieldName) {
          count++;
          values.push([parseInt(count), parseInt(output[j].Totals)]);
        }
        j++;
      }
      data.push([
        {
          label: fieldNames[i].toString(),
          data: values,
          bars: {
            show: true
          },
          lines: {
            show: false
          }
        }
      ]);
    }
    return i++;
  });
  options = {
    xaxis: {
      ticks: xAxis
    }
  };
  plot = $.plot($("#div"), [data], options);

}
  • 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-02T08:50:13+00:00Added an answer on June 2, 2026 at 8:50 am

    You’re very close to a working solution. All you’ve done incorrectly is to nest a few too many arrays in 2 places:

      data.push([
        {
          label: fieldNames[i].toString(),
          data: values,
          bars: {
            show: true
          },
          lines: {
            show: false
          }
        }
      ]);
    

    No need for the [] around your series object.

    plot = $.plot($("#div"), [data], options);
    

    Similarly here, no need for [] around data. After that, it will graph. See here: http://jsfiddle.net/ryleyb/DaG5W/291/

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

Sidebar

Related Questions

I have issue with displaying AlertDialog from Service. I am able to display custom
I have issue that is reproduced on g++. VC++ doesn't meet any problems. So
I have an issue with an open source C++ project that I have been
Much of my sql code is generated (from POD). Now i have issue where
Have another issue here. Our app starts out with a tab activity. But, before
I have an issue that, while using sql server 2005 i have executed update
MSSQL database. I have issue to create database using old databases data. Old database
I have an issue I can't seem to track down. I am using Flot
I have issue with letters when posting data to server NSString *url = [NSString
i have done drag and drop using with jquery. here i have issue that

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.