# Histogram

## Overview


A *histogram* is a chart that groups numeric data into bins,
displaying the bins as segmented columns. They're used to depict the
distribution of a dataset: how often values fall into ranges.

Google Charts automatically chooses the number of bins for you.
All bins are equal width and have a height proportional to the number
of data points in the bin. In other respects, histograms are similar to [column charts](https://developers.google.com/chart/interactive/docs/gallery/columnchart).

## Example

Here's a histogram of dinosaur lengths:

The histogram tells us that the most common bin is \< 10 meters, and
that there's only one dinosaur over 40 meters. We can hover over the
bar to discover that it's the Seismosaurus (which might be just a very
big
Diplodocus; [paleontologists
aren't sure](http://blogs.smithsonianmag.com/dinosaur/2010/08/whatever-happened-to-seismosaurus/)).

The code to generate this histogram is shown below. After defining
the data (here,
with `google.visualization.arrayToDataTable`), the chart is
defined with a call to `google.visualization.Histogram` and
drawn with the `draw` method.

```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 = google.visualization.arrayToDataTable([
          ['Dinosaur', 'Length'],
          ['Acrocanthosaurus (top-spined lizard)', 12.2],
          ['Albertosaurus (Alberta lizard)', 9.1],
          ['Allosaurus (other lizard)', 12.2],
          ['Apatosaurus (deceptive lizard)', 22.9],
          ['Archaeopteryx (ancient wing)', 0.9],
          ['Argentinosaurus (Argentina lizard)', 36.6],
          ['Baryonyx (heavy claws)', 9.1],
          ['Brachiosaurus (arm lizard)', 30.5],
          ['Ceratosaurus (horned lizard)', 6.1],
          ['Coelophysis (hollow form)', 2.7],
          ['Compsognathus (elegant jaw)', 0.9],
          ['Deinonychus (terrible claw)', 2.7],
          ['Diplodocus (double beam)', 27.1],
          ['Dromicelomimus (emu mimic)', 3.4],
          ['Gallimimus (fowl mimic)', 5.5],
          ['Mamenchisaurus (Mamenchi lizard)', 21.0],
          ['Megalosaurus (big lizard)', 7.9],
          ['Microvenator (small hunter)', 1.2],
          ['Ornithomimus (bird mimic)', 4.6],
          ['Oviraptor (egg robber)', 1.5],
          ['Plateosaurus (flat lizard)', 7.9],
          ['Sauronithoides (narrow-clawed lizard)', 2.0],
          ['Seismosaurus (tremor lizard)', 45.7],
          ['Spinosaurus (spiny lizard)', 12.2],
          ['Supersaurus (super lizard)', 30.5],
          ['Tyrannosaurus (tyrant lizard)', 15.2],
          ['Ultrasaurus (ultra lizard)', 30.5],
          ['Velociraptor (swift robber)', 1.8]]);

        var options = {
          title: 'Lengths of dinosaurs, in meters',
          legend: { position: 'none' },
        };

        var chart = new google.visualization.Histogram(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
    </script>
  </head>
  <body>
    <div id="chart_div" style="width: 900px; height: 500px;"></div>
  </body>
</html>
```

The labels (here, the dinosaur names) can be omitted, in which case
the tooltips will show only the numeric value.

## Controlling Colors

Here's a histogram of national populations:

There are over two hundred countries with populations less than a
hundred million, and a severe tailing off after that.

This histogram uses the `colors` option to draw the data
in green:

```javascript
  var options = {
    title: 'Country Populations',
    legend: { position: 'none' },
    colors: ['green'],
  };
```

As with all Google Charts, colors can be specified either as
English names or as hex values.

## Controlling Buckets

By default, Google Charts will choose the bucket size
automatically, using a well-known algorithm for histograms. However,
sometimes you'll want to override that, and the chart above is an
example. With so many countries in the first bucket, it's hard to
examine those in others.

For situations like this, the Histogram chart provides two
options: `histogram.bucketSize`, which overrides the
algorithm and hardcodes the bucket size;
and `histogram.lastBucketPercentile`. The second option
needs more explanation: it changes the computation of
bucket sizes to ignore the values that are higher or lower than the
remaining values by the percentage you specify. The values are still
included in the histogram, but do not affect how they're
bucketed. This is useful when you don't want outliers to land in their
own buckets; they will be grouped with the first or last buckets instead.

In the above chart, we ignored the top five and bottom five percent
of values when calculating bucket size. The values are still charted;
the only thing that's changed is the bucket size, but it makes for a
more readable histogram.


This example also shows how we can change the scale of the vertical
axis to use "mirror log" scale, which also helps when charting data that has
a long tail of small values.

```javascript
  var options = {
    title: 'Country Populations',
    legend: { position: 'none' },
    colors: ['#e7711c'],
    histogram: { lastBucketPercentile: 5 },
    vAxis: { scaleType: 'mirrorLog' }
  };
```

As you can see, removing the top and bottom five percent from the
calculation led to a bucket size of 10,000,000 rather than the
100,000,000 it would have been otherwise. If you knew all along that a
bucket size of 10,000,000 was what you wanted, you could have
used `histogram.bucketSize` to do that:

```javascript
  var options = {
    title: 'Country Populations',
    legend: { position: 'none' },
    colors: ['#e7711c'],
    histogram: { bucketSize: 10000000 }
  };
```


In the following example, we show how to expand the range of the buckets and display many
more buckets with no gap between them. The `maxNumBuckets` option can be used
to increase the default number of buckets. The `histogram.minValue` and
`histogram.maxValue` options will expand the range of the buckets, but note
that if there is data outside this range, these options will not shrink the range.


This example also shows that you can specify the ticks to display for each of the buckets using
the explicit `ticks` option for the `hAxis`. This does not affect the
buckets themselves, but only how the ticks are displayed.


Note also that we specify the
`chartArea.width` such that the number of buckets will fit more precisely without
visual artifacts. Here are the options for this example.

```javascript
  var options = {
    title: 'Approximating Normal Distribution',
    legend: { position: 'none' },
    colors: ['#4285F4'],

    chartArea: { width: 405 },
    hAxis: {
      ticks: [-1, -0.75, -0.5, -0.25, 0, 0.25, 0.5, 0.75, 1]
    },
    bar: { gap: 0 },

    histogram: {
      bucketSize: 0.01,
      maxNumBuckets: 400,
      minValue: -1,
      maxValue: 1
    }
  };
```

## Multiple Series

Here's a histogram of the charges of subatomic particles, according
to the [Standard
Model](http://en.wikipedia.org/wiki/Standard_Model):

The above chart has one series containing all the particles.
Subatomic particles can be divided into four groups: quarks, leptons,
and bosons. Let's treat each as its own series:

In this chart, we use a different series (and therefore color) for
each of the four types of subatomic particle. We explicitly
set `interpolateNulls` to `false` to ensure that
the null values (needed because the series are of unequal length)
aren't plotted. We also set `legend.maxLines` to add
another line to the legend:

```javascript
  var data = google.visualization.arrayToDataTable([
    ['Quarks', 'Leptons', 'Gauge Bosons', 'Scalar Bosons'],
    [2/3, -1, 0, 0],
    [2/3, -1, 0, null],
    [2/3, -1, 0, null],
    [-1/3, 0, 1, null],
    [-1/3, 0, -1, null],
    [-1/3, 0, null, null],
    [-1/3, 0, null, null]
  ]);

  var options = {
    title: 'Charges of subatomic particles',
    legend: { position: 'top', maxLines: 2 },
    colors: ['#5C3292', '#1A8763', '#871B47', '#999999'],
    interpolateNulls: false,
  };
```

## Loading


The `google.charts.load` package name
is `"corechart"`.

```javascript
  google.charts.load("current", {packages: ["corechart"]});
```


The visualization's class name is `google.visualization.Histogram`:

```javascript
  var visualization = new google.visualization.Histogram(container);
```

## Data Format

There are two ways to populate a histogram datatable. When there's
only one series:

```javascript
  var data = google.visualization.arrayToDataTable([
    ['Name', 'Number'],
    ['Name 1', number1],
    ['Name 2', number2],
    ['Name 3', number3],
    ...
  ]);
```

...and when there are multiple series:

```javascript
  var data = google.visualization.arrayToDataTable([
    ['Series Name 1', 'Series Name 2', 'Series Name 3', ...],
    [series1_number1, series2_number1, series3_number1, ...],
    [series1_number2, series2_number2, series3_number2, ...],
    [series1_number3, series2_number3, series3_number3, ...],
    ...
  ]);
```

No optional column roles are supported for histograms at the moment.

## Configuration Options

| Name ||
|---|---|
| animation.duration | The duration of the animation, in milliseconds. For details, see the [animation documentation](https://developers.google.com/chart/interactive/docs/animation). **Type:** number **Default:** 0 |
| animation.easing | The easing function applied to the animation. The following options are available: - 'linear' - Constant speed. - 'in' - Ease in - Start slow and speed up. - 'out' - Ease out - Start fast and slow down. - 'inAndOut' - Ease in and out - Start slow, speed up, then slow down. **Type:** string **Default:** 'linear' |
| animation.startup | Determines 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 |
| axisTitlesPosition | Where to place the axis titles, compared to the chart area. Supported values: - in - Draw the axis titles inside the chart area. - out - Draw the axis titles outside the chart area. - none - Omit the axis titles. **Type:** string **Default:** 'out' |
| backgroundColor | The 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.stroke | The color of the chart border, as an HTML color string. **Type:** string **Default:** '#666' |
| backgroundColor.strokeWidth | The border width, in pixels. **Type:** number **Default:** 0 |
| backgroundColor.fill | The chart fill color, as an HTML color string. **Type:** string **Default:** 'white' |
| bar.groupWidth | The width of a group of bars, specified in either of these formats: - Pixels (e.g. 50). - Percentage of the available width for each group (e.g. '20%'), where '100%' means that groups have no space between them. **Type:** number or string **Default:** The [golden ratio](http://en.wikipedia.org/wiki/Golden_ratio), approximately '61.8%'. |
| chartArea | An 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.backgroundColor | Chart 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.left | How far to draw the chart from the left border. **Type:** number or string **Default:** auto |
| chartArea.top | How far to draw the chart from the top border. **Type:** number or string **Default:** auto |
| chartArea.width | Chart area width. **Type:** number or string **Default:** auto |
| chartArea.height | Chart area height. **Type:** number or string **Default:** auto |
| colors | The 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 |
| dataOpacity | The 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](https://developers.google.com/chart/interactive/docs/gallery/trendlines#Example4).) **Type:** number **Default:** 1.0 |
| enableInteractivity | Whether 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 |
| focusTarget | The type of the entity that receives focus on mouse hover. Also affects which entity is selected by mouse click, and which data table element is associated with events. Can be one of the following: - 'datum' - Focus on a single data point. Correlates to a cell in the data table. - 'category' - Focus on a grouping of all data points along the major axis. Correlates to a row in the data table. In focusTarget 'category' the tooltip displays all the category values. This may be useful for comparing values of different series. **Type:** string **Default:** 'datum' |
| fontSize | The 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 |
| fontName | The default font face for all text in the chart. You can override this using properties for specific chart elements. **Type:** string **Default:** 'Arial' |
| forceIFrame | Draws 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 |
| hAxis | An 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.gridlines | An 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.color | The color of the horizontal gridlines inside the chart area. Specify a valid HTML color string. **Type:** string **Default:** '#CCC' |
| hAxis.gridlines.count | The 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.interval | An array of sizes (as data values, not pixels) between adjacent gridlines. This option is only for numeric axes at this time, but it is analogous to the `gridlines.units.<unit>.interval` options which are used only for dates and times. For linear scales, the default is `[1, 2, 2.5, 5]` which means the gridline values can fall on every unit (1), on even units (2), or on multiples of 2.5 or 5. Any power of 10 times these values is also considered (e.g. \[10, 20, 25, 50\] and \[.1, .2, .25, .5\]). For log scales, the default is `[1, 2, 5]`. **Type:** number between 1 and 10, not including 10. **Default:** computed |
| hAxis.gridlines.minSpacing | The minimum screen space, in pixels, between hAxis major gridlines. The default for major gridlines is `40` for linear scales, and `20` for log scales. If you specify the `count` and not the `minSpacing`, the minSpacing is computed from the count. And conversely, if you specify the `minSpacing` and not the `count`, the count is computed from the minSpacing. If you specify both, the `minSpacing` overrides. **Type:** number **Default:** computed |
| hAxis.gridlines.multiple | All gridline and tick values must be a multiple of this option's value. Note that, unlike for intervals, powers of 10 times the multiple are not considered. So you can force ticks to be integers by specifying `gridlines.multiple = 1`, or force ticks to be multiples of 1000 by specifying `gridlines.multiple = 1000`. **Type:** number **Default:** 1 |
| hAxis.gridlines.units | Overrides 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](https://developers.google.com/chart/interactive/docs/datesandtimes#axesgridlinesticks). **Type:** object **Default:** null |
| hAxis.minorGridlines | An object with members to configure the minor gridlines on the horizontal axis, similar to the hAxis.gridlines option. **Type:** object **Default:** null |
| hAxis.minorGridlines.color | The 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.count | The `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.interval | The minorGridlines.interval option is like the major gridlines interval option, but the interval that is chosen will always be an even divisor of the major gridline interval. The default interval for linear scales is `[1, 1.5, 2, 2.5, 5]`, and for log scales is `[1, 2, 5]`. **Type:** number **Default:**1 |
| hAxis.minorGridlines.minSpacing | The minimum required space, in pixels, between adjacent minor gridlines, and between minor and major gridlines. The default value is 1/2 the minSpacing of major gridlines for linear scales, and 1/5 the minSpacing for log scales. **Type:** number **Default:**computed |
| hAxis.minorGridlines.multiple | Same as for major `gridlines.multiple`. **Type:** number **Default:** 1 |
| hAxis.minorGridlines.units | Overrides 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](https://developers.google.com/chart/interactive/docs/datesandtimes#axesgridlinesticks). **Type:** object **Default:** null |
| hAxis.textPosition | Position of the horizontal axis text, relative to the chart area. Supported values: 'out', 'in', 'none'. **Type:** string **Default:** 'out' |
| hAxis.textStyle | An 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>} ` |
| hAxis.title | `hAxis` property that specifies the title of the horizontal axis. **Type:** string **Default:** null |
| hAxis.titleTextStyle | An 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>} ` |
| hAxis.allowContainerBoundaryTextCutoff | If false, will hide outermost labels rather than allow them to be cropped by the chart container. If true, will allow label cropping. **Type:** boolean **Default:** false |
| hAxis.slantedText | If true, draw the horizontal axis text at an angle, to help fit more text along the axis; if false, draw horizontal axis text upright. Default behavior is to slant text if it cannot all fit when drawn upright. Notice that this option is available only when the `hAxis.textPosition` is set to 'out' (which is the default). The default is `false` for dates and times. **Type:** boolean **Default:** automatic |
| hAxis.slantedTextAngle | The angle of the horizontal axis text, if it's drawn slanted. Ignored if `hAxis.slantedText` is `false`, or is in auto mode, and the chart decided to draw the text horizontally. If the angle is positive, the rotation is counter-clockwise, and if negative, it is clockwise. **Type:** number, -90---90 **Default:** 30 |
| hAxis.maxAlternation | Maximum number of levels of horizontal axis text. If axis text labels become too crowded, the server might shift neighboring labels up or down in order to fit labels closer together. This value specifies the most number of levels to use; the server can use fewer levels, if labels can fit without overlapping. For dates and times, the default is 1. **Type:** number **Default:** 2 |
| hAxis.maxTextLines | Maximum number of lines allowed for the text labels. Labels can span multiple lines if they are too long, and the number of lines is, by default, limited by the height of the available space. **Type:** number **Default:** auto |
| hAxis.minTextSpacing | Minimum horizontal spacing, in pixels, allowed between two adjacent text labels. If the labels are spaced too densely, or they are too long, the spacing can drop below this threshold, and in this case one of the label-unclutter measures will be applied (e.g, truncating the labels or dropping some of them). **Type:** number **Default:** The value of `hAxis.textStyle.fontSize` |
| hAxis.showTextEvery | How many horizontal axis labels to show, where 1 means show every label, 2 means show every other label, and so on. Default is to try to show as many labels as possible without overlapping. **Type:** number **Default:** automatic |
| hAxis.viewWindowMode | Specifies how to scale the horizontal axis to render the values within the chart area. The following string values are supported: - 'pretty' - Scale the horizontal values so that the maximum and minimum data values are rendered a bit inside the left and right of the chart area. The viewWindow is expanded to the nearest major gridline for numbers, or the nearest minor gridline for dates and times. - 'maximized' - Scale the horizontal values so that the maximum and minimum data values touch the left and right of the chart area. This will cause `haxis.viewWindow.min` and `haxis.viewWindow.max` to be ignored. - 'explicit' - A deprecated option for specifying the left and right scale values of the chart area. (Deprecated because it's redundant with `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. |
| hAxis.viewWindow | Specifies the cropping range of the horizontal axis. **Type:** object **Default:** null |
| hAxis.viewWindow.max | The zero-based row index where the cropping window ends. Data points at this index and higher will be cropped out. In conjunction with `vAxis.viewWindowMode.min`, it defines a half-opened range \[min, max) that denotes the element indices to display. In other words, every index such that `min <= index < max` will be displayed. Ignored when `hAxis.viewWindowMode` is 'pretty' or 'maximized'. **Type:** number **Default:** auto |
| hAxis.viewWindow.min | The zero-based row index where the cropping window begins. Data points at indices lower than this will be cropped out. In conjunction with `vAxis.viewWindowMode.max`, it defines a half-opened range \[min, max) that denotes the element indices to display. In other words, every index such that `min <= index < max` will be displayed. Ignored when `hAxis.viewWindowMode` is 'pretty' or 'maximized'. **Type:** number **Default:** auto |
| histogram.bucketSize | Hardcode the size of each histogram bar, rather than letting it be determined algorithmically. **Type:** number **Default:** auto |
| histogram.hideBucketItems | Omit the thin divisions between the blocks of the histogram, making it into a series of solid bars. **Type:** boolean **Default:** false |
| histogram.lastBucketPercentile | When calculating the histogram's bucket size, ignore the top and bottom `lastBucketPercentile` percent. The values are still included in the histogram, but do not affect bucketing. **Type:** number **Default:** 0 |
| histogram.minValue | Expand the range of buckets to include this value. **Type:** number **Default:** auto - use data min |
| histogram.maxValue | Expand the range of buckets to include this value. **Type:** number **Default:** auto - use data max |
| histogram.numBucketsRule | How to compute the default number of buckets. Possible values are: - `'sqrt'` - Computes the square root of the number of data points. - `'sturges'` - Derived from the binomial distribution. Implicitly assumes an approximately normal distribution. - `'rice'` - A simpler alternative to Sturges's rule. For more details, see [Wikipedia - Histogram: Number of bins and width](https://en.wikipedia.org/wiki/Histogram#Number_of_bins_and_width) <br /> **Type:** string **Default:** `'sqrt'` |
| height | Height of the chart, in pixels. **Type:** number **Default:** height of the containing element |
| interpolateNulls | Whether to guess the value of missing points. If true, it will guess the value of any missing data based on neighboring points. If false, it will leave a break in the line at the unknown point. This **is not** supported by [Area](https://developers.google.com/chart/interactive/docs/gallery/areachart) charts with the `isStacked: true/'percent'/'relative'/'absolute'` option. **Type:** boolean **Default:** false |
| isStacked | If set to true, stacks the elements for all series at each domain value. **Note:** In [Column](https://developers.google.com/chart/interactive/docs/gallery/columnchart), [Area](https://developers.google.com/chart/interactive/docs/gallery/areachart), and [SteppedArea](https://developers.google.com/chart/interactive/docs/gallery/steppedareachart) charts, Google Charts reverses the order of legend items to better correspond with the stacking of the series elements (E.g. series 0 will be the bottom-most legend item). This **does not** apply to [Bar](https://developers.google.com/chart/interactive/docs/gallery/barchart) Charts. The `isStacked` option also supports 100% stacking, where the stacks of elements at each domain value are rescaled to add up to 100%. The options for `isStacked` are: - `false` --- elements will not stack. This is the default option. - `true` --- stacks elements for all series at each domain value. - `'percent'` --- stacks elements for all series at each domain value and rescales them such that they add up to 100%, with each element's value calculated as a percentage of 100%. - `'relative'` --- stacks elements for all series at each domain value and rescales them such that they add up to 1, with each element's value calculated as a fraction of 1. - `'absolute'` --- functions the same as `isStacked: true`. For 100% stacking, the calculated value for each element will appear in the tooltip after its actual value. The target axis will default to tick values based on the relative 0-1 scale as fractions of 1 for `'relative'`, and 0-100% for `'percent'` (**Note:** when using the `'percent'` option, the axis/tick values are displayed as percentages, however the actual values are the relative 0-1 scale values. This is because the percentage axis ticks are the result of applying a format of "#.##%" to the relative 0-1 scale values. When using `isStacked: 'percent'`, be sure to specify any ticks/gridlines using the relative 0-1 scale values). You can customize the gridlines/tick values and formatting using the appropriate `hAxis/vAxis` options. 100% stacking only supports data values of type `number`, and must have a baseline of zero. **Type:** boolean/string **Default:** false |
| legend | An 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.alignment | Alignment of the legend. Can be one of the following: - 'start' - Aligned to the start of the area allocated for the legend. - 'center' - Centered in the area allocated for the legend. - 'end' - Aligned to the end of the area allocated for the legend. 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.maxLines | Maximum 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.pageIndex | Initial selected zero-based page index of the legend. **Type:** number **Default:** 0 |
| legend.position | Position of the legend. Can be one of the following: - 'bottom' - Below the chart. - 'left' - To the left of the chart, provided the left axis has no series associated with it. So if you want the legend on the left, use the option `targetAxisIndex: 1`. - 'in' - Inside the chart, by the top left corner. - 'none' - No legend is displayed. - 'right' - To the right of the chart. Incompatible with the `vAxes` option. - 'top' - Above the chart. **Type:** string **Default:** 'right' |
| legend.textStyle | An 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>} ` |
| orientation | The 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' |
| reverseCategories | If set to true, will draw series from right to left. The default is to draw left-to-right. **Type:** boolean **Default:** false |
| series | An 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. - `targetAxisIndex` - Which axis to assign this series to, where 0 is the default axis, and 1 is the opposite axis. Default value is 0; set to 1 to define a chart where different series are rendered against different axes. At least one series much be allocated to the default axis. You can define a different scale for different axes. - `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:** {} |
| theme | A 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: - 'maximized' - Maximizes the area of the chart, and draws the legend and all of the labels inside the chart area. Sets the following options: ``` chartArea: {width: '100%', height: '100%'}, legend: {position: 'in'}, titlePosition: 'in', axisTitlesPosition: 'in', hAxis: {textPosition: 'in'}, vAxis: {textPosition: 'in'} ``` **Type:** string **Default:** null |
| title | Text to display above the chart. **Type:** string **Default:** no title |
| titlePosition | Where to place the chart title, compared to the chart area. Supported values: - in - Draw the title inside the chart area. - out - Draw the title outside the chart area. - none - Omit the title. **Type:** string **Default:** 'out' |
| titleTextStyle | An 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>} ` |
| tooltip | 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.isHtml | If set to true, use HTML-rendered (rather than SVG-rendered) tooltips. See [Customizing Tooltip Content](https://developers.google.com/chart/interactive/docs/customizing_tooltip_content) for more details. **Note:** customization of the HTML tooltip content via the [tooltip column data role](https://developers.google.com/chart/interactive/docs/roles#tooltiprole) is **not** supported by the [Bubble Chart](https://developers.google.com/chart/interactive/docs/gallery/bubblechart) visualization. **Type:** boolean **Default:** false |
| tooltip.showColorCode | If true, show colored squares next to the series information in the tooltip. The default is true when `focusTarget` is set to 'category', otherwise the default is false. **Type:** boolean **Default:** automatic |
| tooltip.textStyle | An 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>} ` |
| tooltip.trigger | The user interaction that causes the tooltip to be displayed: - 'focus' - The tooltip will be displayed when the user hovers over the element. - 'none' - The tooltip will not be displayed. **Type:** string **Default:** 'focus' |
| vAxes | Specifies properties for individual vertical axes, if the chart has multiple vertical axes. Each child object is a `vAxis` object, and can contain all the properties supported by `vAxis`. These property values override any global settings for the same property. To specify a chart with multiple vertical axes, first define a new axis using `series.targetAxisIndex`, then configure the axis using `vAxes`. The following example assigns series 2 to the right axis and specifies a custom title and text style for it: ``` { series: { 2: { targetAxisIndex:1 } }, vAxes: { 1: { title:'Losses', textStyle: {color: 'red'} } } } ``` This property can be either an object or an array: the object is a collection of objects, each with a numeric label that specifies the axis that it defines--this is the format shown above; the array is an array of objects, one per axis. For example, the following array-style notation is identical to the `vAxis` object shown above: ``` vAxes: [ {}, // Nothing specified for axis 0 { title:'Losses', textStyle: {color: 'red'} // Axis 1 } ] ``` **Type:** Array of object, or object with child objects **Default:** null |
| vAxis | An 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.baseline | `vAxis` 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.baselineColor | Specifies 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.direction | The 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.format | A format string for numeric axis labels. This is a subset of the [ICU pattern set](http://icu-project.org/apiref/icu4c/classDecimalFormat.html#_details). 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](https://developers.google.com/chart/interactive/docs/library_loading_enhancements#loadwithlocale). 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.gridlines | An 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.color | The color of the vertical gridlines inside the chart area. Specify a valid HTML color string. **Type:** string **Default:** '#CCC' |
| vAxis.gridlines.count | The 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.interval | An array of sizes (as data values, not pixels) between adjacent gridlines. This option is only for numeric axes at this time, but it is analogous to the `gridlines.units.<unit>.interval` options which are used only for dates and times. For linear scales, the default is `[1, 2, 2.5, 5]` which means the gridline values can fall on every unit (1), on even units (2), or on multiples of 2.5 or 5. Any power of 10 times these values is also considered (e.g. \[10, 20, 25, 50\] and \[.1, .2, .25, .5\]). For log scales, the default is `[1, 2, 5]`. **Type:** number between 1 and 10, not including 10. **Default:** computed |
| vAxis.gridlines.minSpacing | The minimum screen space, in pixels, between hAxis major gridlines. The default for major gridlines is `40` for linear scales, and `20` for log scales. If you specify the `count` and not the `minSpacing`, the minSpacing is computed from the count. And conversely, if you specify the `minSpacing` and not the `count`, the count is computed from the minSpacing. If you specify both, the `minSpacing` overrides. **Type:** number **Default:** computed |
| vAxis.gridlines.multiple | All gridline and tick values must be a multiple of this option's value. Note that, unlike for intervals, powers of 10 times the multiple are not considered. So you can force ticks to be integers by specifying `gridlines.multiple = 1`, or force ticks to be multiples of 1000 by specifying `gridlines.multiple = 1000`. **Type:** number **Default:** 1 |
| vAxis.gridlines.units | Overrides 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](https://developers.google.com/chart/interactive/docs/datesandtimes#axesgridlinesticks). **Type:** object **Default:** null |
| vAxis.minorGridlines | An object with members to configure the minor gridlines on the vertical axis, similar to the vAxis.gridlines option. **Type:** object **Default:** null |
| vAxis.minorGridlines.color | The 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.count | The 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.interval | The minorGridlines.interval option is like the major gridlines interval option, but the interval that is chosen will always be an even divisor of the major gridline interval. The default interval for linear scales is `[1, 1.5, 2, 2.5, 5]`, and for log scales is `[1, 2, 5]`. **Type:** number **Default:**1 |
| vAxis.minorGridlines.minSpacing | The minimum required space, in pixels, between adjacent minor gridlines, and between minor and major gridlines. The default value is 1/2 the minSpacing of major gridlines for linear scales, and 1/5 the minSpacing for log scales. **Type:** number **Default:**computed |
| vAxis.minorGridlines.multiple | Same as for major `gridlines.multiple`. **Type:** number **Default:** 1 |
| vAxis.minorGridlines.units | Overrides 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](https://developers.google.com/chart/interactive/docs/datesandtimes#axesgridlinesticks). **Type:** object **Default:** null |
| vAxis.logScale | If true, makes the vertical axis a logarithmic scale. Note: All values must be positive. **Type:** boolean **Default:** false |
| vAxis.scaleType | `vAxis` property that makes the vertical axis a logarithmic scale. Can be one of the following: - null - No logarithmic scaling is performed. - 'log' - Logarithmic scaling. Negative and zero values are not plotted. This option is the same as setting `vAxis: { logscale: true }`. - 'mirrorLog' - Logarithmic scaling in which negative and zero values are plotted. The plotted value of a negative number is the negative of the log of the absolute value. Values close to 0 are plotted on a linear scale. **Type:** string **Default:** null |
| vAxis.textPosition | Position of the vertical axis text, relative to the chart area. Supported values: 'out', 'in', 'none'. **Type:** string **Default:** 'out' |
| vAxis.textStyle | An 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>} ` |
| vAxis.ticks | 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.title | `vAxis` property that specifies a title for the vertical axis. **Type:** string **Default:** no title |
| vAxis.titleTextStyle | An 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>} ` |
| vAxis.maxValue | 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.minValue | Moves 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.viewWindowMode | Specifies how to scale the vertical axis to render the values within the chart area. The following string values are supported: - 'pretty' - Scale the vertical values so that the maximum and minimum data values are rendered a bit inside the bottom and top of the chart area. The viewWindow is expanded to the nearest major gridline for numbers, or the nearest minor gridline for dates and times. - 'maximized' - Scale the vertical values so that the maximum and minimum data values touch the top and bottom of the chart area. This will cause `vaxis.viewWindow.min` and `vaxis.viewWindow.max` to be ignored. - 'explicit' - A deprecated option for specifying the top and bottom scale values of the chart area. (Deprecated because it's redundant with `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. |
| vAxis.viewWindow | Specifies the cropping range of the vertical axis. **Type:** object **Default:** null |
| vAxis.viewWindow.max | The maximum vertical data value to render. Ignored when `vAxis.viewWindowMode` is 'pretty' or 'maximized'. **Type:** number **Default:** auto |
| vAxis.viewWindow.min | The minimum vertical data value to render. Ignored when `vAxis.viewWindowMode` is 'pretty' or 'maximized'. **Type:** number **Default:** auto |
| width | Width of the chart, in pixels. **Type:** number **Default:** width of the containing element |

## Methods

| Method ||
|---|---|
| `draw(data, options)` | Draws the chart. The chart accepts further method calls only after the [`ready`](https://developers.google.com/chart/interactive/docs/gallery/histogram#Events)event is fired. [`Extended description`](https://developers.google.com/chart/interactive/docs/reference#visdraw). **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](https://developers.google.com/chart/interactive/docs/events)), 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](https://developers.google.com/chart/interactive/docs/printing). **Return Type:** string |
| `getSelection()` | Returns an array of the selected chart entities. Selectable entities are bars, legend entries and categories. For this chart, only one entity can be selected at any given moment. [`Extended description`](https://developers.google.com/chart/interactive/docs/reference#visgetselection). **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](https://developers.google.com/chart/interactive/docs/reference#vissetaction). **Return Type:** `none` |
| `setSelection()` | Selects the specified chart entities. Cancels any previous selection. Selectable entities are bars, legend entries and categories. For this chart, only one entity can be selected at a time. [`Extended description`](https://developers.google.com/chart/interactive/docs/reference#vissetselection). **Return Type:** none |
| `clearChart()` | Clears the chart, and releases all of its allocated resources. **Return Type:** none |

## Events


For more information on how to use these events, see
[Basic Interactivity](https://developers.google.com/chart/interactive/docs/basic_interactivity),
[Handling Events](https://developers.google.com/chart/interactive/docs/events), and
[Firing Events](https://developers.google.com/chart/interactive/docs/dev/events).

| Name ||
|---|---|
| `animationfinish` | 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. A bar correlates to a cell in the data table, a legend entry to a column (row index is null), and a category to a row (column index is null). **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. A bar correlates to a cell in the data table, a legend entry to a column (row index is null), and a category to a row (column index is null). **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()`](https://developers.google.com/chart/interactive/docs/gallery/histogram#Methods). **Properties:** none |

## Data Policy


All code and data are processed and rendered in the browser. No data is sent to any server.