This document explains how to add labels to your chart.
Specify a chart title with
chtt=<chart title>
Specify a legend with
chdl=<data set 1 label>|<data set n label>
| Parameter | Description | Example |
|---|---|---|
|
Specify labels in the same order as your data sets. The legend will use the same colors as your chart uses. To specify colors for your chart, see Chart colors. In these examples, the first data set is drawn in red, the second in green and the third in blue. |
chdl=NASDAQ|FTSE100|DOW |
|
||
chdl and chdlp |
Use To draw the legend in a horizontal row, use one of the following options:
To draw the legend in a vertical column, use one of the following options:
|
|
For a pie chart, specify labels with
chl=
<label 1 value>|
...
<label n value>
You can specify a missing value by using two consecutive pipe characters (||).
| Parameter | Description | Example |
|---|---|---|
chl |
Labels for a three-dimensional pie chart. |
|
When specifying the size of your chart with
Generally, a two-dimensional pie chart needs to be approximately twice as wide as it is high, and a three dimensional pie chart needs to be approximately two and a half times wider than it is high, to display labels properly. In this example, the labels are only partially displayed, because the chart is not wide enough. |
|
|
This chart needs a width of 280 pixels to display the labels in full. |
|
For a Google-o-meter, specify the text that appears above the arrow with
chl=<label>
| Parameter | Description | Example |
|---|---|---|
chl |
Here's an example of a Google-o-meter with a label. |
|
Axis styles and labels are available for line charts, bar charts, radar charts, and scatter plots.
This section covers the following topics:
Specify multiple axes with
chxt=
<axis 1>,
...
<axis n>
Available axes are:
x = bottom x-axist = top x-axisy = left y-axisr = right y-axisWhen using other axis options, the axis is specified by its index in the chxt parameter. The first axis specified in the chxt parameter has an index of 0, the second
has an index of 1, and so on. You can specify multiple lines for
each axis by including x, t, y, or r multiple times.
| Parameter | Description | Example |
|---|---|---|
|
This example shows a line chart with an x-axis, a y-axis, an upper t-axis, and a right r-axis. Axis labels are omitted, so the Chart API displays a range of 0 to 100 for all axes. |
|
This example shows a vertical bar chart with an x-axis, a y-axis, an upper t-axis, and a right r-axis. Axis labels are omitted, so the Chart API displays a range of 0 to 100 for the y-axis and for the r-axis. The range for the x-axis and for the t-axis is determined by the number of bars. In this case, there are five bars, so the Chart API displays a range of 0 to 4. The first label is centered underneath the first bar, the second label is centered underneath the second bar, and so on. |
|
|
This example shows a horizontal bar chart with an x-axis, a y-axis, an upper t-axis, and a right r-axis. Axis labels are omitted, so the Chart API displays a range of 0 to 100 for the x-axis and for the t-axis. The range for the y-axis and for the r-axis is determined by the number of bars. In this case, there are five bars, so the Chart API displays a range of 0 to 4. The first label is centered underneath the first bar, the second label is centered underneath the second bar, and so on. |
|
For the sake of brevity, only vertical bar charts are discussed
in the remainder of this document.
The behavior of the x-axis and the t-axis in a horizontal bar chart is the same as the behavior
of the y-axis and the r-axis in a vertical bar chart.
The behavior of the y-axis and the r-axis in a horizontal bar chart is the same
as the behavior of the x-axis and the t-axis in a vertical bar chart.
Specify labels with
chxl=
<axis index>:|<label 1>|<label n>|
...
<axis index>:|<label 1>|<label n>
The index parameter specifies the index of the axis to
which the labels apply. Separate each label by using a pipe character (|).
The first label specified is placed at the start of the axis, and the last label specified is placed at the end of the axis. Other labels are uniformly spaced between the first label and the last label.
| Parameter | Description | Example |
|---|---|---|
|
This example includes axis labels on the left and right y-axes ( x-axis labels on a line chart are centered beneath the x-axis. |
|
This example includes axis labels on the left and right y-axes ( This example uses default values for the axis labels on the left y-axis. On a bar chart, the first x-axis label specified is centered under the first bar, the second x-axis label specified is centered under the second bar, and so on. |
|
Specify label positions with
chxp=
<axis index>,<label 1 position>,<label n
position>|
...
<axis index>,<label 1 position>,<label n position>
Use floating point numbers for position values. By default, the label position is used
for label text. To set label text, use the chxl parameter.
| Parameter | Description | Example |
|---|---|---|
|
This example includes r-axis labels at specified positions on the
chart. The label text is specified using the Labels with a specified position of Labels with a specified position of |
|
This example includes y-axis labels at specified positions on the chart. No label text is specified for these labels. Therefore, the label position is displayed as the text for each label. |
|
Specify a range for axis labels with
chxr=
<axis index>,<start of range>,<end of range>,<interval>|
...
<axis index>,<start of range>,<end of range>,<interval>
The <interval> parameter is optional. Separate multiple axis label ranges by using the pipe character
(|).
| Parameter | Description | Example |
|---|---|---|
|
This example shows left and right y-axes ( Each axis has a defined range. Because no labels or positions are specified, values are taken from the given range, and are evenly spaced within that range. In the line chart, values are evenly spread along the x-axis. In the bar chart, a value is centered beneath each bar. Axis direction is reversed for the r-axis (index |
|
In these examples, values are specified for the x-axis. Axis labels are evenly spaced along the axis. A value of five
( |
|
Specify font size, color, and alignment for axis labels with
chxs=
<axis index>,<axis color>,<font size>,<alignment>,<drawing control>,<tick mark color>|
...
<axis index>,<axis color>,<font size>,<alignment>,<drawing control>,<tick mark color>|
where:
<axis index> is the axis index as specified in chxt.<axis color> is an RRGGBB
format hexadecimal number.<font size> specifies
the font size in pixels. This parameter is optional.<alignment> is one of the following:
-1 to make the axis labels left-aligned.0 to make the axis labels centered.1 to make the axis labels right-aligned.<drawing control> is one of the following:
l to draw axis lines only.t to draw tick marks only.lt to draw axis lines and tick marks.<tick mark color> is an RRGGBB
format hexadecimal number. This parameter is optional.Values for multiple axes should be separated using a pipe character (|).
| Parameter | Description | Example |
|---|---|---|
|
Font size and color are specified for the second x-axis (Jan, Feb, Mar). |
|
Font size, color, and alignment are specified for the right y-axis. Tick marks, but no axis line, are drawn. |
|
|
|
Use
Positive values are drawn outside the chart area. The maximum positive value is 25. Negative values are drawn inside the chart area. Use this feature to draw gridlines on a chart. |
|
Add labels to data points on line charts, bar charts, radar charts, and scatter plots with:
chm=
<label type><label contents>,<color>,<data set index>,<data point>,<size>,<priority>|
...
<label type><label contents>,<color>,<data set index>,<data point>,<size>,<priority>|
Where:
<label type> is one of the following characters:f creates a flag.t creates plain text.N creates a number.<label contents> is the text of the label, for f and t labels. Number labels are discussed below.<color> is an RRGGBB format hexadecimal number.<data set index> is the index of the data set on which to
draw the label. The data set index is 0 for the first data set, 1 for the second data set, and so on. <data point> is a floating point value that specifies
the data point on which the label will be drawn.
Use one of the following formats:
0 to draw a label on the first data point, 1 to draw a label on the second data point, and so on.-1 to draw a label on each data point.-n to draw a label on every n-th data point.x:y:n to draw a label on every n-th data point in a
range, where x is the first data point in the range, and y is the last data point in the range.<size> is the size of the text in points.<priority> is one of the following:
-1 specifies that the label is drawn before
all other parts of the chart. The label will be hidden if another
chart element is drawn in the same place.0 specifies that the label is drawn after bars or lines, but
before other labels. This is the default.1 specifies that the label is drawn after all other parts of
the chart. If more than one label has this value, the first one specified in
the chm parameter will be drawn first, the second one
specified in the chm parameter will be
drawn second, and so on. Multiple labels are separated using the pipe character (|).
| Parameter | Description | Example |
|---|---|---|
|
Here's an example of a chart with a text label at the minimum point, and a flag label at the maximum point. |
|
Here's an example of a number label on a bar chart. The number for a number label comes directly from the data series
that you provide. The
Where:
|
|