0
votes

I'm new to FusionCharts.
I have generated a pie chart with slice, my question is:

When I click on the slice in the pie chart, I need the label name of the slice.

How can I write the on click event and get the name of label?

3

3 Answers

0
votes

I don't much about charts and such, I'm fine using Word for this. But in 2D Graphics I've learned you can use

...contains(shape) ...intersects(shape)

To see if shapes are inside eachother (to contain) or if they overlap eachother (to intersect).

When adding a mouseListener, you can use

e.getX() and e.getY()

to get the current X and Y position of mouse on screen.

So something like

for (pieChartPieces p: piece)
{
    if (pieChartShape.contains(e.getX, e.getY))
    {
        //* Some kind of notifier for user pops up here.
    }
}
0
votes

Check out this fiddle here

It uses "dataplotClick" event to retrieve the label of the pie slice.

-1
votes

You have to use link attribute, as seen here.

"link": "JavaScript:populate('411');",

See the jsFiddle.

Don't forget to implement the populate() with the whatever you need to do.

Link to a similar question (with answer).