Skip to content

Instantly share code, notes, and snippets.

@battlehorse
battlehorse / index.html
Created November 2, 2011 15:21
Demo script to convert Google Chart Tools charts into PNG images.
<html>
<head>
<script type="text/javascript" src="http://canvg.googlecode.com/svn/trunk/rgbcolor.js"></script>
<script type="text/javascript" src="http://canvg.googlecode.com/svn/trunk/canvg.js"></script>
<script>
function getImgData(chartContainer) {
var chartArea = chartContainer.getElementsByTagName('iframe')[0].
contentDocument.getElementById('chartArea');
var svg = chartArea.innerHTML;
var doc = chartContainer.ownerDocument;
@battlehorse
battlehorse / multi_dashboard.html
Created September 26, 2011 14:28
A Google Charts dashboard setup where multiple datatables are used to power a single 'logical' dashboard.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>
Google Visualization API Sample
</title>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1', {packages: ['controls']});
@battlehorse
battlehorse / background.html
Created September 25, 2011 14:22
Attempt to draw Google Charts in Chrome extension popups, while loading the API in the background page
<!DOCTYPE html>
<html>
<head>
// Autoload the 'corechart' visualization library, as described in:
// http://code.google.com/apis/chart/interactive/docs/library_loading_enhancements.html#enhancedloading
//
// the 'autoload' parameter is URI encoded.
<script type="text/javascript" src="https://www.google.com/jsapi?autoload=%7B%22modules%22%3A%5B%7B%22name%22%3A%22visualization%22%2C%22version%22%3A%221%22%2C%22packages%22%3A%5B%22corechart%22%5D%7D%5D%7D"></script>
</head>
<body>
@battlehorse
battlehorse / test.html
Created September 12, 2011 10:38
A Google Visualization API dashboard containing a map
<html>
<head>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1', {packages: ['controls', 'corechart', 'table','map']});
</script>
<script type="text/javascript">
var visualization;
function drawVisualization() {
@battlehorse
battlehorse / index.html
Created August 3, 2011 09:46
Google Chart Tools controls and dashboards API: hide a chart until a specific set of categories has been chosen.
<!--
You are free to copy and use this sample in accordance with the terms of the
Apache license (http://www.apache.org/licenses/LICENSE-2.0.html)
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>
@battlehorse
battlehorse / index.html
Created May 17, 2011 09:11
Google Chart Tools controls and dashboards API: using a view specification with custom column reordering and generated columns.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
You are free to copy and use this sample in accordance with the terms of the
Apache license (http://www.apache.org/licenses/LICENSE-2.0.html)
-->
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>
Google Visualization API Sample
<!doctype html>
<html>
<head>
<link href='http://fonts.googleapis.com/css?family=Permanent+Marker|Rock+Salt' rel='stylesheet' type='text/css'>
<style>
BODY {
background-color: #777;
}