©2009 Google -
Code Home -
Terms of Service -
Privacy Policy -
Site Directory
Google Code offered in:
English -
Español -
日本語 -
한국어 -
Português -
Pусский -
中文(简体) -
中文(繁體)
A line chart that is rendered as an image using the Google Charts API.
By: Google
Code it yourself on the Visualization Playground
<html>
<head>
<script type='text/javascript' src='http://www.google.com/jsapi'></script>
<script type='text/javascript'>
google.load('visualization', '1', {packages:['imagelinechart']});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Year');
data.addColumn('number', 'Sales');
data.addColumn('number', 'Expenses');
data.addRows(4);
data.setValue(0, 0, '2004');
data.setValue(0, 1, 1000);
data.setValue(0, 2, 400);
data.setValue(1, 0, '2005');
data.setValue(1, 1, 1170);
data.setValue(1, 2, 460);
data.setValue(2, 0, '2006');
data.setValue(2, 1, 860);
data.setValue(2, 2, 580);
data.setValue(3, 0, '2007');
data.setValue(3, 1, 1030);
data.setValue(3, 2, 540);
var chart = new google.visualization.ImageLineChart(document.getElementById('chart_div'));
chart.draw(data, {width: 400, height: 240, min: 0});
}
</script>
</head>
<body>
<div id='chart_div'></div>
</body>
</html>
The google.load package name is "imagelinechart"
google.load('visualization', '1', {packages: ['imagelinechart']});
The visualization's class name is google.visualization.ImageLineChart
var visualization = new google.visualization.ImageLineChart(container);
The first column should be a string, and contain the category label. Any number of columns can follow, all must be numeric. Each column is displayed as a separate line.
| Name | Type | Default | Description |
|---|---|---|---|
| colors | Array of strings | Default colors | The colors to use for the chart elements. An array of strings. Each element is a string in the format #rrggbb. For example '#00cc00'. |
| height | number | Container's height | Height of the chart in pixels. |
| legend | string | 'right' | Position and type of legend. Can be one of the following:
|
| max | number | automatic | The maximal value to show in the Y axis. |
| min | number | automatic | The minimal value to show in the Y axis. |
| showAxisLines | boolean | true | If set to false, removes axis lines and labels. |
| showCategoryLabels | boolean | same as showAxisLines | If set to false, removes the labels of the categories (the X axis labels). |
| showValueLabels | boolean | same as showAxisLines | If set to false, removes the labels of the values (the Y axis labels). |
| title | string | no title | Text to display above the chart. |
| width | number | Container's width | Width of the chart in pixels. |
| Method | Return Type | Description |
|---|---|---|
draw(data, options) |
none | Draws the chart. |
No triggered events.
Please refer to the Chart API logging policy.