Polychart full window sized
(needs polychart as a source file)
by achudars
HTML
<script src="https://raw.github.com/Polychart/polychart2/develop/polychart2.standalone.js"></script>
<body>
<div id="chart"></div>
</body>http://jsfiddle.net/#save
CSS
body {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
JavaScript
var searchterms = polyjs.data({
term: ["Flower", "Chocolate", "Candy", "Valentine"],
count: [16600000, 9140000, 7480000, 5000000]
});
var options = {
layer: {
data: searchterms,
type: "bar",
x: "term",
y: "count"
},
title: "Monthly Google Search",
dom: "chart",
width: 300,
height: 250
};
$(window).resize(respondCanvas);
function respondCanvas() {
options.width = jQuery("body").width();
options.height = jQuery("body").height();
//Call a function to redraw other content (texts, images etc)
polyjs.chart(options);
}
//Initial call
respondCanvas();