summaryrefslogtreecommitdiff
path: root/test/g.raphael/examples/barchart/barchart_hoverCol.html
blob: 0c615746ff3666f680d21d7d33f3befc6802eca5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<html>
    <head>
        <title>gRaphaël Bar Chart - a .hoverColumn() example</title>
        <script type="text/javascript" src="../raphael-min.js"></script>
        <script type="text/javascript" src="../../g.raphael-min.js"></script>
        <script type="text/javascript" src="../../g.bar-min.js"></script>
        <script type="text/javascript">
            window.onload = function() {
                // Creates canvas 640 × 480 at 10, 50
                var r = Raphael(10, 50, 640, 480);
                
                // Creates a stacked series barchart at 10, 10
                // width 300, height 220, data: [55, 20, 13],[16,11,5]
                r.g.barchart(10, 10, 300, 220, [[55, 20, 13],[16,11,5]], {stacked:true}).hoverColumn(function() { 
		    	var y = [], res = [];
                        for (var i = this.bars.length; i--;) {
                            y.push(this.bars[i].y);
                            res.push(this.bars[i].value || "0");
                        }
                        this.flag = r.g.popup(this.bars[0].x, Math.min.apply(Math, y), res.join(", ")).insertBefore(this);
                }, function() {
                    	this.flag.animate({opacity: 0}, 3000, ">", function () {this.remove();});
                });
            }
        </script>
    </head>
    <body>   
    </body>
</html>