Sections
Links
- Tutorial
- API Reference
- DataView Object
- Events
- Standard Visualization Methods and Properties
- Assorted Static Methods
- arrayToDataTable()
- drawChart()
- This method creates a chart in a single call. This method does not return a handle to the created chart, so you cannot assign method listeners to catch chart events.
- drawToolbar()
- Formatters
-
ArrowFormat Adds an up or down arrow, indicating whether the cell value is above or below a specified value. BarFormat Adds a colored bar, the direction and color of which indicates whether the cell value is above or below a specified value. ColorFormat Colors a cell according to whether the values fall within a specified range. DateFormat Formats a Date or DateTime value in several different ways, including "January 1, 2009," "1/1/09" and "Jan 1, 2009." NumberFormat Formats various aspects of numeric values. PatternFormat Concatenates cell values on the same row into a specified cell, along with arbitrary text.
-
- Visualization: Table
- Error Display
Steps
-
Load the Ajax API
-
Statically
<!--Load the AJAX API--> <script type="text/javascript" src="https://www.google.com/jsapi"></script>
-
function gvizLoaded() { var jscode_table = new google.visualization.Table(document.getElementById('table_div_jscode'));} } function loadGviz() { google.load("visualization", "1", {packages:["table"], callback: "gvizLoaded"}); } function initLoader() { var script = document.createElement("script"); script.src = "https://www.google.com/jsapi?callback=loadGviz"; script.type = "text/javascript"; document.getElementsByTagName("head")[0].appendChild(script); }
-
Draw the visualization
-
Python
Links
- Google visualization Python API
-
description = [ ("item", "string", "Item"), ("count", "number", "Count"),] data = [ ("Yellow", 100000), ("Orange", 120000), ("Red", 110000), ("Magenta", 130000), ("Cyan", 88000), ] data_table = gviz_api.DataTable(description) data_table.LoadData(data) print "ToJSon\n", data_table.ToJSon(), "\n\n" print "ToJSonResponse\n", data_table.ToJSonResponse(), "\n\n" print "ToJSCode\n", data_table.ToJSCode("jscode_data"), "\n\n"
Notes
- Supported types
string, number, boolean, date, datetime, timeofday
- definition in source code
if desc_dict["type"] not in ["string", "number", "boolean", "date", "datetime", "timeofday"]: