Created
February 3, 2010 14:44
-
-
Save beathyate/293647 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.onload = function () { | |
var r = Raphael("holder"), | |
xs = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23], | |
ys = [7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], | |
data = [294, 300, 204, 255, 348, 383, 334, 217, 114, 33, 44, 26, 41, 39, 52, 17, 13, 2, 0, 2, 5, 6, 64, 153, 294, 313, 195, 280, 365, 392, 340, 184, 87, 35, 43, 55, 53, 79, 49, 19, 6, 1, 0, 1, 1, 10, 50, 181, 246, 246, 220, 249, 355, 373, 332, 233, 85, 54, 28, 33, 45, 72, 54, 28, 5, 5, 0, 1, 2, 3, 58, 167, 206, 245, 194, 207, 334, 290, 261, 160, 61, 28, 11, 26, 33, 46, 36, 5, 6, 0, 0, 0, 0, 0, 0, 9, 9, 10, 7, 10, 14, 3, 3, 7, 0, 3, 4, 4, 6, 28, 24, 3, 5, 0, 0, 0, 0, 0, 0, 4, 3, 4, 4, 3, 4, 13, 10, 7, 2, 3, 6, 1, 9, 33, 32, 6, 2, 1, 3, 0, 0, 4, 40, 128, 212, 263, 202, 248, 307, 306, 284, 222, 79, 39, 26, 33, 40, 61, 54, 17, 3, 0, 0, 0, 3, 7, 70, 199], | |
axisy = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], | |
axisx = ["12am", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12pm", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11"]; | |
r.g.txtattr.font = "11px 'Fontin Sans', Fontin-Sans, sans-serif"; | |
r.g.dotchart(10, 10, 620, 260, xs, ys, data, { | |
symbol: "o", | |
max: 10, | |
heat: true, | |
axis: "0 0 1 1", | |
axisxstep: 23, | |
axisystep: 6, | |
axisxlabels: axisx, | |
axisxtype: " ", | |
axisytype: " ", | |
axisylabels: axisy | |
}).hover( | |
function () { | |
this.tag = this.tag || r.g.tag(this.x, this.y, this.value, 0, this.r + 2).insertBefore(this); | |
this.tag.show(); | |
}, | |
function () { | |
this.tag && this.tag.hide(); | |
}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.onload = function () { | |
var r = Raphael("holder"), | |
fin = function () { | |
this.flag = r.g.popup(this.bar.x, this.bar.y, this.bar.value || "0").insertBefore(this); | |
}, | |
fout = function () { | |
this.flag.animate({opacity: 0}, 300, function () {this.remove(); | |
}); | |
}, | |
fin2 = 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); | |
}, | |
fout2 = function () { | |
this.flag.animate({opacity: 0}, 300, function () {this.remove(); | |
}); | |
}; | |
r.g.txtattr.font = "12px 'Fontin Sans', Fontin-Sans, sans-serif"; | |
r.g.text(160, 10, "Single Series Chart"); | |
r.g.text(480, 10, "Multiline Series Stacked Chart"); | |
r.g.text(160, 250, "Multiple Series Chart"); | |
r.g.text(480, 250, "Multiline Series Stacked Chart\nColumn Hover"); | |
r.g.barchart(10, 10, 300, 220, [[55, 20, 13, 32, 5, 1, 2, 10]]).hover(fin, fout); | |
r.g.hbarchart(330, 10, 300, 220, [[55, 20, 13, 32, 5, 1, 2, 10], [10, 2, 1, 5, 32, 13, 20, 55]], {stacked: true}).hover(fin, fout); | |
r.g.hbarchart(10, 250, 300, 220, [[55, 20, 13, 32, 5, 1, 2, 10], [10, 2, 1, 5, 32, 13, 20, 55]]).hover(fin, fout); | |
var c = r.g.barchart(330, 250, 300, 220, [[55, 20, 13, 32, 5, 1, 2, 10], [10, 2, 1, 5, 32, 13, 20, 55]], {stacked: true, type: "soft"}).hoverColumn(fin2, fout2); // c.bars[1].attr({stroke: "#000"}); }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.onload = function () { | |
var r = Raphael("holder"); | |
r.g.txtattr.font = "12px 'Fontin Sans', Fontin-Sans, sans-serif"; | |
r.g.text(320, 100, "Interactive Pie Chart").attr({"font-size": 20}); | |
var pie = r.g.piechart(320, 240, 100, [55, 20, 13, 32, 5, 1, 2, 10], { | |
legend: ["%%.%% – Enterprise Users", "IE Users"], | |
legendpos: "west", | |
href: ["http://raphaeljs.com","http://g.raphaeljs.com"] | |
}); | |
pie.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}); | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment