Last active
June 15, 2016 13:06
-
-
Save boddhisattva/6389016 to your computer and use it in GitHub Desktop.
Sample Barchart with G Raphael
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
<!--<!doctype html>--> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Static Bar Charts</title> | |
<link rel="stylesheet" href="css/demo.css" type="text/css" media="screen" charset="utf-8"> | |
<link rel="stylesheet" href="css/demo-print.css" type="text/css" media="print" charset="utf-8"> | |
<script src="https://raw.github.com/DmitryBaranovskiy/g.raphael/master/raphael-min.js" type="text/javascript" charset="utf-8"></script> | |
<script src="https://raw.github.com/DmitryBaranovskiy/g.raphael/master/g.raphael.js" type="text/javascript" charset="utf-8"></script> | |
<script src="https://raw.github.com/DmitryBaranovskiy/g.raphael/master/g.bar.js" type="text/javascript" charset="utf-8"></script> | |
<script type="text/javascript" charset="utf-8"> | |
window.onload = function () { | |
var r = Raphael("holder"), | |
data1 = [[55, 20, 13, 32, 5, 1, 2, 10], [10, 2, 1, 5, 32, 13, 20, 55], [12, 20, 30]], | |
data2 = [[55, 20, 13, 32, 5, 1, 2, 10], [10, 2, 1, 5, 32, 13, 20, 55], [12, 20, 30]], | |
data3 = [[55, 20, 13, 32, 5, 1, 2, 10], [10, 2, 1, 5, 32, 13, 20, 55], [12, 20, 30]], | |
txtattr = { font: "12px 'Fontin Sans', Fontin-Sans, sans-serif" }; | |
r.text(160, 10, "Single Series Chart").attr(txtattr); | |
// r.text(480, 10, "Multiline Series Chart").attr(txtattr); | |
// r.text(160, 250, "Multiple Series Stacked Chart").attr(txtattr); | |
// r.text(480, 250, 'Multiline Series Stacked Vertical Chart. Type "round"').attr(txtattr); | |
var labels = ["Company X", "Company Y", "Company Z"] | |
var barChart = r.barchart(10, 10, 300, 220, [[9,5,2]], 0, {stacked: true, type: "soft"})//.label([labels]); | |
barChart.addlabels = function () { | |
this.bars | |
console.log(this.bars); | |
}; | |
barChart.addlabels(); | |
//r.barchart(10, 10, 300, 220, [[55, 20, 13, 32, 5, 1, 2, 10]], 0, {type: "sharp"}).label([['C', 'D', 'E', 'G', 'L', 'M', 'P', 'S1']]); | |
//barChart.label(['a','b','c']); | |
// r.barchart(330, 10, 300, 220, data1); | |
// r.barchart(10, 250, 300, 220, data2, {stacked: true}); | |
// r.barchart(330, 250, 300, 220, data3, {stacked: true, type: "round"}); | |
}; | |
</script> | |
</head> | |
<body class="raphael" id="g.raphael.dmitry.baranovskiy.com"> | |
<div id="holder"></div> | |
<p> | |
Demo of <a href="http://g.raphaeljs.com/">G Raphael</a> JavaScript library. | |
</p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for the easy example..
Glad it works with pdfs generated by
wkhtmltopdf
lib on OSX.. :)