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

The Archive Base Latest Questions

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

Background I was able to get the graphael example of a dynamic pie chart

  • 0

Background

I was able to get the graphael example of a dynamic pie chart working. However, I’m having a problem understanding the syntax…

The example passes in two HTML links and seems to associate the links with two labels and two specific slices of the pie but it’s not obvious how those correlations or associations happen in the string that’s passed into the “piechart” method. I tried to pass in a few more links but the code seems to randomly associate the links with the labels. There doesn’t seem to be an obvious way to ensure that Link1 is always associated with Label1.

Question

Does anyone know how to clearly explain what’s happening in the code? How are the two links being associated with only two slices of the pie? How could I consistently associate links with labels and specific slices of the pie?

Note

I personally don’t like that the piechart function takes in three “separate” strings of values, labels, and links that are not collocated with each other, as it makes the code hard to read. The original looks as follows…

Example

pie = r.piechart(320, 240, 100, [55, 20, 13, 32, 5, 1, 2, 10], { legend: ["%%.%% - Enterprise Users", "IE Users"], legendpos: "west", href: ["http://raphaeljs.com", "http://g.raphaeljs.com"]}); r.text(320, 100, "Interactive Pie Chart").attr({ font: "20px sans-serif" });)

Instead it would be nicer to be able to pass in an array of arrays… array = [[SliceValue1, label1, link1], [SliceValue2, label2, link2], etc. If anyone has an idea of how to do this, it would be a great way to clean the code up and make it more readable.

Source Code

<script>
  window.onload = function () {
    var r = Raphael("holder"),
    pie = r.piechart(320, 240, 100, [55, 20, 13, 32, 5, 1, 2, 10], { legend: ["%%.%% - Enterprise Users", "IE Users"], legendpos: "west", href: ["http://raphaeljs.com", "http://g.raphaeljs.com"]});
    r.text(320, 100, "Interactive Pie Chart").attr({ font: "20px sans-serif" });
    pie.hover(function () {
      this.sector.stop();
      this.sector.scale(1.1, 1.1, this.cx, this.cy);
      if (this.label) {
        this.label[0].stop();
        this.label[0].attr({ r: 7.5 });
        this.label[1].attr({ "font-weight": 800 });
      }
    }, function () {
    this.sector.animate({ transform: 's1 1 ' + this.cx + ' ' + this.cy }, 500, "bounce");
    if (this.label) {
    this.label[0].animate({ r: 5 }, 500, "bounce");
    this.label[1].attr({ "font-weight": 400 });
    }
    });
  };
</script>
  • 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:29:37+00:00Added an answer on June 2, 2026 at 8:29 am

    The better answer for this was using D3.js. Here’s a working example… “Multiple D3 Pie Charts Mixed In With HTML Layout Constructs“.

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

Sidebar

Related Questions

I was able to get the background changed of an individual listview item in
Background: (Read before you flame...) I want a user to be able to SELECT
Background: I'm coming from C#-land, so I'm looking for something like being able to
I was never able to fully understand what is going on in the background
I'm trying to migrate to NewsstandKit to benefit from background download. I'm being able
Background I admit, this question stems from an ultimate lack of deep understanding of
I have been able to get the clicked pagination item to respond to a
I would like to be able to get the style from a CSS element
When i don't set background of my panel i can not get mouse events
I'm building an image gallery and have been able to get the clicked thumbnail

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.