
This page describes how to create a variety of callouts, bubbles, pins, and other graphics that can be requested by URL, or added as markers on top of other charts.
Table of Contents
Introduction
The Chart API enables you to create a variety of interesting callouts,
pins, or bubbles that mix text and images. These items are called dynamic icons.
You can either create a freestanding dynamic icon image,
or you can position a dynamic icon on top of your chart as a marker type using
the chem
parameter. This page will describe how to create dynamic icons as either
freestanding images or as markers on another chart. The Infographics
Dynamic Icons reference page describes all
the types of dynamic marker types available.
The syntax for creating a dynamic icon depends on whether you want a freestanding icon, or as a dynamic marker in another chart.
Freestanding Icons
You can request a dynamic icon image the same way you request any of the other charts. A freestanding dynamic icon supports a different set of parameters than other charts do:
Parameter | Required or Optional | Description |
---|---|---|
chst=<icon_string_constant> |
Required | Describes which kind of icon to create.
|
chld=<icon_data> |
Required | The specific data used to describe the icon's size, rotation, text, and other required data.
|
cht |
NOT USED | Freestanding dynamic icon charts don't use the cht parameter. |
chs |
NOT USED | Freestanding dynamic icon charts don't use the chs parameter. |
chd |
NOT USED | Use the chld parameter to pass data to a freestanding dynamic icon. |
Example
https://chart.googleapis.com/chart?chst=d_bubble_icon_text_small&chld=ski|bb|Wheeee!|FFFFFF|000000
Dynamic Markers
You can embed a dynamic icon as a marker type on several different types of charts
using the chem
parameter. See the chem
documentation to
learn how.
Example
https://chart.googleapis.com/chart?
chs=300x140
cht=lc&chco=FF9900,224499
chd=t:75,74,66,30,10,5,3,1
chls=1|1
chem=y;s=bubble_icon_text_small;d=ski,bb,Wheeee!,FFFFFF;dp=2;ds=0
chm=v,ccccFF,0,::.2,2
Common Icon Features
Most icons can have text strings or shadows associated with them.
Text Strings
All display text passed to the Chart API must be UTF-8 encoded and then URL-encoded.
This affects only non-URL-safe characters (URL-safe characters are mostly the
English letters a-z both upper and lower case, plus plus a small
set of punctuation). For example, the UTF-8 and URL-encoded value for
the letter "è" is "%C3%A8
", and for the Chinese
character 駅 is "%E9%A7%85
". Most browsers will let you use an unencoded value
in the URL string (for example, 駅) and will encode it for you behind the scenes.
However, it is possible that someone viewing your chart URL is using a browser
that doesn't do this, so it is usually best to UTF-8 and URL-encode all non-ASCII
characters in text strings. Note that this is only for the text shown in bubbles
or pins, not for the &,
|, or other characters that are part of the URL syntax.
When using the chem
parameter to specify dynamic icon markers,
you must also escape certain characters in your text, as described in the chem
documentation.
Shadows
You can add shadows to many icons, or even draw shadows for some icons without the icon itself!
Shadowed Icons
Many of these icons can be drawn with or without shadows. If shadowing
is an option, the icon name will have a version that ends in _withshadow
and
another version without that ending. You can specify an icon with either ending,
depending on whether you want the shadow or not.
Here's an example of a medium text bubble and a pin with and without shadows:
![]() chst=d_bubble_icon_text_big |
![]() chst=d_bubble_icon_text_big_withshadow |
![]() chst=d_map_pin_icon |
![]() chst=d_map_pin_icon_withshadow |
Freestanding Shadows 
Some icon types allow you to draw their shadow by itself. You might want to do this if you are using several overlapping shadowed icons on a graphic, and they are so close that the shadow from one falls across another icon. For example, here is two shadowed bubbles, Robert drawn first, then Alice:
Note how Alice's shadow partially covers Robert. To fix this, you can draw the Alice shadow first, then the Robert bubble, then Alice without a shadow. Perhaps not totally realistic in terms of lighting and shadows, but it avoids obscuring one bubble with the shadow of another:
chem=
y;s=bubble_text_small_shadow;d=bb,Alice,FF8,000;ds=0;dp=1;py=1 // Alice, no shadow
y;s=bubble_text_small_withshadow;d=bbtr,Robert,FF8,000;ds=0;dp=3.5;py=1 // Robert with shadow
y;s=bubble_text_small;d=bb,Alice,FF8,000;ds=0;dp=1;py=1 // Alice shadow
All
markers specify the same z-order of 1 (py=1
), so they are drawn in
the order listed, on top of the chart elements (the chart
line). First the Alice shadow is drawn, then the Robert bubble
on top of that, and finally the Alice bubble
on top.
See the documentation of your specific icon type to learn whether you can draw its shadow alone.
Contextual Icons

