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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:42:58+00:00 2026-06-17T08:42:58+00:00

Consider: value1 = 5; v1_color = #ff0000; value2 = 4; v2_color = #00ff00; value3

  • 0

Consider:

value1 = 5;
v1_color = #ff0000;

value2 = 4;
v2_color = #00ff00;

value3 = 3;
v3_color = #0000ff;

var r = Raphael("holder");
pie = r.piechart(320,320,250,{value1,value2,value3},{colors: [v1_color, v2_color,v3_color]});

This will produce a pie chart where the upper slice is red, the slice on the bottom right is green, and the final slice is blue. However, if the values were changed like this:

value1 = 4;
value2 = 3;
value3 = 5;

the chart would look exactly the same, but the colors wouldn’t represent the proper value anymore. In the source code, lines 99-101 show the values being sorted, but nothing else.

I want a color to correspond to a certain variable, no matter how large it is, rather than the largest variable getting the first color listed in the options.

In the part of the code where it draws the slices (line 133), it refers to opts.matchColors, but I can’t find any documentation about how to set that when calling the function.

Any ideas how to achieve this?

  • 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-17T08:42:59+00:00Added an answer on June 17, 2026 at 8:42 am

    Unfortunately opts.matchColors is not documented at all because it is exactly what you need.

    opts.matchColors forces it to match the order of the colors array with the order of the values array. When the values are reordered by size, the colors will be applied to the wedge with their original values.

    matchColors defaults to false, so you will need to explicitly set it in the options array like this:

    var pie = r.piechart(320, 320, // center
                         250,      // radius
                         [
                             value1,
                             value2,
                             value3
                         ],
                         {
                             colors       : [
                                                v1_color,
                                                v2_color,
                                                v3_color
                                            ],
                              matchColors : true
                         });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider a table: a b c d key1 value1 value2 value3 key2 value1a value3a
Consider the example: enum SomeEnum { VALUE1(value1), VALUE2(value2), VALUE3(value3) ; private String value; private
Consider the following two enums: enum MyEnum1 { Value1 = 1, Value2 = 2,
Consider this struct. public struct myStruct{ public int value1; public int value2; public int
If you will consider the following table table_A (id (PK), value1, value2) If I
Consider this Python segment: def someTestFunction(): if someTest: return value1 elif someOtherTest: return value2
Consider a table with 3 columns Value1 operator value2 abc = xyz 1 !=
Consider the following code: Dim sql = SELECT * FROM MyTable WHERE value1 =
Consider the following text: var t=asdf t1 : v1 xasdf dfas sdf t2 :
Consider this data { _id : ..., array : [ { name : value1,flag

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.