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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:21:33+00:00 2026-06-16T00:21:33+00:00

I need a pie chart and found Flot . It looks simple and powerful,

  • 0

I need a pie chart and found Flot. It looks simple and powerful, but all of the examples I have found describe the “data” using fixed values (e.g. [1,2]) but I need to show dynamic data. I have five variables that must ultimately add up to 100. I want to include only those that have a value > 0, and if they don’t total to 100, I want to add an element that shows the missing percent. The problem is that I don’t know how to dynamically construct the data parameter.

My code is below. There are two problems with it:
1) The $.plot does nothing – no error and no grapy
2) I don’t know how to add the label text

function updatePieChart() {
    var total = 0;
    var data = new Array();
    var verb = "";
    var dataIndex = 0;

    for (var dataIndex = 0; dataIndex < 5; dataIndex++) {
        var duty = "DUTY_" + (dataIndex + 1);
        var d = getData(duty + "_PERCENTAGETIMESPENT");
        if (isNumeric(d)) {
            d = parseInt(d);
            if (d > 0) {
                total += d;
                data[dataIndex] = new Array();
                data[dataIndex].push(d);
                verb = getData(duty + "_SKILL");
                if (verb == "") verb = duty + dataIndex;
                log(duty + dataIndex + ' value: ' + d);
            }
        }
    }

    var count = data.length;
    if (total != 100) {
        if (total < 100) {
            var missingDataNum = 100 - total;
            data[count] = new Array();
            data[count].push(missingDataNum);
            verb = '**MISSING**';
            log(verb + missingDataNum);
        }
    }

    $.plot($('#pieChart'), data,
        {
        series: {
            pie: {
                show: true,
            }
        },
        legend: {
            show: false
        }
    });
}
  • 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-16T00:21:33+00:00Added an answer on June 16, 2026 at 12:21 am

    Fixed. See What is the format of jQuery Flot data when passing in the data as variables. Problem was that I wasn’t formatting the data object as a jSON object correctly.

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

Sidebar

Related Questions

I am trying to get a pie chart display correctly but have found there
I have a pie chart which is made using UIBezierPath's. I now need those
I have a pie chart and I need to change the size of the
I have a doubt here, I need to show a pie-chart in SSRS, for
I am creating a drilldown report in SSRS using pie chart. I have done
I'm using Telerik WinForms, the lastest version. I have pie chart, 1 series with
what i need to do is load my pie data chart created with extjs4
I know a pie chart plugin exists for Raphael JS, but I need to
I'm trying to plot (with Flot ) a pie chart with some data var
I am drawing a pie chart using the CPTXYGraph in Core Plot. I have

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.