Stay organized with collections Save and categorize content based on your preferences.
OverviewScatter charts plot points on a graph. When the user hovers over the points, tooltips are displayed with more information.
Google scatter charts are rendered within the browser using SVG or VML depending on browser capabilities.
Example<html> <head> <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <script type="text/javascript"> google.charts.load('current', {'packages':['corechart']}); google.charts.setOnLoadCallback(drawChart); function drawChart() { var data = google.visualization.arrayToDataTable([ ['Age', 'Weight'], [ 8, 12], [ 4, 5.5], [ 11, 14], [ 4, 5], [ 3, 3.5], [ 6.5, 7] ]); var options = { title: 'Age vs. Weight comparison', hAxis: {title: 'Age', minValue: 0, maxValue: 15}, vAxis: {title: 'Weight', minValue: 0, maxValue: 15}, legend: 'none' }; var chart = new google.visualization.ScatterChart(document.getElementById('chart_div')); chart.draw(data, options); } </script> </head> <body> <div id="chart_div" style="width: 900px; height: 500px;"></div> </body> </html>Changing and animating shapes
By default, scatter charts represent the elements of your dataset with circles. You can specify other shapes with the pointShape
option, detailed in the Customizing Points documentation.
As with most other Google Charts, you can animate them using events. You can add an event listener for the first ready
event and redraw the chart after making the desired modifications. After the first ready
event, you can listen to the animationfinish
event to repeat the process, resulting in a continuous animation. The animation
option controls how the redraw occurs: immediately (no animation) or smoothly, and if smoothly how quickly and with what behavior.
var options = { legend: 'none', colors: ['#087037'], pointShape: 'star', pointSize: 18, animation: { duration: 200, easing: 'inAndOut', } }; // Start the animation by listening to the first 'ready' event. google.visualization.events.addOneTimeListener(chart, 'ready', randomWalk); // Control all other animations by listening to the 'animationfinish' event. google.visualization.events.addListener(chart, 'animationfinish', randomWalk); ... function randomWalk() { ... }Full HTML
<html> <head> <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <script type="text/javascript"> google.charts.load("current", {packages:["corechart"]}); google.charts.setOnLoadCallback(drawChart); function drawChart() { var data = new google.visualization.DataTable(); data.addColumn('number'); data.addColumn('number'); var radius = 100; for (var i = 0; i < 6.28; i += 0.1) { data.addRow([radius * Math.cos(i), radius * Math.sin(i)]); } // Our central point, which will jiggle. data.addRow([0, 0]); var options = { legend: 'none', colors: ['#087037'], pointShape: 'star', pointSize: 18, animation: { duration: 200, easing: 'inAndOut', } }; var chart = new google.visualization.ScatterChart(document.getElementById('animatedshapes_div')); // Start the animation by listening to the first 'ready' event. google.visualization.events.addOneTimeListener(chart, 'ready', randomWalk); // Control all other animations by listening to the 'animationfinish' event. google.visualization.events.addListener(chart, 'animationfinish', randomWalk); chart.draw(data, options); function randomWalk() { var x = data.getValue(data.getNumberOfRows() - 1, 0); var y = data.getValue(data.getNumberOfRows() - 1, 1); x += 5 * (Math.random() - 0.5); y += 5 * (Math.random() - 0.5); if (x * x + y * y > radius * radius) { // Out of bounds. Bump toward center. x += Math.random() * ((x < 0) ? 5 : -5); y += Math.random() * ((y < 0) ? 5 : -5); } data.setValue(data.getNumberOfRows() - 1, 0, x); data.setValue(data.getNumberOfRows() - 1, 1, y); chart.draw(data, options); } } </script> </head> <body> <div id="animatedshapes_div" style="width: 500px; height: 500px;"></div> </body> </html>Creating Material scatter charts
In 2014, Google announced guidelines intended to support a common look and feel across its properties and apps (such as Android apps) that run on Google platforms. We call this effort Material Design. We'll be providing "Material" versions of all our core charts; you're welcome to use them if you like how they look.
Creating a Material Scatter Chart is similar to creating what we'll now call a "Classic" Scatter Chart. You load the Google Visualization API (although with the 'scatter'
package instead of the 'corechart'
package), define your datatable, and then create an object (but of class google.charts.Scatter
instead of google.visualization.ScatterChart
).
Note: Material Charts will not work in old versions of Internet Explorer. (IE8 and earlier versions don't support SVG, which Material Charts require.)
Material Scatter Charts have many small improvements over Classic Scatter Charts, including variable opacity for legibility of overlapping points, an improved color palette, clearer label formatting, tighter default spacing, softer gridlines and titles (and the addition of subtitles).
google.charts.load('current', {'packages':['scatter']}); google.charts.setOnLoadCallback(drawChart); function drawChart () { var data = new google.visualization.DataTable(); data.addColumn('number', 'Hours Studied'); data.addColumn('number', 'Final'); data.addRows([ [0, 67], [1, 88], [2, 77], [3, 93], [4, 85], [5, 91], [6, 71], [7, 78], [8, 93], [9, 80], [10, 82],[0, 75], [5, 80], [3, 90], [1, 72], [5, 75], [6, 68], [7, 98], [3, 82], [9, 94], [2, 79], [2, 95], [2, 86], [3, 67], [4, 60], [2, 80], [6, 92], [2, 81], [8, 79], [9, 83], [3, 75], [1, 80], [3, 71], [3, 89], [4, 92], [5, 85], [6, 92], [7, 78], [6, 95], [3, 81], [0, 64], [4, 85], [2, 83], [3, 96], [4, 77], [5, 89], [4, 89], [7, 84], [4, 92], [9, 98] ]); var options = { width: 800, height: 500, chart: { title: 'Students\' Final Grades', subtitle: 'based on hours studied' }, hAxis: {title: 'Hours Studied'}, vAxis: {title: 'Grade'} }; var chart = new google.charts.Scatter(document.getElementById('scatterchart_material')); chart.draw(data, google.charts.Scatter.convertOptions(options)); }
The Material Charts are in beta. The appearance and interactivity are largely final, but many of the options available in Classic Charts are not yet available in them. You can find a list of options that are not yet supported in this issue.
Also, the way options are declared is not finalized, so if you are using any of the classic options, you must convert them to material options by replacing this line:
chart.draw(data, options);
...with this:
chart.draw(data, google.charts.Scatter.convertOptions(options));
Sometimes you'll want to display two series in a scatter chart, with two independent y-axes: a left axis for one series, and a right axis for another:
Note that not only are our two y-axes labeled differently ("Final Exam Grade" versus "Hours Studied") but they each have their own independent scales and gridlines. If you want to customize this behavior, use the vAxis.gridlines
options.
In the code below, the axes
and series
options together specify the dual-Y appearance of the chart. The series
option specifies which axis to use for each ('final grade'
and 'hours studied'
; they needn't have any relation to the column names in the datatable). The axes
option then makes this chart a dual-Y chart, placing the 'Final Exam Grade'
axis on the left and the 'Hours Studied'
axis on the right.
google.charts.load('current', {'packages':['corechart', 'scatter']}); google.charts.setOnLoadCallback(drawStuff); function drawStuff() { var button = document.getElementById('change-chart'); var chartDiv = document.getElementById('chart_div'); var data = new google.visualization.DataTable(); data.addColumn('number', 'Student ID'); data.addColumn('number', 'Hours Studied'); data.addColumn('number', 'Final'); data.addRows([ [0, 0, 67], [1, 1, 88], [2, 2, 77], [3, 3, 93], [4, 4, 85], [5, 5, 91], [6, 6, 71], [7, 7, 78], [8, 8, 93], [9, 9, 80], [10, 10, 82], [11, 0, 75], [12, 5, 80], [13, 3, 90], [14, 1, 72], [15, 5, 75], [16, 6, 68], [17, 7, 98], [18, 3, 82], [19, 9, 94], [20, 2, 79], [21, 2, 95], [22, 2, 86], [23, 3, 67], [24, 4, 60], [25, 2, 80], [26, 6, 92], [27, 2, 81], [28, 8, 79], [29, 9, 83] ]); var materialOptions = { chart: { title: 'Students\' Final Grades', subtitle: 'based on hours studied' }, width: 800, height: 500, series: { 0: {axis: 'hours studied'}, 1: {axis: 'final grade'} }, axes: { y: { 'hours studied': {label: 'Hours Studied'}, 'final grade': {label: 'Final Exam Grade'} } } }; var classicOptions = { width: 800, series: { 0: {targetAxisIndex: 0}, 1: {targetAxisIndex: 1} }, title: 'Students\' Final Grades - based on hours studied', vAxes: { // Adds titles to each axis. 0: {title: 'Hours Studied'}, 1: {title: 'Final Exam Grade'} } }; function drawMaterialChart() { var materialChart = new google.charts.Scatter(chartDiv); materialChart.draw(data, google.charts.Scatter.convertOptions(materialOptions)); button.innerText = 'Change to Classic'; button.onclick = drawClassicChart; } function drawClassicChart() { var classicChart = new google.visualization.ScatterChart(chartDiv); classicChart.draw(data, classicOptions); button.innerText = 'Change to Material'; button.onclick = drawMaterialChart; } drawMaterialChart(); };Top-X charts
Note: Top-X axes are available only for Material charts (i.e., those with package scatter
).
If you want to put the X-axis labels and title on the top of your chart rather than the bottom, you can do that in Material charts with the axes.x
option:
google.charts.load('current', {'packages':['scatter']}); google.charts.setOnLoadCallback(drawChart); function drawChart () { var data = new google.visualization.DataTable(); data.addColumn('number', 'Hours Studied'); data.addColumn('number', 'Final'); data.addRows([ [0, 67], [1, 88], [2, 77], [3, 93], [4, 85], [5, 91], [6, 71], [7, 78], [8, 93], [9, 80], [10, 82], [0, 75], [5, 80], [3, 90], [1, 72], [5, 75], [6, 68], [7, 98], [3, 82], [9, 94], [2, 79], [2, 95], [2, 86], [3, 67], [4, 60], [2, 80], [6, 92], [2, 81], [8, 79], [9, 83], [3, 75], [1, 80], [3, 71], [3, 89], [4, 92], [5, 85], [6, 92], [7, 78], [6, 95], [3, 81], [0, 64], [4, 85], [2, 83], [3, 96], [4, 77], [5, 89], [4, 89], [7, 84], [4, 92], [9, 98] ]); var options = { width: 800, height: 500, chart: { title: 'Students\' Final Grades', subtitle: 'based on hours studied' }, axes: { x: { 0: {side: 'top'} } } }; var chart = new google.charts.Scatter(document.getElementById('scatter_top_x')); chart.draw(data, google.charts.Scatter.convertOptions(options)); }Loading
The google.charts.load
package name is "corechart"
, and the visualization's class name is google.visualization.ScatterChart
.
google.charts.load("current", {packages: ["corechart"]});
var visualization = new google.visualization.ScatterChart(container);
For Material Scatter Charts, the google.charts.load
package name is "scatter"
, and the visualization's class name is google.charts.Scatter
.
google.charts.load("current", {packages: ["scatter"]});
var visualization = new google.charts.Scatter(container);Data format
Rows: Each row in the table represents a set of data points with the same x-axis value.
Columns:
To specify multiple series, specify two or more Y-axis columns, and specify Y values in only one Y column:
X-values Series 1 Y Values Series 2 Y Values 10 null 75 20 null 18 33 null 22 55 16 null 14 61 null 48 3 null Configuration options Name aggregationTargetHow multiple data selections are rolled up into tooltips:
'category'
: Group selected data by x-value.'series'
: Group selected data by series.'auto'
: Group selected data by x-value if all selections have the same x-value, and by series otherwise.'none'
: Show only one tooltip per selection.aggregationTarget
will often be used in tandem with selectionMode
and tooltip.trigger
, e.g.:
var options = { // Allow multiple // simultaneous selections. selectionMode: 'multiple', // Trigger tooltips // on selections. tooltip: {trigger: 'selection'}, // Group selections // by x-value. aggregationTarget: 'category', };
Type: string
Default: 'auto'
animation.durationThe duration of the animation, in milliseconds. For details, see the animation documentation.
Type: number
Default: 0
animation.easingThe easing function applied to the animation. The following options are available:
Type: string
Default: 'linear'
animation.startupDetermines if the chart will animate on the initial draw. If true
, the chart will start at the baseline and animate to its final state.
Type: boolean
Default false
annotations.boxStyleFor charts that support annotations, the annotations.boxStyle
object controls the appearance of the boxes surrounding annotations:
var options = { annotations: { boxStyle: { // Color of the box outline. stroke: '#888', // Thickness of the box outline. strokeWidth: 1, // x-radius of the corner curvature. rx: 10, // y-radius of the corner curvature. ry: 10, // Attributes for linear gradient fill. gradient: { // Start color for gradient. color1: '#fbf6a7', // Finish color for gradient. color2: '#33b679', // Where on the boundary to start and // end the color1/color2 gradient, // relative to the upper left corner // of the boundary. x1: '0%', y1: '0%', x2: '100%', y2: '100%', // If true, the boundary for x1, // y1, x2, and y2 is the box. If // false, it's the entire chart. useObjectBoundingBoxUnits: true } } } };
This option is currently supported for area, bar, column, combo, line, and scatter charts. It is not supported by the Annotation Chart.
Type: object
Default: null
annotations.datumFor charts that support
annotations, the
annotations.datum
object lets you override Google Charts' choice for annotations provided for individual data elements (such as values displayed with each bar on a bar chart). You can control the color with
annotations.datum.stem.color
, the stem length with
annotations.datum.stem.length
, and the style with
annotations.datum.style
.
Type: object
Default: color is "black"; length is 12; style is "point".
annotations.domainFor charts that support
annotations, the
annotations.domain
object lets you override Google Charts' choice for annotations provided for a domain (the major axis of the chart, such as the X axis on a typical line chart). You can control the color with
annotations.domain.stem.color
, the stem length with
annotations.domain.stem.length
, and the style with
annotations.domain.style
.
Type: object
Default: color is "black"; length is 5; style is "point".
annotations.highContrastFor charts that support
annotations, the
annotations.highContrast
boolean lets you override Google Charts' choice of the annotation color. By default,
annotations.highContrast
is true, which causes Charts to select an annotation color with good contrast: light colors on dark backgrounds, and dark on light. If you set
annotations.highContrast
to false and don't specify your own annotation color, Google Charts will use the default series color for the annotation:
Type: boolean
Default: true
annotations.stemFor charts that support
annotations, the
annotations.stem
object lets you override Google Charts' choice for the stem style. You can control color with
annotations.stem.color
and the stem length with
annotations.stem.length
. Note that the stem length option has no effect on annotations with style
'line'
: for
'line'
datum annotations, the stem length is always the same as the text, and for
'line'
domain annotations, the stem extends across the entire chart.
Type: object
Default: color is "black"; length is 5 for domain annotations and 12 for datum annotations.
annotations.styleFor charts that support
annotations, the
annotations.style
option lets you override Google Charts' choice of the annotation type. It can be either
'line'
or
'point'
.
Type: string
Default: 'point'
annotations.textStyleFor charts that support
annotations, the
annotations.textStyle
object controls the appearance of the text of the annotation:
var options = { annotations: { textStyle: { fontName: 'Times-Roman', fontSize: 18, bold: true, italic: true, // The color of the text. color: '#871b47', // The color of the text outline. auraColor: '#d799ae', // The transparency of the text. opacity: 0.8 } } };
This option is currently supported for area, bar, column, combo, line, and scatter charts. It is not supported by the Annotation Chart .
Type: object
Default: null
axisTitlesPositionWhere to place the axis titles, compared to the chart area. Supported values:
Type: string
Default: 'out'
backgroundColorThe background color for the main area of the chart. Can be either a simple HTML color string, for example: 'red'
or '#00cc00'
, or an object with the following properties.
Type: string or object
Default: 'white'
backgroundColor.strokeThe color of the chart border, as an HTML color string.
Type: string
Default: '#666'
backgroundColor.strokeWidthThe border width, in pixels.
Type: number
Default: 0
backgroundColor.fillThe chart fill color, as an HTML color string.
Type: string
Default: 'white'
chart.titleFor Material Charts, this option specifies the title.
Type: string
Default: null
chart.subtitleFor Material Charts, this option specifies the subtitle. Only Material Charts support subtitles.
Type: string
Default: null
chartAreaAn object with members to configure the placement and size of the chart area (where the chart itself is drawn, excluding axis and legends). Two formats are supported: a number, or a number followed by %. A simple number is a value in pixels; a number followed by % is a percentage. Example: chartArea:{left:20,top:0,width:'50%',height:'75%'}
Type: object
Default: null
chartArea.backgroundColorChart area background color. When a string is used, it can be either a hex string (e.g., '#fdc') or an English color name. When an object is used, the following properties can be provided:
stroke
: the color, provided as a hex string or English color name.strokeWidth
: if provided, draws a border around the chart area of the given width (and with the color of stroke
).Type: string or object
Default: 'white'
chartArea.leftHow far to draw the chart from the left border.
Type: number or string
Default: auto
chartArea.topHow far to draw the chart from the top border.
Type: number or string
Default: auto
chartArea.widthChart area width.
Type: number or string
Default: auto
chartArea.heightChart area height.
Type: number or string
Default: auto
colorsThe colors to use for the chart elements. An array of strings, where each element is an HTML color string, for example: colors:['red','#004411']
.
Type: Array of strings
Default: default colors
crosshairAn object containing the crosshair properties for the chart.
Type: object
Default: null
crosshair.colorThe crosshair color, expressed as either a color name (e.g., "blue") or an RGB value (e.g., "#adf").
Type: string
Type: default
crosshair.focusedAn object containing the crosshair properties upon focus.
Example: crosshair: { focused: { color: '#3bc', opacity: 0.8 } }
Type: object
Default: default
crosshair.opacityThe crosshair opacity, with 0.0
being fully transparent and 1.0
fully opaque.
Type: number
Default: 1.0
crosshair.orientationThe crosshair orientation, which can be 'vertical' for vertical hairs only, 'horizontal' for horizontal hairs only, or 'both' for traditional crosshairs.
Type: string
Default: 'both'
crosshair.selectedAn object containing the crosshair properties upon selection.
Example: crosshair: { selected: { color: '#3bc', opacity: 0.8 } }
Type: object
Default: default
crosshair.triggerWhen to display crosshairs: on 'focus'
, 'selection'
, or 'both'
.
Type: string
Default: 'both'
curveTypeControls the curve of the lines when the line width is not zero. Can be one of the following:
Type:string
Default: 'none'
dataOpacityThe transparency of data points, with 1.0 being completely opaque and 0.0 fully transparent. In scatter, histogram, bar, and column charts, this refers to the visible data: dots in the scatter chart and rectangles in the others. In charts where selecting data creates a dot, such as the line and area charts, this refers to the circles that appear upon hover or selection. The combo chart exhibits both behaviors, and this option has no effect on other charts. (To change the opacity of a trendline, see trendline opacity .)
Type: number
Default: 1.0
enableInteractivityWhether the chart throws user-based events or reacts to user interaction. If false, the chart will not throw 'select' or other interaction-based events (but will throw ready or error events), and will not display hovertext or otherwise change depending on user input.
Type: boolean
Default: true
explorerThe explorer
option allows users to pan and zoom Google charts. explorer: {}
provides the default explorer behavior, enabling users to pan horizontally and vertically by dragging, and to zoom in and out by scrolling.
This feature is experimental and may change in future releases.
Note: The explorer only works with continuous axes (such as numbers or dates).
Type: object
Default: null
explorer.actionsThe Google Charts explorer supports three actions:
dragToPan
: Drag to pan around the chart horizontally and vertically. To pan only along the horizontal axis, use explorer: { axis: 'horizontal' }
. Similarly for the vertical axis.dragToZoom
: The explorer's default behavior is to zoom in and out when the user scrolls. If explorer: { actions: ['dragToZoom', 'rightClickToReset'] }
is used, dragging across a rectangular area zooms into that area. We recommend using rightClickToReset
whenever dragToZoom
is used. See explorer.maxZoomIn
, explorer.maxZoomOut
, and explorer.zoomDelta
for zoom customizations.rightClickToReset
: Right clicking on the chart returns it to the original pan and zoom level.Type: Array of strings
Default: ['dragToPan', 'rightClickToReset']
explorer.axisBy default, users can pan both horizontally and vertically when the explorer
option is used. If you want to users to only pan horizontally, use explorer: { axis: 'horizontal' }
. Similarly, explorer: { axis: 'vertical' }
enables vertical-only panning.
Type: string
Default: both horizontal and vertical panning
explorer.keepInBoundsBy default, users can pan all around, regardless of where the data is. To ensure that users don't pan beyond the original chart, use explorer: { keepInBounds: true }
.
Type: boolean
Default: false
explorer.maxZoomInThe maximum that the explorer can zoom in. By default, users will be able to zoom in enough that they'll see only 25% of the original view. Setting explorer: { maxZoomIn: .5 }
would let users zoom in only far enough to see half of the original view.
Type: number
Default: 0.25
explorer.maxZoomOutThe maximum that the explorer can zoom out. By default, users will be able to zoom out far enough that the chart will take up only 1/4 of the available space. Setting explorer: { maxZoomOut: 8 }
would let users zoom out far enough that the chart would take up only 1/8 of the available space.
Type: number
Default: 4
explorer.zoomDeltaWhen users zoom in or out, explorer.zoomDelta
determines how much they zoom by. The smaller the number, the smoother and slower the zoom.
Type: number
Default: 1.5
fontSizeThe default font size, in pixels, of all text in the chart. You can override this using properties for specific chart elements.
Type: number
Default: automatic
fontNameThe default font face for all text in the chart. You can override this using properties for specific chart elements.
Type: string
Default: 'Arial'
forceIFrameDraws the chart inside an inline frame. (Note that on IE8, this option is ignored; all IE8 charts are drawn in i-frames.)
Type: boolean
Default: false
hAxisAn object with members to configure various horizontal axis elements. To specify properties of this object, you can use object literal notation, as shown here:
{ title: 'Hello', titleTextStyle: { color: '#FF0000' } }
Type: object
Default: null
hAxis.baselineThe baseline for the horizontal axis.
Type: number
Default: automatic
hAxis.baselineColorThe color of the baseline for the horizontal axis. Can be any HTML color string, for example: 'red'
or '#00cc00'
.
Type: number
Default: 'black'
hAxis.directionThe direction in which the values along the horizontal axis grow. Specify -1
to reverse the order of the values.
Type: 1 or -1
Default: 1
hAxis.formatA format string for numeric axis labels. This is a subset of the ICU pattern set . For instance, {format:'#,###%'}
will display values "1,000%", "750%", and "50%" for values 10, 7.5, and 0.5. You can also supply any of the following:
{format: 'none'}
: displays numbers with no formatting (e.g., 8000000){format: 'decimal'}
: displays numbers with thousands separators (e.g., 8,000,000){format: 'scientific'}
: displays numbers in scientific notation (e.g., 8e6){format: 'currency'}
: displays numbers in the local currency (e.g., $8,000,000.00){format: 'percent'}
: displays numbers as percentages (e.g., 800,000,000%){format: 'short'}
: displays abbreviated numbers (e.g., 8M){format: 'long'}
: displays numbers as full words (e.g., 8 million)The actual formatting applied to the label is derived from the locale the API has been loaded with. For more details, see loading charts with a specific locale .
In computing tick values and gridlines, several alternative combinations of all the relevant gridline options will be considered and alternatives will be rejected if the formatted tick labels would be duplicated or overlap. So you can specify format:"#"
if you want to only show integer tick values, but be aware that if no alternative satisfies this condition, no gridlines or ticks will be shown.
Type: string
Default: auto
hAxis.gridlinesAn object with properties to configure the gridlines on the horizontal axis. Note that horizontal axis gridlines are drawn vertically. To specify properties of this object, you can use object literal notation, as shown here:
{color: '#333', minSpacing: 20}
Type: object
Default: null
hAxis.gridlines.colorThe color of the horizontal gridlines inside the chart area. Specify a valid HTML color string.
Type: string
Default: '#CCC'
hAxis.gridlines.countThe approximate number of horizontal gridlines inside the chart area. If you specify a positive number for gridlines.count
, it will be used to compute the minSpacing
between gridlines. You can specify a value of 1
to only draw one gridline, or 0
to draw no gridlines. Specify -1, which is the default, to automatically compute the number of gridlines based on other options.
Type: number
Default: -1
hAxis.gridlines.unitsOverrides the default format for various aspects of date/datetime/timeofday data types when used with chart computed gridlines. Allows formatting for years, months, days, hours, minutes, seconds, and milliseconds.
General format is:
gridlines: { units: { years: {format: [/*format strings here*/]}, months: {format: [/*format strings here*/]}, days: {format: [/*format strings here*/]} hours: {format: [/*format strings here*/]} minutes: {format: [/*format strings here*/]} seconds: {format: [/*format strings here*/]}, milliseconds: {format: [/*format strings here*/]}, } }
Additional information can be found in Dates and Times.
Type: object
Default: null
hAxis.minorGridlinesAn object with members to configure the minor gridlines on the horizontal axis, similar to the hAxis.gridlines option.
Type: object
Default: null
hAxis.minorGridlines.colorThe color of the horizontal minor gridlines inside the chart area. Specify a valid HTML color string.
Type: string
Default: A blend of the gridline and background colors
hAxis.minorGridlines.countThe minorGridlines.count
option is mostly deprecated, except for disabling minor gridlines by setting the count to 0. The number of minor gridlines now depends entirely on the interval between major gridlines (see hAxis.gridlines.interval
) and the minimum required space (see hAxis.minorGridlines.minSpacing
).
Type: number
Default:1
hAxis.minorGridlines.unitsOverrides the default format for various aspects of date/datetime/timeofday data types when used with chart computed minorGridlines. Allows formatting for years, months, days, hours, minutes, seconds, and milliseconds.
General format is:
gridlines: { units: { years: {format: [/*format strings here*/]}, months: {format: [/*format strings here*/]}, days: {format: [/*format strings here*/]} hours: {format: [/*format strings here*/]} minutes: {format: [/*format strings here*/]} seconds: {format: [/*format strings here*/]}, milliseconds: {format: [/*format strings here*/]}, } }
Additional information can be found in Dates and Times.
Type: object
Default: null
hAxis.logScalehAxis
property that makes the horizontal axis a logarithmic scale (requires all values to be positive). Set to true for yes.
Type: boolean
Default: false
hAxis.scaleTypehAxis
property that makes the horizontal axis a logarithmic scale. Can be one of the following:
hAxis: { logscale: true }
.Type: string
Default: null
hAxis.textPositionPosition of the horizontal axis text, relative to the chart area. Supported values: 'out', 'in', 'none'.
Type: string
Default: 'out'
hAxis.textStyleAn object that specifies the horizontal axis text style. The object has this format:
{ color: <string>, fontName: <string>, fontSize: <number>, bold: <boolean>, italic: <boolean> }
The color
can be any HTML color string, for example: 'red'
or '#00cc00'
. Also see fontName
and fontSize
.
Type: object
Default: {color: 'black', fontName: <global-font-name>, fontSize: <global-font-size>}
Replaces the automatically generated X-axis ticks with the specified array. Each element of the array should be either a valid tick value (such as a number, date, datetime, or timeofday), or an object. If it's an object, it should have a v
property for the tick value, and an optional f
property containing the literal string to be displayed as the label.
The viewWindow will be automatically expanded to include the min and max ticks unless you specify a viewWindow.min
or viewWindow.max
to override.
Examples:
hAxis: { ticks: [5,10,15,20] }
hAxis: { ticks: [{v:32, f:'thirty two'}, {v:64, f:'sixty four'}] }
hAxis: { ticks: [new Date(2014,3,15), new Date(2013,5,15)] }
hAxis: { ticks: [16, {v:32, f:'thirty two'}, {v:64, f:'sixty four'}, 128] }
Type: Array of elements
Default: auto
hAxis.titlehAxis
property that specifies the title of the horizontal axis.
Type: string
Default: null
hAxis.titleTextStyleAn object that specifies the horizontal axis title text style. The object has this format:
{ color: <string>, fontName: <string>, fontSize: <number>, bold: <boolean>, italic: <boolean> }
The color
can be any HTML color string, for example: 'red'
or '#00cc00'
. Also see fontName
and fontSize
.
Type: object
Default: {color: 'black', fontName: <global-font-name>, fontSize: <global-font-size>}
Moves the max value of the horizontal axis to the specified value; this will be rightward in most charts. Ignored if this is set to a value smaller than the maximum x-value of the data. hAxis.viewWindow.max
overrides this property.
Type: number
Default: automatic
hAxis.minValueMoves the min value of the horizontal axis to the specified value; this will be leftward in most charts. Ignored if this is set to a value greater than the minimum x-value of the data. hAxis.viewWindow.min
overrides this property.
Type: number
Default: automatic
hAxis.viewWindowModeSpecifies how to scale the horizontal axis to render the values within the chart area. The following string values are supported:
haxis.viewWindow.min
and haxis.viewWindow.max
to be ignored.haxis.viewWindow.min
and haxis.viewWindow.max
.) Data values outside these values will be cropped. You must specify an hAxis.viewWindow
object describing the maximum and minimum values to show.Type: string
Default: Equivalent to 'pretty', but haxis.viewWindow.min
and haxis.viewWindow.max
take precedence if used.
Specifies the cropping range of the horizontal axis.
Type: object
Default: null
hAxis.viewWindow.maxThe maximum horizontal data value to render.
Ignored when hAxis.viewWindowMode
is 'pretty' or 'maximized'.
Type: number
Default: auto
hAxis.viewWindow.minThe minimum horizontal data value to render.
Ignored when hAxis.viewWindowMode
is 'pretty' or 'maximized'.
Type: number
Default: auto
heightHeight of the chart, in pixels.
Type: number
Default: height of the containing element
legendAn object with members to configure various aspects of the legend. To specify properties of this object, you can use object literal notation, as shown here:
{position: 'top', textStyle: {color: 'blue', fontSize: 16}}
Type: object
Default: null
legend.alignmentAlignment of the legend. Can be one of the following:
Start, center, and end are relative to the style -- vertical or horizontal -- of the legend. For example, in a 'right' legend, 'start' and 'end' are at the top and bottom, respectively; for a 'top' legend, 'start' and 'end' would be at the left and right of the area, respectively.
The default value depends on the legend's position. For 'bottom' legends, the default is 'center'; other legends default to 'start'.
Type: string
Default: automatic
legend.maxLinesMaximum number of lines in the legend. Set this to a number greater than one to add lines to your legend. Note: The exact logic used to determine the actual number of lines rendered is still in flux.
This option currently works only when legend.position is 'top'.
Type: number
Default: 1
legend.pageIndexInitial selected zero-based page index of the legend.
Type: number
Default: 0
legend.positionPosition of the legend. Can be one of the following:
targetAxisIndex: 1
.vAxes
option.Type: string
Default: 'right'
legend.textStyleAn object that specifies the legend text style. The object has this format:
{ color: <string>, fontName: <string>, fontSize: <number>, bold: <boolean>, italic: <boolean> }
The color
can be any HTML color string, for example: 'red'
or '#00cc00'
. Also see fontName
and fontSize
.
Type: object
Default: {color: 'black', fontName: <global-font-name>, fontSize: <global-font-size>}
Line width in pixels. Use zero to hide all lines and show only the points.
Type: number
Default: 0
orientationThe orientation of the chart. When set to 'vertical'
, rotates the axes of the chart so that (for instance) a column chart becomes a bar chart, and an area chart grows rightward instead of up:
Type: string
Default: 'horizontal'
pointShapeThe shape of individual data elements: 'circle', 'triangle', 'square', 'diamond', 'star', or 'polygon'. See the points documentation for examples.
Type: string
Default: 'circle'
pointSizeDiameter of data points, in pixels. Use zero to hide all points. You can override values for individual series using the series
property. If you're using a trendline, this option will also affect the pointSize
of the points comprising it, which will change the apparent width of the trendline. To avoid this, you can override it with the trendlines.n.pointsize
option.
Type: number
Default: 7
pointsVisibleDetermines whether points will be displayed. Set to false
to hide all points. You can override values for individual series using the series
property. If you're using a trendline, the pointsVisible
option will affect the visibility of the points on all trendlines unless you override it with the trendlines.n.pointsVisible
option.
This can also be overridden using the style role in the form of "point {visible: true}"
.
Type: boolean
Default: true
selectionModeWhen selectionMode
is 'multiple'
, users may select multiple data points.
Type: string
Default: 'single'
seriesAn array of objects, each describing the format of the corresponding series in the chart. To use default values for a series, specify an empty object {}. If a series or a value is not specified, the global value will be used. Each object supports the following properties:
color
- The color to use for this series. Specify a valid HTML color string.labelInLegend
- The description of the series to appear in the chart legend.lineWidth
- Overrides the global lineWidth
value for this series.pointShape
- Overrides the global pointShape
value for this series.pointSize
- Overrides the global pointSize
value for this series.pointsVisible
- Overrides the global pointsVisible
value for this series.visibleInLegend
- A boolean value, where true means that the series should have a legend entry, and false means that it should not. Default is true.You can specify either an array of objects, each of which applies to the series in the order given, or you can specify an object where each child has a numeric key indicating which series it applies to. For example, the following two declarations are identical, and declare the first series as black and absent from the legend, and the fourth as red and absent from the legend:
series: [ {color: 'black', visibleInLegend: false}, {}, {}, {color: 'red', visibleInLegend: false} ] series: { 0:{color: 'black', visibleInLegend: false}, 3:{color: 'red', visibleInLegend: false} }
Type: Array of objects, or object with nested objects
Default: {}
themeA theme is a set of predefined option values that work together to achieve a specific chart behavior or visual effect. Currently only one theme is available:
chartArea: {width: '100%', height: '100%'}, legend: {position: 'in'}, titlePosition: 'in', axisTitlesPosition: 'in', hAxis: {textPosition: 'in'}, vAxis: {textPosition: 'in'}
Type: string
Default: null
titleText to display above the chart.
Type: string
Default: no title
titlePositionWhere to place the chart title, compared to the chart area. Supported values:
Type: string
Default: 'out'
titleTextStyleAn object that specifies the title text style. The object has this format:
{ color: <string>, fontName: <string>, fontSize: <number>, bold: <boolean>, italic: <boolean> }
The color
can be any HTML color string, for example: 'red'
or '#00cc00'
. Also see fontName
and fontSize
.
Type: object
Default: {color: 'black', fontName: <global-font-name>, fontSize: <global-font-size>}
An object with members to configure various tooltip elements. To specify properties of this object, you can use object literal notation, as shown here:
{textStyle: {color: '#FF0000'}, showColorCode: true}
Type: object
Default: null
tooltip.ignoreBoundsIf set to true
, allows the drawing of tooltips to flow outside of the bounds of the chart on all sides.
Note: This only applies to HTML tooltips. If this is enabled with SVG tooltips, any overflow outside of the chart bounds will be cropped. See Customizing Tooltip Content for more details.
Type: boolean
Default: false
tooltip.isHtmlIf set to true, use HTML-rendered (rather than SVG-rendered) tooltips. See Customizing Tooltip Content for more details.
Note: customization of the HTML tooltip content via the tooltip column data role is not supported by the Bubble Chart visualization.
Type: boolean
Default: false
tooltip.showColorCodeIf true, show colored squares next to the series information in the tooltip.
Type: boolean
Default: false
tooltip.textStyleAn object that specifies the tooltip text style. The object has this format:
{ color: <string>, fontName: <string>, fontSize: <number>, bold: <boolean>, italic: <boolean> }
The color
can be any HTML color string, for example: 'red'
or '#00cc00'
. Also see fontName
and fontSize
.
Type: object
Default: {color: 'black', fontName: <global-font-name>, fontSize: <global-font-size>}
The user interaction that causes the tooltip to be displayed:
Type: string
Default: 'focus'
trendlinesDisplays trendlines on the charts that support them. By default, linear trendlines are used, but this can be customized with the trendlines.n.type
option.
Trendlines are specified on a per-series basis, so most of the time your options will look like this:
var options = { trendlines: { 0: { type: 'linear', color: 'green', lineWidth: 3, opacity: 0.3, showR2: true, visibleInLegend: true } } }
Type: object
Default: null
trendlines.n.colorThe color of the trendline , expressed as either an English color name or a hex string.
Type: string
Default: default series color
trendlines.n.degreeFor trendlines of type: 'polynomial'
, the degree of the polynomial (2
for quadratic, 3
for cubic, and so on). (The default degree may change from 3 to 2 in an upcoming release of Google Charts.)
Type: number
Default: 3
trendlines.n.labelInLegendIf set, the trendline will appear in the legend as this string.
Type: string
Default: null
trendlines.n.lineWidthThe line width of the trendline , in pixels.
Type: number
Default: 2
trendlines.n.opacityThe transparency of the trendline , from 0.0 (transparent) to 1.0 (opaque).
Type: number
Default: 1.0
trendlines.n.pointSize Trendlines are constucted by stamping a bunch of dots on the chart; this rarely-needed option lets you customize the size of the dots. The trendline's lineWidth
option will usually be preferable. However, you'll need this option if you're using the global pointSize
option and want a different point size for your trendlines.
Type: number
Default: 1
trendlines.n.pointsVisible Trendlines are constucted by stamping a bunch of dots on the chart. The trendline's pointsVisible
option determines whether the points for a particular trendline are visible.
Type: boolean
Default: true
trendlines.n.showR2Whether to show the coefficient of determination in the legend or trendline tooltip.
Type: boolean
Default: false
trendlines.n.typeWhether the trendlines is 'linear'
(the default), 'exponential'
, or 'polynomial'
.
Type: string
Default: linear
trendlines.n.visibleInLegendWhether the trendline equation appears in the legend. (It will appear in the trendline tooltip.)
Type: boolean
Default: false
vAxisAn object with members to configure various vertical axis elements. To specify properties of this object, you can use object literal notation, as shown here:
{title: 'Hello', titleTextStyle: {color: '#FF0000'}}
Type: object
Default: null
vAxis.baselinevAxis
property that specifies the baseline for the vertical axis. If the baseline is larger than the highest grid line or smaller than the lowest grid line, it will be rounded to the closest gridline.
Type: number
Default: automatic
vAxis.baselineColorSpecifies the color of the baseline for the vertical axis. Can be any HTML color string, for example: 'red'
or '#00cc00'
.
Type: number
Default: 'black'
vAxis.directionThe direction in which the values along the vertical axis grow. By default, low values are on the bottom of the chart. Specify -1
to reverse the order of the values.
Type: 1 or -1
Default: 1
vAxis.formatA format string for numeric axis labels. This is a subset of the ICU pattern set . For instance, {format:'#,###%'}
will display values "1,000%", "750%", and "50%" for values 10, 7.5, and 0.5. You can also supply any of the following:
{format: 'none'}
: displays numbers with no formatting (e.g., 8000000){format: 'decimal'}
: displays numbers with thousands separators (e.g., 8,000,000){format: 'scientific'}
: displays numbers in scientific notation (e.g., 8e6){format: 'currency'}
: displays numbers in the local currency (e.g., $8,000,000.00){format: 'percent'}
: displays numbers as percentages (e.g., 800,000,000%){format: 'short'}
: displays abbreviated numbers (e.g., 8M){format: 'long'}
: displays numbers as full words (e.g., 8 million)The actual formatting applied to the label is derived from the locale the API has been loaded with. For more details, see loading charts with a specific locale .
In computing tick values and gridlines, several alternative combinations of all the relevant gridline options will be considered and alternatives will be rejected if the formatted tick labels would be duplicated or overlap. So you can specify format:"#"
if you want to only show integer tick values, but be aware that if no alternative satisfies this condition, no gridlines or ticks will be shown.
Type: string
Default: auto
vAxis.gridlinesAn object with members to configure the gridlines on the vertical axis. Note that vertical axis gridlines are drawn horizontally. To specify properties of this object, you can use object literal notation, as shown here:
{color: '#333', minSpacing: 20}
Type: object
Default: null
vAxis.gridlines.colorThe color of the vertical gridlines inside the chart area. Specify a valid HTML color string.
Type: string
Default: '#CCC'
vAxis.gridlines.countThe approximate number of horizontal gridlines inside the chart area. If you specify a positive number for gridlines.count
, it will be used to compute the minSpacing
between gridlines. You can specify a value of 1
to only draw one gridline, or 0
to draw no gridlines. Specify -1, which is the default, to automatically compute the number of gridlines based on other options.
Type: number
Default: -1
vAxis.gridlines.unitsOverrides the default format for various aspects of date/datetime/timeofday data types when used with chart computed gridlines. Allows formatting for years, months, days, hours, minutes, seconds, and milliseconds.
General format is:
gridlines: { units: { years: {format: [/*format strings here*/]}, months: {format: [/*format strings here*/]}, days: {format: [/*format strings here*/]}, hours: {format: [/*format strings here*/]}, minutes: {format: [/*format strings here*/]}, seconds: {format: [/*format strings here*/]}, milliseconds: {format: [/*format strings here*/]} } }
Additional information can be found in Dates and Times.
Type: object
Default: null
vAxis.minorGridlinesAn object with members to configure the minor gridlines on the vertical axis, similar to the vAxis.gridlines option.
Type: object
Default: null
vAxis.minorGridlines.colorThe color of the vertical minor gridlines inside the chart area. Specify a valid HTML color string.
Type: string
Default: A blend of the gridline and background colors
vAxis.minorGridlines.countThe minorGridlines.count option is mostly deprecated, except for disabling minor gridlines by setting the count to 0. The number of minor gridlines depends on the interval between major gridlines (see vAxis.gridlines.interval) and the minimum required space (see vAxis.minorGridlines.minSpacing).
Type: number
Default: 1
vAxis.minorGridlines.unitsOverrides the default format for various aspects of date/datetime/timeofday data types when used with chart computed minorGridlines. Allows formatting for years, months, days, hours, minutes, seconds, and milliseconds.
General format is:
gridlines: { units: { years: {format: [/*format strings here*/]}, months: {format: [/*format strings here*/]}, days: {format: [/*format strings here*/]} hours: {format: [/*format strings here*/]} minutes: {format: [/*format strings here*/]} seconds: {format: [/*format strings here*/]}, milliseconds: {format: [/*format strings here*/]}, } }
Additional information can be found in Dates and Times.
Type: object
Default: null
vAxis.logScaleIf true, makes the vertical axis a logarithmic scale. Note: All values must be positive.
Type: boolean
Default: false
vAxis.scaleTypevAxis
property that makes the vertical axis a logarithmic scale. Can be one of the following:
vAxis: { logscale: true }
.Type: string
Default: null
vAxis.textPositionPosition of the vertical axis text, relative to the chart area. Supported values: 'out', 'in', 'none'.
Type: string
Default: 'out'
vAxis.textStyleAn object that specifies the vertical axis text style. The object has this format:
{ color: <string>, fontName: <string>, fontSize: <number>, bold: <boolean>, italic: <boolean> }
The color
can be any HTML color string, for example: 'red'
or '#00cc00'
. Also see fontName
and fontSize
.
Type: object
Default: {color: 'black', fontName: <global-font-name>, fontSize: <global-font-size>}
Replaces the automatically generated Y-axis ticks with the specified array. Each element of the array should be either a valid tick value (such as a number, date, datetime, or timeofday), or an object. If it's an object, it should have a v
property for the tick value, and an optional f
property containing the literal string to be displayed as the label.
The viewWindow will be automatically expanded to include the min and max ticks unless you specify a viewWindow.min
or viewWindow.max
to override.
Examples:
vAxis: { ticks: [5,10,15,20] }
vAxis: { ticks: [{v:32, f:'thirty two'}, {v:64, f:'sixty four'}] }
vAxis: { ticks: [new Date(2014,3,15), new Date(2013,5,15)] }
vAxis: { ticks: [16, {v:32, f:'thirty two'}, {v:64, f:'sixty four'}, 128] }
Type: Array of elements
Default: auto
vAxis.titlevAxis
property that specifies a title for the vertical axis.
Type: string
Default: no title
vAxis.titleTextStyleAn object that specifies the vertical axis title text style. The object has this format:
{ color: <string>, fontName: <string>, fontSize: <number>, bold: <boolean>, italic: <boolean> }
The color
can be any HTML color string, for example: 'red'
or '#00cc00'
. Also see fontName
and fontSize
.
Type: object
Default: {color: 'black', fontName: <global-font-name>, fontSize: <global-font-size>}
Moves the max value of the vertical axis to the specified value; this will be upward in most charts. Ignored if this is set to a value smaller than the maximum y-value of the data. vAxis.viewWindow.max
overrides this property.
Type: number
Default: automatic
vAxis.minValueMoves the min value of the vertical axis to the specified value; this will be downward in most charts. Ignored if this is set to a value greater than the minimum y-value of the data. vAxis.viewWindow.min
overrides this property.
Type: number
Default: null
vAxis.viewWindowModeSpecifies how to scale the vertical axis to render the values within the chart area. The following string values are supported:
vaxis.viewWindow.min
and vaxis.viewWindow.max
to be ignored.vaxis.viewWindow.min
and vaxis.viewWindow.max
. Data values outside these values will be cropped. You must specify a vAxis.viewWindow
object describing the maximum and minimum values to show.Type: string
Default: Equivalent to 'pretty', but vaxis.viewWindow.min
and vaxis.viewWindow.max
take precedence if used.
Specifies the cropping range of the vertical axis.
Type: object
Default: null
vAxis.viewWindow.maxThe maximum vertical data value to render.
Ignored when vAxis.viewWindowMode
is 'pretty' or 'maximized'.
Type: number
Default: auto
vAxis.viewWindow.minThe minimum vertical data value to render.
Ignored when vAxis.viewWindowMode
is 'pretty' or 'maximized'.
Type: number
Default: auto
widthWidth of the chart, in pixels.
Type: number
Default: width of the containing element
Methods Methoddraw(data, options)
Draws the chart. The chart accepts further method calls only after the ready
event is fired. Extended description
.
Return Type: none
getAction(actionID)
Returns the tooltip action object with the requested actionID
.
Return Type: object
getBoundingBox(id)
Returns an object containing the left, top, width, and height of chart element id
. The format for id
isn't yet documented (they're the return values of event handlers), but here are some examples:
var cli = chart.getChartLayoutInterface();
- Height of the chart area
cli.getBoundingBox('chartarea').height
- Width of the third bar in the first series of a bar or column chart
cli.getBoundingBox('bar#0#2').width
- Bounding box of the fifth wedge of a pie chart
cli.getBoundingBox('slice#4')
- Bounding box of the chart data of a vertical (e.g., column) chart:
cli.getBoundingBox('vAxis#0#gridline')
- Bounding box of the chart data of a horizontal (e.g., bar) chart:
cli.getBoundingBox('hAxis#0#gridline')
Values are relative to the container of the chart. Call this after the chart is drawn.
Return Type: object
getChartAreaBoundingBox()
Returns an object containing the left, top, width, and height of the chart content (i.e., excluding labels and legend):
var cli = chart.getChartLayoutInterface();
cli.getChartAreaBoundingBox().left
cli.getChartAreaBoundingBox().top
cli.getChartAreaBoundingBox().height
cli.getChartAreaBoundingBox().width
Values are relative to the container of the chart. Call this after the chart is drawn.
Return Type: object
getChartLayoutInterface()
Returns an object containing information about the onscreen placement of the chart and its elements.
The following methods can be called on the returned object:
getBoundingBox
getChartAreaBoundingBox
getHAxisValue
getVAxisValue
getXLocation
getYLocation
Call this after the chart is drawn.
Return Type: object
getHAxisValue(xPosition, optional_axis_index)
Returns the horizontal data value at xPosition
, which is a pixel offset from the chart container's left edge. Can be negative.
Example: chart.getChartLayoutInterface().getHAxisValue(400)
.
Call this after the chart is drawn.
Return Type: number
getImageURI()
Returns the chart serialized as an image URI.
Call this after the chart is drawn.
See Printing PNG Charts.
Return Type: string
getSelection()
Returns an array of the selected chart entities. Selectable entities are points and legend entries. A point corresponds to a cell in the data table, and a legend entry to a column (row index is null). For this chart, only one entity can be selected at any given moment. Extended description
.
Return Type: Array of selection elements
getVAxisValue(yPosition, optional_axis_index)
Returns the vertical data value at yPosition
, which is a pixel offset down from the chart container's top edge. Can be negative.
Example: chart.getChartLayoutInterface().getVAxisValue(300)
.
Call this after the chart is drawn.
Return Type: number
getXLocation(dataValue, optional_axis_index)
Returns the pixel x-coordinate of dataValue
relative to the left edge of the chart's container.
Example: chart.getChartLayoutInterface().getXLocation(400)
.
Call this after the chart is drawn.
Return Type: number
getYLocation(dataValue, optional_axis_index)
Returns the pixel y-coordinate of dataValue
relative to the top edge of the chart's container.
Example: chart.getChartLayoutInterface().getYLocation(300)
.
Call this after the chart is drawn.
Return Type: number
removeAction(actionID)
Removes the tooltip action with the requested actionID
from the chart.
Return Type: none
setAction(action)
Sets a tooltip action to be executed when the user clicks on the action text.
The setAction
method takes an object as its action parameter. This object should specify 3 properties: id
— the ID of the action being set, text
—the text that should appear in the tooltip for the action, and action
— the function that should be run when a user clicks on the action text.
Any and all tooltip actions should be set prior to calling the chart's draw()
method. Extended description.
Return Type: none
setSelection()
Selects the specified chart entities. Cancels any previous selection. Selectable entities are points and legend entries. A point corresponds to a cell in the data table, and a legend entry to a column (row index is null). For this chart, only one entity can be selected at a time. Extended description
.
Return Type: none
clearChart()
Clears the chart, and releases all of its allocated resources.
Return Type: none
EventsFor more information on how to use these events, see Basic Interactivity, Handling Events, and Firing Events.
Nameanimationfinish
Fired when transition animation is complete.
Properties: none
click
Fired when the user clicks inside the chart. Can be used to identify when the title, data elements, legend entries, axes, gridlines, or labels are clicked.
Properties: targetID
error
Fired when an error occurs when attempting to render the chart.
Properties: id, message
legendpagination
Fired when the user clicks legend pagination arrows. Passes back the current legend zero-based page index and the total number of pages.
Properties: currentPageIndex, totalPages
onmouseover
Fired when the user mouses over a visual entity. Passes back the row and column indices of the corresponding data table element.
Properties: row, column
onmouseout
Fired when the user mouses away from a visual entity. Passes back the row and column indices of the corresponding data table element.
Properties: row, column
ready
The chart is ready for external method calls. If you want to interact with the chart, and call methods after you draw it, you should set up a listener for this event before you call the draw
method, and call them only after the event was fired.
Properties: none
select
Fired when the user clicks a visual entity. To learn what has been selected, call getSelection()
.
Properties: none
Data policyAll code and data are processed and rendered in the browser. No data is sent to any server.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-07-10 UTC."],[],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4