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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:24:10+00:00 2026-06-12T13:24:10+00:00

I have a pie chart with two types of data: ok and not ok.

  • 0

I have a pie chart with two types of data: ok and not ok. I want to render ok with green and not ok with red. I have searched in the documentation but with no results. So far my code is:

new CanvasXpress("orderProgressCanvas", {
  "y": {
    "vars": [
      "Ok",
      "No"
    ],
    "smps": [
      "Percentuale completamento"
    ],
    "colorRGB": [
      "rgb(0,255,0)",
      "rgb(255,0,0)"
    ],
    "data": [
      [
        progress
      ],
      [
        100-progress
      ]
    ]
  }
}, {
  "graphType": "Pie",
  "pieSegmentPrecision": 1,
  "pieSegmentSeparation": 2,
  "pieSegmentLabels": "outside",
  "pieType": "solid",
  "showLegend": false,
  "background" : "rgb(192,208,216)"
});

But color definition doesn’t work.. any idea?
progress is a javascript variable from 0 to 100.

Thanks

  • 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-12T13:24:12+00:00Added an answer on June 12, 2026 at 1:24 pm

    I asked to the main developer:

    Just put the colors you want in the colors property in the
    configuration. They will be selected in the order you specify them.
    Also make sure you specify enough colorr otherwise they will be
    recycled as they are used.

    'colors': ['rgb(234,234,1)', 'rgb(56,35,12)'.......etc]
    

    My code has become:

    new CanvasXpress("orderProgressCanvas", {
      "y": {
        "vars": [
          "Ok",
          "No"
        ],
        "smps": [
          "Percentuale completamento"
        ],
        "data": [
          [
            progress
          ],
          [
            100-progress
          ]
        ],
      }
    }, {
      "graphType": "Pie",
      "pieSegmentPrecision": 1,
      "pieSegmentSeparation": 2,
      "pieSegmentLabels": "outside",
      "pieType": "solid",
      "showLegend": false,
      "background" : "rgb(192,208,216)",
      "colors": [
               "rgb(57,133,0)",
               "rgb(163,0,8)"
               ],
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a pie chart but i am not able to put a hyperlink
I have a pie chart in BIRT and about 80 data points. I'm looking
I have a problem in binding JSON data to KENDO Pie Chart. I have
I am trying to get a pie chart display correctly but have found there
I have a pie chart created by graphael this.element = this.raphHolder.piechart(100, 100, 100, data,{legend
I have a pie chart and want to specify an exact color for a
I have some pretty basic data for a pie chart. Yes: 189.84 (57.03%) No:
I have the following codes to render a bar chart and a pie chart.
I want to have a JavaScript pie chart, I already have one with PlotKit,
I have a report that contains a pie chart within it. I would want

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.