DmitryBaranovskiy / g.raphael

Charts for Raphaël
http://g.raphaeljs.com/
1.52k stars 436 forks source link

Pie sectors w/hover animation disappear seemingly at random #12

Open tarkatronic opened 15 years ago

tarkatronic commented 15 years ago

This bug does not manifest itself often; in fact, I have only been able to reproduce it with one particular set of results so far. However, I tested in Firefox, Chrome and IE7 and they all exhibited the same behaviour. Given this code:

<table>
  <tr><th>Response 1</th><td>1</td></tr>
  <tr><th>Response 2</th><td>1</td></tr>
  <tr><th>Response 3</th><td>2</td></tr>
</table>
<script type="text/javascript">
(function (raphael) {
    $(function () {
        var values = [],
            labels = [];
        $("tr").each(function () {
            val = parseInt($("td", this).text(), 10)
            values.push(val);
            labels.push("%%.% ("+ val +") " + $("th", this).text());
        });
        $("table").hide();
        raphael("holder", 840, 500).g.piechart(220, 220, 200, values, {legend:labels,legendpos:'east'}).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].scale(1.5);
                            this.label[1].attr({"font-weight": 800});
                        }
                    },
                    function () {
                        this.sector.animate({scale: [1, 1, this.cx, this.cy]}, 500, "bounce");
                        if (this.label) {
                            this.label[0].animate({scale: 1}, 500, "bounce");
                            this.label[1].attr({"font-weight": 400});
                        }
                    });
                });
})(Raphael.ninja());
</script>

When moving my mouse focus off of either of the bottom sectors (the ones with a value of 1), there is a chance they may simply disappear. In IE, this freezes all future mouseout animation on the sectors to cease, although mouseover animation still fires. The label animation also still fires on both events. In Firefox and Chrome, all animation events still fire, even the label animation for the sector which disappeared.

This is happening with raphael 1.0, 1.1 and 1.2.1 using g.raphael 0.4 and g.raphael.pie 0.4

kpobococ commented 14 years ago

It's happening to me with Raphael's demo http://g.raphaeljs.com/piechart2.html on FF 3.6b2.