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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:47:27+00:00 2026-05-27T06:47:27+00:00

i am customizing the pie chart given on the raphael site below link http://raphaeljs.com/pie.html

  • 0

i am customizing the pie chart given on the raphael site below link
http://raphaeljs.com/pie.html

this chart shows animation when hover a slice, this animation simply expand the slice a little

what i want is to separate the slice from the chart

i played with the transform property of following lines of code but could not make it as i want.

p.mouseover(function () {
var xis= p.getBBox(true);
p.stop().animate({transform: "s1.1 1.1 "+ cx + " " + cy }, ms, "linear");
txt.stop().animate({opacity: 1}, ms, "linear");
}).mouseout(function () {
p.stop().animate({transform: ""}, ms, "linear");
txt.stop().animate({opacity: 0}, ms);
});

Changing the line 3’s cx and cy actually fixed the animation for every slice in the same manner, that is, on hover every slice will change the position constantly.

http://imageshack.us/photo/my-images/690/sliced1.png

anyone please help me out to solve this problem

  • 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-05-27T06:47:28+00:00Added an answer on May 27, 2026 at 6:47 am

    If I understand your question correctly, you want the slice to completely disconnect from the pie chart when somebody hovers over it.

    To do this, you want to translate the segment, which allows you to move an SVG object in a given direction, toward x, y co-ordinates. I’m no SVG pro, so I’d suggest taking a look into the full functionality of this yourself; regardless, to do these types of operations with Raphael, you can use the Element.transform, or can provide transform values in an animate call.

    The second of these is what is happening in the example you provided, except a scale transformation is being used, as indicated by the leading s in transform: "s1.1 1.1.. A scale will make the object bigger.

    Here, you want to use a translation which moves the object but doesn’t make it bigger – it uses a t.

    Here is a slightly edited block of code that will do this:

            p.mouseover(function () {
                var distance = 20;
                var xShiftTo = distance*Math.cos(-popangle * rad);
                var yShiftTo = distance*Math.sin(-popangle * rad);
                p.stop().animate({transform: "t" + xShiftTo + " " + yShiftTo}, ms, "bounce");
                txt.stop().animate({opacity: 1}, ms, "bounce");
            }).mouseout(function () {
                p.stop().animate({transform: ""}, ms, "bounce");
                txt.stop().animate({opacity: 0}, ms);
            });
    

    In the example, distance refers to how far the slice should move away (so feel free to adjust this), xShiftTo and yShiftTo calculate the x, y values that the object should shift by, relative to where they currently are. Note that this is a little complicated – you need to figure out the x, y values at a given angle away from the pie centre. The positioning of the text also does something like this, so I just took the required maths from there. Also, I just left the bounce animation, but you can change that to linear or whatever you want. Hope that helps.

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

Sidebar

Related Questions

I am actually customizing product details page with the help of http://virtuemart.net/documentation/Developer_Manual/Modifying_the_Layout.html this page.
I am trying to create a pie chart and am customizing the example here:
We are customizing workflow approval form to display the associated list item fields. This
I'm customizing a Wordpress site, and want to alter a file in the wp-includes
I am customizing my table cells. I have this code (simplified) which is giving
I am working on customizing the layout of a Silverlight Toolkit Chart. I have
I am customizing the softkeyboard sample of android SDK. The resolution of this keyboard
I'm customizing a TFS Work Item Type, adding a 'Business Description' HTML Field, but
I'm customizing my father-in-law's Orchard site and trying to create a .cshtml file to
I'm having issues customizing a radio button for a specific form using hook_theme. Below

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.