You can specify an icon that varies its color, size, or stacking according to the point they are assigned to. These icon types are available as dynamic icon markers only (chem
parameter), not as freestanding icons.
These icons can be rendered on a series other than the series that specifies their color, size, or stacking information. This means that the chem
parameter's ds
value specifies the series on which to render the icon, but the values for determining the size or color of the icon are specified in the parameters given below. One good use of this is to use a hidden data series for icon data, but render the icons on a visible line or bar. Here are some examples:
Icon rendered on source series | Icon rendered on non-source series | Icon using hidden series |
---|---|---|
![]() |
![]() |
![]() |
chem=
|
chem=
|
chd=t1:
|
Context Marker Types
Marker Type | chem s Value |
Example |
---|---|---|
Color variation | s=cm_color |
![]() |
Size variation | s=cm_size |
![]() |
Color and size variation | s=cm_color_size |
![]() |
Stacking variation | s=cm_repeat |
![]() |
Stacking and color variation | s=cm_repeat_color |
![]() |
Alignment Strings for Contextual Icons
The contextual icons support an optional alignment string to specify an alignment and offset of the icon to the data point. This string has the following syntax:
<alignment>[+/-<h_anchor_offset>+/-<v_anchor_offset>]
- alignment
- Two letters describing the alignment of the icon to the point. Examples include
tl
(top left), andrb
(bottom right). See the alignment_string parameter description of thechem
parameter for a complete listing and description. - h_anchor_offset
- [Optional] The horizontal offset of the anchor point, in pixels. Values including zero must be preceded by either + or -. Important: You must url-encode + as %2B.
- v_anchor_offset
- [Optional] The vertical offset of the anchor point, in pixels. Values including zero must be preceded by either + or -. Important: You must url-encode + as %2B.
Note that you can also use the of
component of the chem
parameter to specify horizontal and vertical offsets. If you specify both the of
component and h_anchor_offset v_anchor_offset
values, all offsets will be applied to your icon.
Examples:
![]() hb-0-0 Horizontal center bottom No offsets |
![]() lb-0-0 Bottom left No offsets |
![]() rb-0-0 Bottom right No offsets |
![]() ht-0-0 Horizontal top No offsets |
![]() hb-20-0 Horizontal center bottom -20 horizontal 0 vertical |
![]() hb%2b20-0 Horizontal center bottom +20 horizontal 0 vertical |
![]() hb-0%2b10 Horizontal center bottom 0 horizontal +10 vertical |
![]() hb-0-20 Horizontal center bottom 0 horizontal -20 vertical |
Color Variation (cm_color
)
You can vary the color of a contextual chart marker according to the point that it represents. You must specify a color range, and the data value will be scaled to a corresponding color within that range.
Syntax
chem=y;s=cm_color;ds=<series_rendering_index>; ...other_values... ; d=<icon_shape>,<color_data_series>,<low_color>,<middle_color>,<high_color>,<icon_size>,<outline_color>,<alignment>
- <icon_shape>
- The icon to use. Specify an ID string identifying one of the images listed at the end of the page.
- <color_data_series>
- The zero-based index of the data series used to vary the color of the icons.
- <low_color>
- The low color value in the range, as a three- or six-digit HTML hexadecimal color (no # mark). This is associated with the lowest possible value in the available data range.
- <middle_color>
- The middle color value in the range, as a three- or six-digit HTML hexadecimal color (no # mark). This is associated with the middle value in the available data range.
- <high_color>
- The high color value in the range, as a three- or six-digit HTML hexadecimal color (no # mark). This is associated with the highest possible value in the available data range.
- <icon_size>
- The size of the icon, in pixels. The following values are supported: 12, 16, 24.
- <outline_color>
- The outline color for the icon, as a three- or six-digit HTML hexadecimal color (no # mark).
- <alignment>
- An optional string describing the icon alignment and offset.
Example
|
![]() chem=y;s=cm_color; |
Size Variation (cm_size
)
You can vary the size alone of a contextual chart marker, according to the data series of your choice.
Syntax
chem=y;s=cm_size;ds=<series_rendering_index>; ...other_values... ; d=<icon_type>,<size_data_series>,<zero_value_size>,<size_multiplier>,<min_size>,<outline_color>,<fill_color>,<alignment>
- <icon_type>
- The shape of the icon. Choose one of the following values:
maps_pin
,disk
, orsquare
. - <size_data_series>
- The zero-based index of the data series used to vary the size of the icons.
- <zero_value_size>
- The base size of the icon, at the minimum data value for the series.
- <size_multiplier>
- A size scaling factor. This value is multiplied against the difference between each icon's data value and the minimum series value, to calculate the final icon size. Therefore, an icon at the 0 data value will not be affected by this multiplier.
- <min_size>
- The minimum size for any icon, in pixels.
- <outline_color>
- The outline color for the icon, as a three- or six-digit HTML hexadecimal color (no # mark).
- <fill_color>
- The fill color for the icon, as a three- or six-digit HTML hexadecimal color (no # mark).
- <alignment>
- An optional string describing the icon alignment and offset.
Examples
A basic example. The icon with zero value is rendered at the zero value size, which is 30 pixels. Sizes increase along with the data. | ![]() chd=t:0,10,20,30,40,50,60,70 |
In this example, the icons take their size data from the yellow line, but are rendered on the blue line.
|
![]() chem=chem=y;s=cm_size;ds=1;dp=all;d=maps_pin,0,10,90,10,8F8,000,hb |
Color and Size Variation (cm_color_size
)
You can vary both color and size of a contextual chart marker, according to the data series of your choice.
Syntax
chem=y;s=cm_color_size;ds=<series_rendering_index>; ...other_values... ; d=<icon_type>,<color_data_series>,<low_color>,<middle_color>,<high_color>,<size_data_series>,<zero_value_size>,<size_multiplier>,<min_size>,<outline_color>,<alignment>
- <icon_type>
- The shape of the icon. Choose one of the following values:
maps_pin
,disk
, orsquare
. - <color_data_series>
- The zero-based index of the data series used to vary the color of the icons.
- <low_color>
- The low color value in the range, as a three- or six-digit HTML hexadecimal color (no # mark). This is associated with the lowest possible value in the available data range.
- <middle_color>
- The middle color value in the range, as a three- or six-digit HTML hexadecimal color (no # mark). This is associated with the middle value in the available data range.
- <high_color>
- The high color value in the range, as a three- or six-digit HTML hexadecimal color (no # mark). This is associated with the highest possible value in the available data range.
- <size_data_series>
- The zero-based index of the data series used to vary the size of the icons.
- <zero_value_size>
- The base size of the icon, at the minimum data value for the series.
- <size_multiplier>
- A size scaling factor. This value is multiplied against the difference between each icon's data value and the minimum series value, to calculate the final icon size. Therefore, an icon at the 0 data value will not be affected by this multiplier.
- <min_size>
- The minimum size for any icon, in pixels.
- <outline_color>
- The outline color for the icon, as a three- or six-digit HTML hexadecimal color (no # mark).
- <alignment>
- An optional string describing the icon alignment and offset.
Examples
This example uses two lines. The pins use color data from the series on which they're rendered, but
use size data from the other series.
|
![]() chd=s:0akAZtnkmi,nbMPJOKXXS |
Stacking Variation (cm_repeat
)
You can vary the height of a stack of icons according to the data value at a specific point.
Syntax
chem=y;s=cm_repeat;ds=<series_rendering_index>; ...other_values... ; d=<icon_shape>,<repeat_series_index>,<scaling_factor>,<stacking_direction>,<icon_size>,<fill_color>,<outline_color>,<spacing>,<alignment>
- <icon_shape>
- The icon to use. Specify an ID string identifying one of the images listed at the end of the page.
- <repeat_series_index>
- The zero-based index of the data series used to calculate how many icons to place at this point.
- <scaling_factor>
- The source data series value is scaled to a value from 0 to 1 and multiplied by this value to determine how many markers to place on this point. Partial values are truncated.
- <stacking_direction>
- Stacking direction: either "h" (lowercase) for horizontal or "V" (uppercase) for vertical.
- <icon_size>
- The size of each marker, in pixels. The following values are supported: 12, 16, 24.
- <fill_color>
- The fill color for the icon, as a three- or six-digit HTML hexadecimal color (no # mark).
- <outline_color>
- The outline color for the icon, as a three- or six-digit HTML hexadecimal color (no # mark).
- <spacing>
- How much space to put between each marker in a stack, in pixels.
- <alignment>
- An optional string describing the icon alignment and offset.
Example
This example uses a second dummy data series. It is not rendered on the chart, but used
as a way to space all the stacks evenly, starting at the bottom of the chart.
|
![]() chd=s1:0akAZtnkmi,AAAAAAAAAA
|
Stacking and Color Variation (cm_repeat_color
)
You can vary the both the height and color of an icon stack, according to the data value at a specific point.
Syntax
chem=y;s=cm_repeat_color;ds=<series_rendering_index>; ...other_values... ; d=<icon_shape>,<repeat_series_index>,<scaling_factor>,<stacking_direction>,<icon_size>,<color_data_series>,<low_color>,<middle_color>,<high_color>,<outline_color>,<spacing>,<alignment>
- <icon_shape>
- The icon to use. Specify an ID string identifying one of the images listed at the end of the page.
- <repeat_series_index>
- The zero-based index of the data series used to calculate how many icons to place at this point.
- <scaling_factor>
- The source data series value is scaled to a value from 0 to 1 and multiplied by this value to determine how many markers to place on this point. Partial values are truncated.
- <stacking_direction>
- Stacking direction: either "h" (lowercase) for horizontal or "V" (uppercase) for vertical.
- <icon_size>
- The size of each marker, in pixels. The following values are supported: 12, 16, 24.
- <color_data_series>
- The zero-based index of the data series used to vary the color of the icons.
- <low_color>
- The low color value in the range, as a three- or six-digit HTML hexadecimal color (no # mark). This is associated with the lowest possible value in the available data range.
- <middle_color>
- The middle color value in the range, as a three- or six-digit HTML hexadecimal color (no # mark). This is associated with the middle value in the available data range.
- <high_color>
- The high color value in the range, as a three- or six-digit HTML hexadecimal color (no # mark). This is associated with the highest possible value in the available data range.
- <outline_color>
- The outline color for the icon, as a three- or six-digit HTML hexadecimal color (no # mark).
- <spacing>
- How much space to put between each marker in a stack, in pixels.
- <alignment>
- An optional string describing the icon alignment and offset.
Example
|
![]() chem= |