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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:56:20+00:00 2026-06-14T19:56:20+00:00

I am using Flot to plot graphs for my client side php’s. In one

  • 0

I am using Flot to plot graphs for my client side php’s. In one graph i need Percentage Stack Graph, and i have found out that there is a plugin in Flot called Percentage Stack Plugin.

I want my Graph to be something like this.

Expected Percentage Stack

But when i implement the plugin i get something like this.

Actual Percentage Stack

I tried their example and its working fine. I think this problem is with the JSON data i pass.

My JSON looks like this.

  [{"data":[[-64.483189655172,74.483189655172]],"label":"machine_52"},{"data":[[-142.91077586207,152.91077586207]],"label":"machine_23"},{"data":[[-220.57456896552,230.57456896552]],"label":"machine_90"},{"data":[[-304.05043103448,314.05043103448]],"label":"machine_48"},{"data":[[-388.56163793103,398.56163793103]],"label":"machine_98"}]

X values are Uptime percentage and Y values DownTime Percentage. is those values should be less than 100 for ploting the graph.

My JS code looks like this.

    <script language="javascript" type="text/javascript">  

$(document).ready(function(){
$.getJSON('barLine.txt', function(json) {

    $.plot($("#placeholder"),json, { series: {
        stackpercent: true,
        bars: { show: true, barWidth: 0.6, fillColor: {colors:[{opacity: 1},{opacity: 1}]}, align: "center" }
    },
    xaxis: {max:100},
    yaxis:{tickSize : 1}});
});
});

</script>     

How can fix this bug

  • 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-14T19:56:21+00:00Added an answer on June 14, 2026 at 7:56 pm

    OK… How does the stackpercent plugin change your data? What it does is add up the y values of everything with the same x value, and then create percentages based off of that.

    For your case, what you want to do is have two series, one with all the uptime values, one with all the downtime values. You line them up per machine, so that x = 0 in both series is the data for one of your machines.

    Your data will look like this:

    [
         {"label":"Down Time ","data":[[0,64],[1, 142],[2,220],[3,304],[4,388]],"color":"#B41722"},
         {"label":"Running Time","data":[[0, 74], [1, 152],[2,230],[3,314],[4,398]],"color":"#6A9A3C"} 
    ]
    

    So you can see I’ve taken your machine_52 data and split it into values in two series, the -64.xxxxx value is now [0,64] and it’s corresponding 74.xxx is in the 2nd series as [0,74].

    Then to connect that to the particular machine, you specify the xaxis.ticks option like this:

    ticks: [[0,'Machine 52'],[1,'Machine 23'],[2,'Machine 90'],[3,'Machine 48'],[4,'Machine 98']]
    

    The result looks like this: http://jsfiddle.net/ryleyb/uSVvu/

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

Sidebar

Related Questions

I am using Flot Graph Api to plot graphs, I want to plot time
Okay to get started I am using Jquery-Flot to plot a radial graph I
I need to create chart using Flot chart library, using PHP JSON functions (ie.
I am having problem with flot library to plot a graph using its line
Hi I need to create a flot graph. for that I am using this
I am using flot to generate bar graphs. Here is my code bar graph
I have a bar chart created using flot jsFiddle Code Now i need to
I'm using Flot to plot a line graph and my data set is a
I have a working flot graph, showing dynamically from sql using ajax. My problem
I have a requirement to Plot a graph with zoom feature using x axis

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.