0

I have created a pie chart and now use ImageMapster to style it all. When I click a piece of pie, I want all the other pieces to become selected (opacity), but not the one I clicked on.

Does anybody know how to accomplish this?

My code so far:

   $('.pie').mapster({
            stroke: true,
            strokeOpacity: 1.0,
            strokeColor: '000000',
            strokeWidth: 1,
            singleSelect: true,
            fill: true,
            fillColor: '0000ff',
            fillOpacity: 0.25,

            render_select: 
            {
                fillOpacity: 0.75,
                fillColor: '000000'
            },
            render_highlight: 
            {
                fillOpacity: 0.5,
                fillColor: '00ff00'
            },
            onClick: function(e) { 

                // Select all pies but not this one.
                $('.pie area').mapster('select');
            }
    });
Fernando Redondo
  • 1,557
  • 3
  • 20
  • 38

1 Answers1

2

This should work:

onClick: function(e) { 
    // unselect the clicked one
    $(this).mapster('deselect');

    // Select all pies but not this one.
     $('.pie area').not(this).mapster('select');

    // prevent default click handling
    return false;
}
Jamie Treworgy
  • 23,934
  • 8
  • 76
  • 119
  • Hmm. I see no difference with our without this code. I have stepped through it and so forth, so it is running, but nothing happends. Not even the clicked one gets deselected. – Fernando Redondo Apr 16 '13 at 14:46
  • I had one mistake (the first one should be deselect) - fixed - however without seeing your HTML it's hard to be sure the selector is correct. I was just going with what you had posted, but maybe `.pie area` isn't corret – Jamie Treworgy Apr 16 '13 at 15:31