Точечные диаграммы

В этом документе описывается, как создавать точечные диаграммы с помощью API диаграмм.

Оглавление

Введение

Точечная диаграмма (или точечная диаграмма) представляет собой набор отдельных точек на двухмерной диаграмме. При желании вы можете указать размер отдельных точек. Диаграмма рассеяния может принимать только один ряд данных. Точечные диаграммы хороши для обнаружения группировок или закономерностей во многих точках данных, имеющих две переменные (если у вас только одна переменная, рассмотрите линейную диаграмму).

Необходимо указать как минимум два ряда данных: первый ряд данных указывает координаты X, а второй ряд данных указывает координаты Y.

При желании вы можете указать третью серию, чтобы указать отдельные размеры точек. Без этой серии все точки по умолчанию будут иметь размер 10 пикселей в поперечнике.

Обратите внимание: если вы используете chm для изменения формы или цвета точек данных, точки масштабируются относительно размера, указанного в chm .

Типы диаграмм ( cht )

Укажите точечную диаграмму, используя следующий синтаксис:

Синтаксис

cht=s
chd=<x_values>|<y_values>[|<optional_point_sizes>]
Описание Пример

Маркером по умолчанию для точек данных является синий кружок. Чтобы использовать другой цвет или форму, укажите маркеры формы с помощью параметра chm , как описано в оставшейся части этого раздела.

На этой диаграмме размер точек варьируется за счет включения третьего ряда данных.

Scatter plot with default blue circle data points in different sizes as defined by a third data set
cht=s
chd=t:
12,87,75,41,23,96,68,71,34,9|
98,60,27,34,56,79,58,74,18,76|
84,23,69,81,47,94,60,93,64,54

Если вы хотите имитировать несколько серий с помощью цветов, используйте параметр chco , чтобы указать отдельные цвета точек, и раскрасьте точки соответствующим образом, чтобы имитировать две или более отдельные серии.

Эта диаграмма имеет три ряда данных: первый — значения x, второй — соответствующие значения y, а третий — соответствующий размер точки.

Значение chco определяет цвет точек. Если вы используете разделитель вертикальной черты и цветов меньше, чем точек, каждой n- й точке присваивается соответствующий n- й цвет. Здесь первая, третья, пятая и т. д. точки красные ( FF0000 ), а вторая, четвертая, шестая и т. д. точки — синие ( 0000FF ).

Легенда задается с помощью параметра chdl ; записи легенды присваиваются каждому цвету по очереди.

Scatter plot with two series
chd=t:
12,87,75,41,23,96,68,71,34,9|
98,60,27,34,56,79,58,74,18,76|
84,23,69,81,47,94,60,93,64,54
chco=
FF0000|0000FF
chdl=
Cats|Dogs

Чтобы изменить форму точек, используйте маркеры формы . Маркеры формы на точечных диаграммах ведут себя несколько иначе, чем на других диаграммах, в зависимости от их порядка в параметре chm :

  • Первая позиция после chm . Это форма по умолчанию для всех точек. Единственные значения, которые учитываются в первой записи chm , — это размер, цвет и форма; все остальные значения игнорируются. Например, если вы укажете chm=d,FF0000,0,3,15 , оно будет применено ко всем точкам, хотя вы указали только точку 15.
  • Вторая и последующие позиции после chm — маркеры, указанные во второй и последующих позициях, ведут себя так же, как маркеры для всех других типов диаграмм.

Дополнительные советы по использованию маркеров формы:

  • Если первый маркер chm не является значением данных ( chm=N ) или маркером формы, диаграмма будет использовать встроенную форму по умолчанию, описанную выше.
  • Тип маркера по умолчанию сначала применяется ко всем маркерам; затем все маркеры, применимые к точке, применяются в указанном порядке или указанном z-порядке (если таковой имеется). Поэтому либо перечисляйте свои маркеры в увеличенном размере, чтобы более поздние маскировали более ранние, либо добавьте исходный маркер по умолчанию с размером 0, чтобы очистить все видимые свойства маркера по умолчанию. Если нижний маркер больше или имеет больше углов, чем более высокие маркеры, вы можете увидеть, что он выглядывает из-за других маркеров.
  • Когда вы используете маркеры формы, цвет маркера переопределяет параметр chco для точек; но цвета легенды по-прежнему используют параметр chco .
  • Если вы укажете и маркер формы, и третий набор данных, указанный размер маркера масштабируется в соответствии с диапазоном значений данных. Так, например:
    chd=t:10,10,10|10,20,30|10,50,100
    chm=d,676767,0,4,30
    Здесь масштаб данных составляет 0–100 (масштаб простого текстового формата), а размер маркера указан как 30 (последнее значение в параметре chm ), поэтому значение данных 100 означает 30. -пиксельный маркер, значение размера 50 означает маркер размером 15 пикселей и так далее.
Scatter plot with default blue circle data points in different sizes as defined by a third data set
chm=d,FF0000,0,-1,15
Установите форму по умолчанию на ромб (d).

chm=
d,676767,0,3,10|
s,000000,0,15:,8

По умолчанию — ромб ( d ), индекс маркера 15 и более поздние — это квадраты ( s ), наложенные на ромбы.

chd=t:
12,75,23,68,34,87,41,96,71,9|
98,27,56,58,18,60,34,79,74,76
chco=FF0000|0000FF
chdl=Cats|Dogs
chm=
o,FFFFFF,0,4,0|
o,FF0000,0,0:4,8|
d,0000FF,0,5:9,10

Вы также можете добавить линейный маркер ( chm=D ), чтобы соединить некоторые или все точки точечной диаграммы:

  • Первый маркер chm=N*x* отображает значение по оси X каждой точки данных.
  • Второй и третий маркеры chm=o и chm=s создают круги и квадраты.
  • Четвертый маркер chm=D рисует линию, соединяющую зеленые квадраты. Он определяет цвет, серию (0), точки (3–8), ширину линии (1) и z-порядок линии.

chd=t:
20,80,60,90,40,90,10,20|
90,40,20,60,50,90,50,20
chm=
N*x*,000000,0,,10|
o,FF0000,0,0:2,10,-1|
s,00FF00,0,3:8,10,-1|
D,00000066,0,3:8,1,0

Вот как можно создать линию трассировки через точки, не полагаясь на видимые точки:

  • Укажите точки разброса в ваших данных:
    chd=t:
    12,16,16,24,26,28,41,51,66,68|
    16,14,22,34,22,31,31,48,71,64
  • Добавьте точки, которые будут описывать вашу линию трассировки, в конец ваших данных (последние три точки показаны ниже):
    chd=t:
    12,16,16,24,26,28,41,51,66,68 ,13,45,81 |
    16,14,22,34,22,31,31,48,71,64 ,15,38,84
  • Добавьте маркер маскировки, чтобы скрыть все точки разброса: chm=o,0000FF,0,-1,0 (нулевой размер точки делает все точки невидимыми).
  • Добавьте маркер, чтобы отобразить все точки разброса, кроме точек линии трассировки (последние три точки данных): o,FF0000,0,0:9:,5
  • Наконец, добавьте маркер линии и прикрепите его к последним трем точкам ваших данных: D,000000,1,10:,1,-1 . Это черная линия шириной 1 пиксель, прикрепленная к точкам данных 10 и далее. Мы присвоили ему z-индекс -1, чтобы разместить его за точками разброса.

Точечные диаграммы нельзя использовать в качестве составных диаграмм, поэтому вы не можете добавить дополнительную серию для описания линии.

С помощью этого метода нельзя указать пунктирную линию, но можно указать цвет и толщину линии.

Нарисуйте линию со скрытыми точками:

chd=t:
12,16,16,24,26,28,41,51,66,68,13,45,81| 16,14,22,34,22,31,31,48,71,64,15,38,84
chm=
o,0000FF,0,-1,0|
o,FF0000,0,0:9:,5|
D,000000,1,10:,1,-1

Вернуться наверх

Серия Цвета chco

Укажите цвет точек с помощью параметра chco . Вы можете указать один цвет для всех точек, градиент или цвета для отдельных точек.

Синтаксис

chco=<single_color>
  or
chco=<point_1_color>|...|<point_n_color>
  or
chco=<gradient_start>,...,<gradient_end> (only with third data series)
< цвет >
Цвет точек в шестнадцатеричном формате RRGGBB . Есть несколько разных форматов:
  • Укажите один цвет, который будет применяться ко всем точкам.
  • Чтобы применить отдельные цвета к отдельным точкам, укажите один цвет для каждой точки с разделителем в виде вертикальной черты.
  • Если вы указываете отдельные цвета точек, но цветов меньше, чем точек, каждой n- й точке присваивается соответствующий n- й цвет. Это способ создания диаграммы рассеяния с несколькими сериями.
  • Чтобы применить цветовой градиент, необходимо включить третий ряд данных (который определяет размеры точек). Добавьте два или более цветов, разделенных запятыми, чтобы применить цветовой градиент к точкам в зависимости от размера точки.

Стандартные функции

Остальные функции на этой странице являются стандартными функциями диаграмм.

Название графика chtt , chts [ Все графики ]

Вы можете указать текст заголовка, цвет и размер шрифта для диаграммы.

Синтаксис

chtt=<chart_title>
chts=<color>,<font_size>,<opt_alignment>

chtt — указывает заголовок диаграммы.

< название_диаграммы >
Название для отображения диаграммы. Вы не можете указать, где это будет отображаться, но при желании вы можете указать размер и цвет шрифта. Используйте знак + для обозначения пробелов и символ вертикальной черты ( | ) для обозначения разрывов строк.

chts [ Необязательно ] — цвета и размер шрифта для параметра chtt .

<цвет >
Цвет заголовка в шестнадцатеричном формате RRGGBB . Цвет по умолчанию — черный.
<размер_шрифта >
Размер шрифта заголовка, в пунктах.
<opt_alignment>
[ Необязательно ] Выравнивание заголовка. Выберите одно из следующих строковых значений с учетом регистра: «l» (слева), «c» (по центру), «r» (справа). По умолчанию — «с».

Примеры

Описание Пример

Диаграмма с заголовком, использующая цвет и размер шрифта по умолчанию.

Укажите пробел со знаком плюс ( + ).

Используйте символ вертикальной черты ( | ), чтобы вызвать разрыв строки.

chts здесь не указан.

Vertical bar chart with title
chtt=Site+visitors+by+month|
January+to+July

Диаграмма с синим заголовком размером 20 пунктов, выровненным по правому краю.

Vertical bar chart with blue, 20 pixel, title
chtt=Site+visitors
chts=FF0000,20,r

Вернуться наверх

Текст и стиль легенды диаграммы chdl , chdlp , chdls [ Все диаграммы ]

Легенда — это боковая часть диаграммы, содержащая небольшое текстовое описание каждой серии. Вы можете указать текст, связанный с каждой серией в этой легенде, и указать, где на диаграмме он должен появиться.

См. также chma , чтобы узнать, как установить поля вокруг легенды.

Примечание о строковых значениях: в строках меток разрешены только символы, безопасные для URL. В целях безопасности вам следует закодировать URL-адресом все строки, содержащие символы, не входящие в набор символов 0-9a-zA-Z . Кодировщик URL-адресов можно найти в документации по визуализации Google .

Синтаксис

chdl=<data_series_1_label>|...|<data_series_n_label>
chdlp=<opt_position>|<opt_label_order>
chdls=<color>,<size>

chdl — текст каждой серии для отображения в легенде.

< метка_серии_данных >
Текст для записей легенды. Каждая метка применяется к соответствующей серии в массиве chd . Используйте знак + для пробела. Если вы не укажете этот параметр, на диаграмме не будет легенды. Невозможно указать разрыв строки в метке. Легенда обычно расширяется, чтобы вместить текст легенды, а область диаграммы сжимается, чтобы вместить легенду.

chdlp — [ необязательно ] Положение легенды и порядок записей легенды. Вы можете указать <position> и/или <label_order> . Если вы укажете оба, разделите их чертой. Вы можете добавить «s» к любому значению, если хотите, чтобы пустые записи легенды в chdl были пропущены в легенде. Примеры: chdlp=bv , chdlp=r , chdlp=bv|r , chdlp=bvs|r

< опт_позиция >
[ Необязательно ] Указывает положение легенды на диаграмме. Чтобы указать дополнительное отступы между легендой и областью диаграммы или границей изображения, используйте параметр chma . Выберите одно из следующих значений:
  • b – Легенда внизу диаграммы, записи легенды расположены в горизонтальном ряду.
  • bv — легенда внизу диаграммы, записи легенды в вертикальном столбце.
  • t — Легенда вверху диаграммы, записи легенды расположены в горизонтальном ряду.
  • tv — Легенда вверху диаграммы, записи легенды в вертикальном столбце.
  • r — [ по умолчанию ] Легенда справа от диаграммы, записи легенды в вертикальном столбце.
  • l — Легенда слева от диаграммы, записи легенды в вертикальном столбце.
<opt_label_order>
[ Необязательно ] Порядок отображения меток в легенде. Выберите одно из следующих значений:
  • l [ По умолчанию для вертикальных легенд ] Отображать метки в порядке, указанном в chdl .
  • r — отображать метки в порядке, обратном заданному chdl . Это полезно в составных гистограммах, чтобы показать легенду.
    в том же порядке, в котором появляются полосы.
  • a — [ По умолчанию для горизонтальных легенд ] Автоматическое упорядочение: примерно означает сортировку по длине, сначала самый короткий, измеряемый в блоках по 10 пикселей. Если два элемента имеют одинаковую длину (разделены на блоки по 10 пикселей), первым будет отображаться тот, который указан первым.
  • 0,1,2... — Пользовательский порядок меток. Это список индексов меток, отсчитываемых от нуля, из chdl , разделенных запятыми.

chdls — [ необязательно ] Задает цвет и размер шрифта текста легенды.

< цвет >
Цвет текста легенды в шестнадцатеричном формате RRGGBB .
< размер >
Размер пункта текста легенды.

Примеры

Описание Пример

Два примера легенд. Укажите текст легенды в том же порядке, что и ряд данных.

Red, blue, and green line chart with matching legends

chdl=NASDAQ|FTSE100|DOW
chco=FF0000,00FF00,0000FF

Venn diagram with two smaller circles enclosed by a larger circle


chdl=First|Second|Third
chco=ff0000,00ff00,0000ff

На первой диаграмме показаны записи горизонтальной легенды ( chdlp=t , макет по умолчанию — горизонтальный), а на второй — нижние записи вертикальной легенды ( chdlp=bv ).

Venn diagram with two smaller circles enclosed by a larger circle
chdl=First|Second|Third
chco=ff0000,00ff00,0000ff
chdlp=t


Venn diagram with two smaller circles enclosed by a larger circle
chdl=First|Second|Third
chco=ff0000,00ff00,0000ff
chdlp=bv

В этом примере показано изменение размера шрифта.

Venn diagram with two smaller circles enclosed by a larger circle
chdls=0000CC,14

Вернуться наверх

Поля диаграммы chma [ Все диаграммы ]

Вы можете указать размер полей диаграммы в пикселях. Поля рассчитываются внутрь от указанного размера диаграммы ( chs ); Увеличение размера поля не увеличивает общий размер диаграммы, а, при необходимости, уменьшает ее область.

Поля по умолчанию — это все, что осталось после расчета размера диаграммы. Это значение по умолчанию зависит от типа диаграммы. Указанные вами поля являются минимальным значением; если в области диаграммы остается место для полей, размер поля будет таким же, как и оставшееся; вы не можете сжимать поля меньше, чем требуется для любых легенд и надписей. Вот диаграмма, показывающая основные части диаграммы:

Поле диаграммы, область легенды и область диаграммы

Поля диаграммы включают метки осей и область легенды . Размер области легенды изменяется автоматически, чтобы точно соответствовать тексту, если только вы не укажете большую ширину с помощью chma , и в этом случае размер поля увеличится, сжимая область диаграммы меньше. Вы не можете обрезать легенду, указав слишком маленький размер, но можете заставить ее занимать больше места, чем необходимо.

Совет: Если в гистограмме столбцы имеют фиксированный размер (по умолчанию), ширину области диаграммы нельзя уменьшить. Вы должны указать меньший или изменяемый размер полосы с помощью chbh .

Синтаксис

chma=
  <left_margin>,<right_margin>,<top_margin>,<bottom_margin>|<opt_legend_width>,<opt_legend_height>
< левое_поле >, < правое_поле >, < верхнее_поле >, < нижнее_поле >
Минимальный размер поля вокруг области диаграммы в пикселях. Увеличьте это значение, чтобы включить некоторые отступы, чтобы метки осей не сталкивались с границами диаграммы.
<opt_legend_width> , <opt_legend_height>
[ Необязательно ] Ширина поля вокруг легенды в пикселях. Используйте это, чтобы легенда не сталкивалась с областью диаграммы или краями изображения.

Примеры

Описание Пример

В этом примере диаграмма имеет минимальное поле в 30 пикселей с каждой стороны. Поскольку ширина легенды диаграммы превышает 30 пикселей, поле справа устанавливается на ширину легенды диаграммы и отличается от других полей.

Метки осей находятся за пределами области графика и поэтому рисуются внутри поля.

Line chart with gray background and margins on each side.
chma=30,30,30,30

Чтобы добавить поле вокруг легенды, установите значение для параметров < opt_legend_width > и < opt_legend_height > .

В этом примере ширина легенды составляет примерно 60 пикселей. Если вы установите для < opt_legend_width > значение 80 пикселей, поле расширится до 20 пикселей за пределами легенды.

Line chart with gray background and margins on each side.
chma=20,20,20,30|80,20

Вернуться наверх

Стили и метки осей [ линия, полоса, Google-o-meter, радар, рассеяние ]

Вы можете указать, какие оси отображать на диаграмме, и присвоить им собственные метки и позиции, диапазоны и стили.

Не на всех диаграммах по умолчанию отображаются линии осей. Вы можете точно указать, какие оси должна отображать ваша диаграмма, используя параметр chxt . На линиях оси по умолчанию не отображаются числа; вы должны указать ось в параметре chxt для отображения чисел.

Вы можете выбрать, чтобы на ваших осях отображались числа, отражающие значения данных, или вы можете указать собственные оси. По умолчанию отображаются числовые значения в диапазоне от 0 до 100. Однако вы можете изменить этот диапазон с помощью chxr для отображения любого диапазона, а также стилизовать значения (например, для отображения символов валюты или десятичных знаков) с помощью chxs .

Если вы решите использовать пользовательские значения, например: «Пн, вторник, среда», вы можете использовать параметр chxl . Чтобы разместить эти метки в определенных местах вдоль оси, используйте параметр chxp .

Наконец, вы можете использовать параметры chxs и chxtc для указания цвета, размера, выравнивания и других свойств как пользовательских, так и числовых меток осей.

Примечание о строковых значениях: в строках меток разрешены только символы, безопасные для URL. В целях безопасности вам следует закодировать URL-адресом все строки, содержащие символы, не входящие в набор символов 0-9a-zA-Z . Кодировщик URL-адресов можно найти в документации по визуализации Google .

В этом разделе рассматриваются следующие темы:


Видимые оси chxt

Гистограммы, линейные, лепестковые и точечные диаграммы по умолчанию отображают одну или две оси, но эти линии не содержат значений. Чтобы отобразить значения на линиях осей или изменить отображаемые оси, вы должны использовать параметр chxt . По умолчанию значения осей находятся в диапазоне от 0 до 100, если вы не масштабируете их явно с помощью свойства chxr . Чтобы скрыть все линии осей на линейной диаграмме, укажите :nda после значения типа диаграммы в параметре cht (пример: cht= lc:nda ).

По умолчанию на верхней и нижней осях не отображаются деления значений, а на левой и правой осях они отображаются. Вы можете изменить это поведение, используя параметр chxs .

Синтаксис

chxt=
  <axis_1>
    ,...,
  <axis_n>
< ось >
Ось для отображения на диаграмме. Доступные оси:
  • x — нижняя ось X
  • t – верхняя ось X [ не поддерживается Google-o-Meter ]
  • y — левая ось Y
  • r — правая ось Y [ не поддерживается Google-o-Meter ]

Вы можете указать несколько осей одного типа, например: cht=x,x,y . Это объединит два набора осей X в нижней части диаграммы. Это полезно при добавлении пользовательских меток вдоль оси, отображающей числовые значения (см. пример ниже). Оси рисуются изнутри наружу, поэтому, если у вас есть x,x , первый x относится к самой внутренней копии, следующий x относится к следующей внешней копии и так далее.

Примеры

Описание Пример

В этом примере показана линейная диаграмма с осями X, Y, верхней осью (t) и правой осью (r).

Поскольку метки не указаны, по умолчанию для диаграммы используется диапазон от 0 до 100 для всех осей.

Обратите внимание, что по умолчанию верхняя и нижняя оси не имеют меток рядом с метками.

Line chart with the labels: 0, 20, 40, 60, 80, and 100 on the left and right and labels: 0, 25, 50, 75, and 100 above and below
chxt=x,y,r,t

Вы можете включить несколько наборов меток для каждой оси, включив одно и то же значение несколько раз. В этом примере показаны два набора осей x и два набора осей y. Это не особенно полезно при использовании только меток осей по умолчанию, как показано здесь. Но вы можете указать собственные метки для каждой копии каждой оси, используя параметр chxl .

chxt=x,x,y,y


chxt=x,x,y,y
chxl=
1:|Замерзание|Горячо|
3:|Низкий|Высокий

В этом примере показана горизонтальная гистограмма с осью X, осью Y, верхней осью T и правой осью R.

Метки осей опущены, поэтому API диаграмм отображает диапазон от 0 до 100 для оси X и для оси T.

Диапазон по оси Y и по оси R определяется количеством столбцов. В данном случае имеется пять столбцов, поэтому API диаграмм отображает диапазон от 0 до 4. Первая метка располагается по центру основания первого столбца, вторая метка — по центру основания второго столбца и т. д. .

Line chart with the labels: 0, 20, 40, 60, 80, and 100 on the left and right and labels: 0, 25, 50, 75, and 100 above and below
chxt=x,y,r,t

Вы можете отключить оси по умолчанию в линейной диаграмме, указав :nda после типа диаграммы. Line chart with hidden axes
cht=lc:nda

Вернуться наверх

Диапазон оси chxr

Вы можете указать диапазон значений, которые отображаются на каждой оси независимо, используя параметр chxr. Обратите внимание, что это не меняет масштаб элементов диаграммы, а только масштаб меток осей. Если вы хотите, чтобы номера осей описывали фактические значения данных, установите для <start_val> и <end_val> нижнее и верхнее значения диапазона вашего формата данных соответственно. См. «Масштабирование оси» для получения дополнительной информации.

Вы должны сделать ось видимой с помощью параметра chxt , если хотите указать ее диапазон.

Чтобы указать значения настраиваемой оси, используйте параметр chxl .

Синтаксис

Разделите диапазоны меток нескольких осей с помощью вертикальной черты ( | ).

chxr=
  <axis_index>,<start_val>,<end_val>,<opt_step>
    |...|
  <axis_index>,<start_val>,<end_val>,<opt_step>
<индекс_оси >
К какой оси применять метки. Это индекс, начинающийся с нуля, в массиве осей, заданном chxt . Например, ось r будет равна 1 в chxt=x,r,y .
< начальное_значение >
Число, определяющее нижнее значение для этой оси.
< конечное_значение >
Число, определяющее максимальное значение для этой оси.
<opt_step>
[ Необязательно ] Шаг отсчета между делениями на оси. Не существует значения шага по умолчанию; шаг рассчитан так, чтобы попытаться показать набор хорошо расположенных меток.

Примеры

Описание Пример

В этом примере показаны левая и правая оси Y ( y и r ) и одна ось X ( x ).

Каждая ось имеет определенный диапазон. Поскольку метки или позиции не указаны, значения берутся из заданного диапазона и равномерно распределяются внутри этого диапазона. На линейном графике значения равномерно распределены по оси X.

Направление оси меняется на противоположное для оси r (индекс 2 ), поскольку первое значение ( 1000 ) больше последнего значения ( 0 ).


chxt=x,y,r
chxr=
0,0,500|
1,0,200|
2,1000,0

В этом примере значения указаны для оси X.

Метки осей равномерно расположены вдоль оси. Для параметра <opt_step> указано значение пять ( 5 ).

Bar chart with 200, 300, and 400 on the x-axis chxt=x
chxr=0,10,50,5

Вернуться наверх

Пользовательские метки осей chxl

Вы можете указать собственные метки строковых осей на любой оси, используя параметр chxl . Вы можете указать столько ярлыков, сколько захотите. Если вы отображаете ось (с помощью параметра chxt ) и не указываете пользовательские метки, будут применены стандартные числовые метки. Чтобы указать пользовательский числовой диапазон, используйте вместо этого параметр chxr .

Чтобы установить определенные местоположения на оси для ваших меток, используйте параметр chxp .

Синтаксис

Укажите один набор параметров для каждой оси, которую вы хотите пометить. Разделите несколько наборов меток с помощью вертикальной черты ( | ).

chxl=
  <axis_index>:|<label_1>|...|<label_n>
    |...|
  <axis_index>:|<label_1>|...|<label_n>
<индекс_оси >
К какой оси применять метки. Это индекс массива параметров chxt . Например, если у вас есть chxt=x,x,y,y то индекс 0 будет первой осью X, а 1 — второй осью X.
<метка_1> | ... |< метка_n >
Одна или несколько меток, которые можно разместить вдоль этой оси. Это могут быть строковые или числовые значения; строки не обязательно должны быть в кавычках. label_1 отображается в самой нижней позиции на оси, а label_n отображается в самой высокой позиции. Дополнительные метки располагаются между ними равномерно. Пробелы обозначайте знаком +. Невозможно указать разрыв строки в метке. Отдельные метки с помощью вертикальной черты. Примечание. Не размещайте трубку после последней метки в параметре chxl .

Примеры

Описание Пример

На этой диаграмме показано, как добавлять пользовательские метки к двум осям. Обратите внимание, что значения расположены равномерно и что последнее значение chxl не заканчивается вертикальной чертой.

Line chart with 0 and 100 on the left, A, B, and C on the right, Jan,July, Jan, July, and Jan on the x-axis and 2005, 2006 and 2007 below
chxt=x,y
chxl=
0:|Jan|Feb|March|April|May|
1:|Min|Mid|Max

Этот пример включает метки осей на левой и правой осях Y ( y и r ). Он также включает два набора значений для оси X ( x ). Вы можете рассмотреть возможность добавления делений по оси Y с помощью chxs .

Line chart with 0 and 100 on the left, A, B, and C on the right, Jan,July, Jan, July, and Jan on the x-axis and 2005, 2006 and 2007 below
chxt=x,y,r,x
chxl=
0:|Jan|July|Jan|July|Jan|
1:|0|50|100|
2:|A|B|C|
3:|2005|2006|2007

Этот пример включает метки осей на левой и правой осях Y ( y и r ). Он также включает два набора значений для оси X ( x ). Обратите внимание на пустые метки для нижнего набора осей X, используемые для разделения значений.

В этом примере используются значения по умолчанию для меток оси на левой оси Y.

Bar chart with 0 and 100 on the left, A, B, and C on the right, Jan, July,Jan, July, and Jan on the x-axis and 2005, 2006 and 2007 below
chxt=x,y,r,x
chxl=
0:|Jan|July|Jan|July|Jan|
2:|A|B|C|
3:|2005||2006||2007

Если вы хотите добавить общую метку для описания всей оси (например, чтобы пометить одну ось «стоимость», а другую — «студент»), используйте свойство chxt , чтобы добавить дополнительную ось с каждой стороны, а затем используйте chxl , чтобы добавить по одной настраиваемой метке с каждой стороны и chxp , чтобы разместить ее посередине оси.


chxt=x,x,y,y
chxl=1:|Martinis|3:|Score
chxp=1,50|3,50

Вернуться наверх

Позиции меток осей chxp

Вы можете указать, какие метки осей отображать, используя метки по умолчанию или пользовательские метки, заданные с помощью chxl . Если вы не укажете точные позиции с помощью этого параметра, метки будут располагаться равномерно и со значением шага по умолчанию вдоль осей. Если вы не укажете chxl , метки делений будут значениями по умолчанию (обычно значениями данных или номерами столбцов в гистограммах).

Синтаксис

Разделите несколько наборов позиционирования с помощью вертикальной черты ( | ).

chxp=
  <axis_1_index>,<label_1_position>,...,<label_n_position>
    |...|
  <axis_m_index>,<label_1_position>,...,<label_n_position>
<индекс_оси >
Ось, для которой вы указываете позиции. Это индекс массива параметров chxt . Например, если у вас есть chxt=x,x,y,y то индекс 0 будет первой осью X, 1 — второй осью X и так далее.
< label_1_position >,...,< label_n_position >
Положение метки вдоль оси. Это список числовых значений, разделенных запятыми, где каждое значение задает положение соответствующей метки в массиве chxl : первая запись применяется к первой метке и так далее. Позиция — это значение в диапазоне для этой оси . Обратите внимание, что это всегда будет значение от 0 до 100, если вы не указали собственный диапазон с помощью chxr . У вас должно быть столько позиций, сколько меток для этой оси.

Примеры

Описание Пример

Этот пример включает метки оси R в указанных позициях на диаграмме. Текст метки указывается с помощью параметра chxl .

Метки с указанной позицией 0 размещаются внизу оси Y или R или слева от оси X или T.

Метки с указанной позицией 100 размещаются вверху оси Y или R или справа от оси X или T.

Line chart with min, average, and max on the right, 20, 40, 60, 80, and 100 on the left, and 0, 25, 50, 75, and 100 along the x-axis
chxt=x,y,r
chxl=2:|min|average|max
chxp=2,10,35,75

В этом примере показано отображение значений меток по умолчанию, но только в указанных местах.

chxp=1,10,35,75 — на оси Y должно отображаться только три метки: 10, 35 и 75. Поскольку текст пользовательской метки не указан, отображаются значения этих осей. Обратите внимание, что вам не нужно равномерно распределять метки при использовании chxp . Если бы здесь не был указан chxp , расстояние до значения метки по умолчанию по оси Y составляло бы каждые 20 единиц, как показано на втором графике.

Line chart with 10, 35, and 75 on the left, and 0, 25, 50, 75, and 100 along the x-axis
chxt=x,y
chxp=1,10,35,75

Line chart with default axis positions.
chxt=x,y
chxp не указан

Вернуться наверх

Стили меток осей chxs

Вы можете указать размер, цвет и выравнивание шрифта для меток осей, как для пользовательских меток, так и для значений меток по умолчанию. Все метки на одной оси имеют одинаковый формат. Если у вас есть несколько копий оси, вы можете отформатировать каждую из них по-разному. Вы также можете указать формат строки метки, например, чтобы отображать символы валюты или конечные нули.

По умолчанию на верхней и нижней осях не отображаются деления значений, а на левой и правой осях они отображаются.

Синтаксис

Значения для нескольких осей следует разделять с помощью вертикальной черты ( | ).

chxs=
 <axis_index><opt_format_string>,<opt_label_color>,<opt_font_size>,<opt_alignment>,<opt_axis_or_tick>,<opt_tick_color>,<opt_axis_color>
   |...|
 <axis_index><opt_format_string>,<opt_label_color>,<opt_font_size>,<opt_alignment>,<opt_axis_or_tick>,<opt_tick_color>,<opt_axis_color>
< индекс_оси >
Ось, к которой это относится. Это индекс, отсчитываемый от нуля, в параметре chxt .
< строка_опт_формата >
[ Необязательно ] Это необязательная строка формата, которая, если она используется, следует сразу после номера индекса оси без промежуточной запятой. Он начинается с буквы N, за которой следуют следующие значения (все необязательные): Синтаксис строки форматирования следующий:
N< preceding_text >*< number_type >< decimal_places >zs< x or y >*< following_text >
Вот значение каждого элемента:
  • <preceding_text> — буквенный текст, предшествующий каждому значению.
  • *...* — необязательный блок, заключенный в буквенные звездочки, в котором можно указать детали форматирования чисел. Следующие значения поддерживаются и являются необязательными:
    • <number_type> — числовой формат для числовых значений. Выберите один из следующих вариантов:
      • f - [ По умолчанию ] Формат с плавающей запятой. Рассмотрите также возможность указать точность с помощью значения < decimal_places >.
      • p — процентный формат. Знак % добавляется автоматически. Примечание. При использовании этого формата значения данных от 0,0 до 1,0 преобразуются в значения от 0 до 100 % (например, 0,43 будет отображаться как 43 %).
      • e - Формат научной записи.
      • c< CUR > — форматирует число в указанной валюте с соответствующим маркером валюты. Замените < CUR > трехбуквенным кодом валюты. Пример: cEUR для евро. Список кодов можно найти на веб-сайте ISO , хотя поддерживаются не все символы.
    • <decimal_places> — целое число, определяющее количество отображаемых десятичных знаков. Значение округляется (не усекается) до этой длины. По умолчанию — 2.
    • z — отображать конечные нули. По умолчанию нет .
    • s — Отобразить разделители групп. По умолчанию нет .
    • x или y — отображение данных по координатам x или y, как указано. Значение данных x зависит от типа диаграммы: поэкспериментируйте с диаграммой, чтобы определить, что они означают. По умолчанию — «y» .
  • < following_text > — буквенный текст, следующий за каждым значением.
<opt_label_color>
Цвет, применяемый к тексту оси (но не к линии оси) в шестнадцатеричном формате RRGGBB . Цвет линии оси указывается отдельно с помощью opt_axis_color . По умолчанию серый.
< opt_font_size >
[ Необязательно ] указывает размер шрифта в пикселях. Этот параметр является необязательным.
<opt_alignment>
[ Необязательно ] Выравнивание меток. Для верхней или нижней оси это описывает, как метка выравнивается по отметке над или под ней; для левой или правой осей это описывает, как выравнивается внутри ограничивающей рамки, которая касается оси. Укажите одно из следующих чисел:
  • -1Сверху или снизу : метки располагаются справа от галочек; Влево или вправо : метки в своей области выравниваются по левому краю. По умолчанию для меток оси R.
  • 0сверху или снизу : метки центрируются по меткам; Слева или справа : метки центрируются в своей области. По умолчанию для меток осей X и T.
  • 1 — Сверху или снизу : метки располагаются слева от галочек; Слева или справа : метки выравниваются по правому краю своей области. По умолчанию для меток оси Y.
< opt_axis_or_tick >
[ Необязательно; не поддерживается в Google-o-meter ] Показывать ли отметки и/или линии оси для этой оси. Засечки и оси доступны только для самых внутренних осей (например, они не поддерживаются для внешних из двух осей X). Используйте одно из следующих значений:
  • l (строчная буква «L») — рисовать только линию оси.
  • t — рисовать только деления. Засечки — это маленькие линии рядом с метками осей.
  • lt - [ По умолчанию ] Нарисуйте линию оси и отметки для всех меток.
  • _ - (подчеркивание) Не рисовать ни линию оси, ни деления. If you want to hide an axis line, use this value.
< tick_color >
[ Optional ; not supported in Google-o-meter ] The tick mark color, in RRGGBB hexadecimal format . Default is gray.
< opt_axis_color >
[ Optional ] The color of this axis line, in RRGGBB hexadecimal format . Default is gray.

Примеры

Описание Пример

Font size and color are specified for the second x-axis (Jan, Feb, Mar).

Line chart with min, average, and max on the left, 0, 1, 2, 3, and 4 on the right, 0 to 100 along the x-axis and Jan, Feb, and Mar in blue below

chxt=x,y,r,x
chxr=2,0,4
chxl=3:|Jan|Feb|Mar|
1:|min|average|max
chxp=1,10,35,75
chxs=3,0000DD,13,0,t

Font size, color, and alignment are specified for the right y-axis. Tick marks, but no axis line, are drawn.

Line chart with 0 to 100 along the x-axis, Jan, Feb, Mar below, 0 to 4 on the y-axis, and red tickmarks with blue text for min, average and max on the right.

chxt=x,y,r,x
chxl=3:|Jan|Feb|Mar|
2:|min|average|max
chxp=2,10,35,95
chxs=2,0000DD,13,-1,t,FF0000

This chart includes three data sets, and shows three sets of axis labels, one per series. Each set of labels is formatted using a custom formatting string, as described here:

  • 0N*e,000000|
    • 0 means the first data series
    • N means a formatting string
    • * means the start of the format specifiers
    • e means scientific notation
    • * means the end of the format specifiers
    • 000000 means black text.
  • 1N*cUSD*Mil,FF0000|
    • 1 means the second series
    • N means a formatting string
    • * means the start of the format specifiers
    • c means a currency marker
    • USD specifies the US dollar as the currency marker to use
    • * means the end of the format specifiers
    • Mil is a literal following string
    • FF0000 means red text.
  • 2N*sz2*,0000FF
    • 2 means the third series
    • N means a formatting string
    • * means the start of the format specifiers
    • s means to show grouping specifiers (in US English locale, that is a comma every three zeroes)
    • z2 means show two trailing zeroes
    • 0000FF means blue text.

The axis label ranges are set using the chxr parameter ( axis_index , start , end , step ). If not set, they would have been 0—100 by default.


chd=s:
984sttvuvkQIBLKNCAIi,
DEJPgq0uov17zwopQODS,
AFLPTXaflptx159gsDrn
chxr=
0,0,1000000,250000|
1,0,60|
2,0,5000
chxs=
0N*e,000000|
1N*cUSD*Mil,FF0000|
2N*sz2*,0000FF

Back to top

Axis Tick Mark Styles chxtc

You can specify long tick marks for specific axes. Typically this is used to extend a tick mark across the length of a chart. Use the chxs parameter to change the tick mark color.

Values for multiple axes should be separated using a pipe character ( | ). Values within a series should be separated by a comma.

Syntax

chxtc=
  <axis_index_1>,<tick_length_1>,...,<tick_length_n>
    |...|
  <axis_index_m>,<tick_length_1>,...,<tick_length_n>
< axis_index >
The axis to which this applies. This is a zero-based index into the chxt parameter. Separate values for different axes using a bar delimiter.
< tick_length_1 >,...,< tick_length_n >
Length of the tick marks on that axis, in pixels. If a single value is given, it will apply to all values; if more than one value is given, the axis tick marks will cycle through the list of values for that axis. Positive values are drawn outside the chart area and cropped by the chart borders. The maximum positive value is 25. Negative values are drawn inside the chart area and cropped by the chart area borders.

Примеры

Описание Пример

Example of using chxtc to create long red tick marks. The tick mark length here exceeds the chart area width, but is cropped to fit within the chart.

  • chxt=x,y,r,x - Show a left axis, a right axis, and two bottom axes.
  • chxl =2:|min|average|max|3:|Jan|Feb|Mar - The label text assigned to the 'r' (right side) and outer x-axes.
  • chxp =2,10,35,95 - Custom label positions along the r-axis (index=2) for the three labels.
  • chxs=2,0000dd,13,-1,t,FF0000 - Axis label styles for the r-axis: text color, text size, left-aligned, with red tick marks.
  • chxtc=1,10|2,-180 - Axis tick lengths for the y- and r-axes. The first value specifies 10-pixel-long ticks, outside the axis. The second value specifies 180-pixel-long ticks inside the axis; the negative number means that the tick goes inside the axis, and the tick is cropped to fit inside the chart.

Line chart with 0 to 100 along the x-axis, Jan, Feb, Mar below, 0 to 4 on the y-axis, and long red tickmarks with blue text for min, average and max on the right.

chxt=x,y,r,x
chxl=
2:|min|average|max|
3:|Jan|Feb|Mar
chxp=2,10,35,95
chxs=
2,0000dd,13,-1,t,FF0000
chxtc=1,10|2,-180

This chart demonstrates alternating tick lengths. chxtc specifies two tick length values for the y-axis (5 and 15), and the ticks drawn on the chart alternate between the two values.
chxt=x,y
chxtc=
1,5,15

Back to top

Background Fills chf [ All charts ]

You can specify fill colors and styles for the chart data area and/or the whole chart background. Fill types include solid fills, striped fills, and gradients. You can specify different fills for different areas (for example, the whole chart area, or just the data area). The chart area fill overwrites the background fill. All fills are specified using the chf parameter, and you can mix different fill types (solids, stripes, gradients) in the same chart by separating values with pipe character ( | ). Chart area fills overwrite chart background fills.

Solid Fills chf [ All Charts ]

You can specify a solid fill for the background and/or chart area, or assign a transparency value to the whole chart. You can specify multiple fills using the pipe character ( | ). (Maps: background only).

Syntax

chf=<fill_type>,s,<color>|...
< fill_type >
The part of the chart being filled. Specify one of the following values:
  • bg - Background fill
  • c - Chart area fill. Not supported for map charts.
  • a - Make the whole chart (including backgrounds) transparent. The first six digits of < color > are ignored, and only the last two (the transparency value) are applied to the whole chart and all fills.
  • b <index> - Bar solid fills (bar charts only). Replace < index > with the series index of the bars to fill with a solid color. The effect is similar to specifying chco in a bar chart. See Bar Chart Series Colors for an example.
с
Indicates a solid or transparency fill.
< color >
The fill color, in RRGGBB hexadecimal format . For transparencies, the first six digits are ignored, but must be included anyway.

Примеры

Описание Пример

This example fills the chart background with pale gray ( EFEFEF ).

Red line chart with black area fill.

chf=bg,s,EFEFEF

This example fills the chart background with pale gray ( EFEFEF ) and fills the chart area in black ( 000000 ).

Red line chart with black chart area and pale gray background.

chf=c,s,000000|
bg,s,EFEFEF

This example applies a 50% transparency to the whole chart (80 in hexadecimal is 128, or about 50% transparency). Notice the table cell background showing through the chart.

Scatter plot with points in blue, and a 50% transparency.

chf=a,s,00000080

Back to top

Gradient Fills chf [ Line, Bar, Google-o-meter, Radar, Scatter,Venn ]

You can apply one or more gradient fills to chart areas or backgrounds. Gradient fills are fades from a one color to another color. (Pie, Google-o-meter charts: background only.)

Each gradient fill specifies an angle, and then two or more colors anchored to a specified location. The color varies as it moves from one anchor to another. You must have at least two colors with different < color_centerpoint > values, so that one can fade into the other. Each additional gradient is specified by a < color >,< color_centerpoint > pair.

Syntax

chf=<fill_type>,lg,<angle>,<color_1>,<color_centerpoint_1>
    ,...,
  <color_n>,<color_centerpoint_n>
< fill_type >
The chart area to fill. One of the following:
  • bg - Background fill
  • c - Chart area fill.
  • b <index> - Bar gradient fills (bar charts only). Replace < index > with the series index of the bars to fill with a gradient. See Bar Chart Series Colors for an example.
lg
Specifies a gradient fill.
< angle >
A number specifying the angle of the gradient from 0 (horizontal) to 90 (vertical).
< color >
The color of the fill, in RRGGBB hexadecimal format .
< color_centerpoint >
Specifies the anchor point for the color. The color will start to fade from this point as it approaches another anchor. The value range is from 0.0 (bottom or left edge) to 1.0 (top or right edge), tilted at the angle specified by < angle >.

Примеры

Описание Пример

Chart area has a horizontal linear gradient, specified with an angle of zero degrees ( 0 ).

The colors are peach ( FFE7C6 ), centered on the left side (position 0.0 ) and blue ( 76A4FB ) centered on the right side (position 1.0 ).

The chart background is drawn in gray ( EFEFEF ).

Dark gray line chart with pale gray background and chart area in a white to blue linear gradient from left to right

chf=
c,lg,0,
FFE7C6,0,
(peach)
76A4FB,1
(blue)

Chart area has a diagonal (bottom left to top right) linear gradient, specified with an angle of forty-five degrees ( 45 ).

Peach ( FFE7C6 ) is the first color specified. The bottom left of the chart is pure peach.

Blue ( 6A4FB ) is the second color specified. The top right of the chart is pure blue. Note how we specify an offset of 0.75, to provide a peak of blue that fades away towards the top right corner.

The chart background is drawn in gray ( EFEFEF ).

Dark gray line chart with pale gray background and chart area in a white to blue diagonal linear gradient from bottom left to top right

chf=
c,lg,45,
FFE7C6,0,
(peach)
76A4FB,0.75
(blue)

Chart area has a vertical (top to bottom) linear gradient, specified with an angle of ninety degrees ( 90 ).

Blue ( 76A4FB ) is the first color specified. The top of the chart is pure blue.

Peach ( FFE7C6 ) is the second color specified. The bottom of the chart is pure peach.

The chart background is drawn in gray ( EFEFEF ).

Dark gray line chart with pale gray background and chart area in a white to blue vertical linear gradient from bottom to top

chf=
c,lg,90,
FFE7C6,0,
(peach)
76A4FB,0.5
(blue)

Back to top

Striped fills chf [ Line, Bar, Google-o-meter, Radar, Scatter, Venn ]

You can specify a striped background fill for your chart area, or the whole chart. (Pie, Google-o-meter charts: background only.)

Syntax

chf=
  <fill_type>,ls,<angle>,<color_1>,<width_1>
    ,...,
  <color_n>,<width_n>
< fill_type >
The chart area to fill. One of the following:
  • bg - Background fill
  • c - Chart area fill
  • b <index> - Bar striped fills (bar charts only). Replace < index > with the series index of the bars to fill with stripes. See Bar Chart Series Colors for an example.
ls
Specifies linear stripe fill.
< angle >
The angle of all stripes, relative to the y-axis. Use 0 for vertical stripes or 90 for horizontal stripes.
< color >
The color for this stripe, in RRGGBB hexadecimal format . Repeat < color > and < width > for each additional stripe. You must have at least two stripes. Stripes alternate until the chart is filled.
< width >
The width of this stripe, from 0 to 1 , where 1 is the full width of the chart. Stripes are repeated until the chart is filled. Repeat < color > and < width > for each additional stripe. You must have at least two stripes. Stripes alternate until the chart is filled.

Примеры

Описание Пример
  • bg,ls,0 - Background stripe fill with stripes at a zero degree angle to the y-axis (parallel to the y-axis). The stripes fill the chart background as well as the plot area.
  • CCCCCC,0.15 - The first stripe is dark gray, 15% as wide as the chart.
  • FFFFFF,0.1 - The second stripe is white, 10% as wide as the chart.
Blue line chart with alternating gray and white stripes from left to right
chf=
bg,ls,0,
CCCCCC,0.15,
FFFFFF,0.1
  • c,ls,90 - Chart area with horizontal stripes at an angle of ninety degrees from the y-axis. The stripes fill the plot area, but the chart background is omitted.
  • 999999,0.25 - The first stripe is dark gray, 25% as wide as the chart.
  • CCCCCC,0.25 - Same as the first stripe, but a lighter gray.
  • FFFFFF,0.25 - Same as the first stripe, but white.
Blue line chart with a dark gray, pale gray, white and dark gray stripes from bottom to top
chf=
c,ls,90,
999999,0.25,
CCCCCC,0.25,
FFFFFF,0.25

Back to top

Grid Lines chg [ Line, Bar, Radar, Scatter ]

You can specify solid or dotted grid lines on your chart using the chg parameter.

This parameter doesn't let you specify the thickness or color of the lines. For more ways to make lines across your chart, see shape markers ( chm type h, H, v, or V), range markers ( chm ), and axis tick marks ( chxtc ).

Syntax

chg=
  <x_axis_step_size>,<y_axis_step_size>,<opt_dash_length>,<opt_space_length>,<opt_x_offset>,<opt_y_offset>
< x_axis_step_size >, < y_axis_step_size >
Used to calculate how many x or y grid lines to show on the chart. 100 / step_size = how many grid lines on the chart. So: 20,25 would mean 5 vertical grid lines and 4 horizontal grid lines.
< opt_dash_length >, < opt_space_length >
[ Optional ] Used to define dashed grid lines. The first parameter is the length of each line dash, in pixels. The second parameter is the spacing between dashes, in pixels. Specify 0 for < opt_space_length> for a solid line. Default values are 4,1.
< opt_x_offset >,< opt_y_offset >
[ Optional ] The number of units, according to the chart scale, to offset the x and y grid lines, respectively. Can be positive or negative values. If you specify this value, you must also specify all preceding values. Default values are 0,0.

Примеры

Описание Пример

These examples use only the < x_axis_step_size > and < y_axis_step_size > parameters. The Chart API displays a dashed grid line by default.

Line chart with 5 vertical and two horizontal pale gray dashed grid lines
chg=20,50
Line chart with 5 vertical and two horizontal pale gray dashed grid lines
chg=20,50

This example uses larger spaces to display lighter grid lines ( 1,5 ).

Line chart with 5 vertical and two horizontal faint, pale gray, dashed grid lines
chg=20,50,1,5

To display solid grid lines, specify zero ( 0 ) for the < opt_space_length > parameter.

This chart also specifies an x-axis offset of 10.

Line chart with 5 vertical and two horizontal pale gray, solid grid lines
chg=20,50,1,0,10

This chart demonstrates an x-axis offset of 10, and ay axis offset of 20.

Line chart with 5 vertical and two horizontal pale gray, solid grid lines
chg=20,50,3,3,10,20

Back to top

Dynamic Icon Markers chem [ Bar, Line, Radar, Scatter ]

Create your chart, and specify one or more dynamic icons as chem values. The syntax of chem is as follows. All semicolon-delimited items in purple are optional, and any one can be omitted entirely in your URL. You can include multiple markers by including multiple syntax strings delimited by a | характер. You can read more about dynamic icons on the dynamic icon page .

You can also embed a chart inside another chart as a dynamic icon. See the Embedded Charts subsection below.

chem=
  y;s=<icon_string_constant>;d=<marker_data_string>;ds=<which_series>;dp=<which_points>;py=<opt_z_order>;po=<x,y>;of=<x_offset,y_offset>
|...| y;s=<icon_string_constant>;d=<marker_data_string>;ds=<which_series>;dp=<which_points>;py=<opt_z_order>;po=<x,y>;of=<x_offset,y_offset>
s=< icon_string_constant >
A string marker constant for a dynamic icon, from the dynamic icon page . This constant is almost the same as the chst parameter for freestanding icons. But where the freestanding icon string starts with "d_", you should remove that prefix to get the equivalent dynamic icon marker. Example: freestanding icon: d_bubble_icon_text_small ; equivalent dynamic icon marker: bubble_icon_text_small .
d=< marker_data_string >
The data required for this particular marker type. This holds the same string that would be used in a chld parameter for an equivalent freestanding icon, except that all | delimiters should be replaced by commas (remember to use commas instead of pipe markers for multiline text!). Note that within the data string, you must also escape the following characters with a @ mark: pipe ( | ) , at ( @ ) , equals ( = ), comma ( , ), semicolon ( ; ). Examples: hello@,+world , 5@@10+cents+each .
ds=< which_series >
[ Optional ] The zero-based index of the data series that this marker belongs to. Default value is 0.
dp=< which_points >
[ Optional ] Specifies which data points are used to draw markers. Default value is 0 (first point in the series) . Use one of the following formats:
  • nd - Which data point to draw the marker on, where nd is the zero-based index in the series. If you specify a non-integer value, then the fraction indicates a calculated intermediate point. For example, 3.5 means halfway between point 3 and point 4.
  • range,< start >,< end >,< step > - Draw a marker on every step data point in a range from start to end , inclusive. start and end are index values, and can be floating point numbers to indicate intermediate values. All values are optional; defaults are: start=0, end=last item, step=1. If you skip a value, you must still include any intermediate commas, but you don't have to include empty trailing commas. Examples: dp=range,0,4 draws a marker on elements 0 through 4; dp=range,5,10,2 draws a marker on elements 5, 7, and 9; dp=range,2 draws points on the third point and later; dp=range,3,,1.5 draws markers on every 1.5 data points from the fourth item to the last.
  • all - Draw a marker on every element. This is equivalent to range,0, end_index . Example: dp=all
  • every,n - Draw a marker on every n th marker. Example: dp=every,2 draws a marker on items 0, 2, and 4.
py=< z_order >
[ Optional ] The layer on which to draw the marker, compared to other markers and all other chart elements. This is a floating point number from -1.0 to 1.0, inclusive, where -1.0 is the bottom and 1.0 is the top. Chart elements (lines and bars) are just below zero. If two markers have the same value, they are drawn in the order given by the URL. Default value is 0.0 (just above the chart elements).
po=< x,y >
[ Optional ] An absolute position on the chart at which to draw the marker. x and y are two floating point numbers, where 0.0,0.0 is the bottom left corner and 1.0,1.0 is the top right corner.
of=< x_offset,y_offset >
[ Optional ] A number of pixels to offset the icon from its normal position. x_offset and y_offset are positive or negative integers. It is important to specify this value in an embedded dynamic icon, because the marker will be centered vertically and horizontally over the point, which means that the point probably won't line up with the data marker. A good offset for an upright pin is of=0,22 ; a good offset for a slanted pin is either of=-12,20 or of=12,20 depending on the direction of the slant, but you might have to experiment. Default value is 0,0.

Примеры

Описание Пример
Here are examples of the same dynamic icon created as a free-standing image, and used as a marker in a line chart.

Chart 1: 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

Chart 2: https://chart.googleapis.com/chart?chst=d_bubble_icon_text_small&chld=ski|bb|Wheeee!|FFFFFF|000000

Line chart with dynamic icon marker.
chem=
y;s=bubble_icon_text_small;d=ski,bb,Wheeee!,FFFFFF;dp=2;ds=0


Same dynamic icon marker as standalone image.


chst=
d_bubble_icon_text_small
chld=
ski|bb|Wheeee!|FFFFFF|000000

Note that a dynamic icon marker will be centered on the point horizontally and vertically. So if you use a dynamic icon with a tail, the tail won't be on the chart point; the marker center will be. The first chart centers the mark on data point 3, which actually puts the tail a bit to the right of the mark on the line.

The second chart uses the of value to move the tail of the marker on top of the desired data point. A good offset for a slanted pin is -12,20.


chem=y;
s=map_xpin_letter;
d=pin_sleft,A,FF0000;
dp=3;
ds=1



chem=y;
s=map_xpin_letter;
d=pin_sleft,A,FF0000;
dp=3;
ds=1;
of=-12,0

To include multiple dynamic icons, repeat the syntax string, delimited by a | характер.

This example shows a range, as well as two individual markers.

Note how the vertical pins are offset by of 0,22, and the slanted pin has an offset of 12,20 to make the pin points line up with the series that they describe.


chem=
y;s=map_xpin_letter;d=pin_sright,A,FF0000;dp=4;ds=0;py=1;of=12,20|
y;s=map_pin_icon;d=baby,FF5555;ds=1;dp=6;of=0,22|
y;s=map_pin_icon;d=camping,DEF763;ds=2;dp=range,2,5
This demonstrates a multiline text marker. The marker must be offset after adding the text, because the bubble resizes to fit the text, causing it to be re-centered on the chart. Note how newlines in the text are indicated by commas in the d data string.
chem=y;
s=bubble_texts_big;
d=bbbr,FFC6A5,000000,Outlier,Forgot+to+feed;
ds=0;
dp=13;
of=-120,2

Embedded Charts

You can embed one chart inside another using the dynamic icon syntax.

There are two styles of embedded chart markers: embedded charts in a bubble, and embedded charts with no bubble. Here are examples of both:

Bubble-less chart
Chart with bubble
Chart without bubble

Here are the specifics of the s=< icon_string_constant >;d=< marker_data_string > parameters, both for non-bubble and bubble-embedded charts (parameters covered above aren't described again here):

Syntax

Non-bubble:
  chem=y;s=ec;d=<alignment_string>,<chart_data>;ds=<which_series>;dp=<which_points>;py=<z_order>;po=<x,y>;of=<x_offset,y_offset>

Bubble:
  chem=y;s=ecb;d=<frame_type>,<padding>,<frame_color>,<fill_color>,<chart_data>;ds=<which_series>;dp=<which_points>;py=<z_order>;po=<x,y>;of=<x_offset,y_offset>
alignment_string
[ Non-bubble only ] Which part of the bubble-less embedded chart is pinned to the data point. Choose one of the two-letter string constants in the following diagram: Alignment strings
chart_data
The data for the embedded chart. This is everything after https://chart.googleapis.com/chart? in the URL of the chart to embed. Use the tool below, or follow the rules listed below the tool.
frame_type
[ Bubble only ] One of the dynamic icon frame style constants .
padding
[ Bubble only ] Padding inside the bubble, in pixels.
frame_color
[ Bubble only ] Color of the frame, as a six-digit HTML color string without the # mark. Example: FF00FF .
fill_color
[ Bubble only ] Bubble fill color, as a six-digit HTML color string without the # mark. Example: FF00FF .

Embedded chart data

Use the following conversion tool to help generate your chart string, or else generate the chart string manually following the rules given after the tool.

Rules for manual conversion

1. First replace all the following characters in the parameter and value pairs with the following values, in the order shown:

Replace With this
%7C or %7c
|
@
@@
%
%25
,
@,
|
@|
;
@;
&
%26
"="
%3D

2. Then replace all the & and = values in the parameter1=value1&parameter2=value2... pairs with commas.

Back to top

Shape Markers chm [ Bar, Line, Radar, Scatter ]

You can specify graphical markers for all or individual data points on a chart. If two or more markers occupy the same point, the markers are drawn in the order in which they appear in the chm parameter. You can also create text markers on data points, which is covered in Data Point Markers .

You can combine shape markers with any other chm parameters using a pipe character ( | ) to separate the chm parameters.

Syntax

Specify one set of the following parameters for each series that should be marked. To mark multiple series, create additional parameter sets, delimited by a pipe character. You do not need to mark up all series. If you do not assign markers to a data series, it will not get any markers.

Shape markers behave slightly differently in scatter charts . See that documentation for more information.

chm=
  [@]<marker_type>,<color>,<series_index>,<opt_which_points>,<size>,<opt_z_order>,<opt_offset>
    |...|
  [@]<marker_type>,<color>,<series_index>,<opt_which_points>,<size>,<opt_z_order>,<opt_offset>
@
[ Optional ] If you precede the marker type with the optional @ character, then < opt_which_points > should use the x:y format.
<marker_type>
The type of marker to use. Specify one of the following types:
  • a - Arrow
  • c - Cross
  • C - Rectangle. If a rectangle marker, you must have at least two data series, where series 0 specifies the bottom edge and series 1 specifies the top edge. < size > specifies the width of the rectangle, in pixels.
  • d - Diamond
  • E - Error-bar marker ( ) This marker requires two data series to create, one value for the bottom, and the corresponding point in the second series for the top. It also exposes an extended < size > syntax: line_thickness [: top_and_bottom_width ] where top_and_bottom_width is optional. См. примеры ниже.
  • h - Horizontal line across the chart at a specified height. ( The only valid format for < opt_which_points > parameter is nd . )
  • H - Horizontal line through the specified data marker. This supports an extended < size > syntax that lets you specify an exact line length: line_thickness [: length ] where : length is optional, and defaults to the full chart area width.
  • o - Circle
  • s - Square
  • v - Vertical line from the x-axis to the data point
  • V - Vertical line of adjustable length. This supports an extended < size > value syntax that lets you specify an exact line length: line_thickness [: length ] where : length is optional, and defaults to the full chart area height. The marker is centered on the data point.
  • x - An X
< color >
The color of the markers for this series, in RRGGBB hexadecimal format .
< series_index >
The zero-based index of the data series on which to draw the markers. Ignored for h markers and markers that specify location by x/y position (start with the @ character). You can use hidden data series as a source for markers; see Compound Charts for more information. Grouped vertical bar charts support a special extended syntax to align markers with specific bars.
< opt_which_points >
[ Optional ] Which point(s) to draw markers on. Default is all markers. Use one of the following values:
  • nd - Where to draw the marker. The meaning depends on the marker type:
    • All types except h - Which data point to draw the marker on, where nd is the zero-based index in the series. If you specify a non-integer value, then the fraction indicates a calculated intermediate point. For example, 3.5 means halfway between point 3 and point 4.
    • h - A number from 0.0 to 1.0, where 0.0 is the bottom of the chart, and 1.0 is the top of the chart.
  • -1 - Draw a marker on all data points. You can also leave this parameter empty to draw on all data points.
  • - n - Draw a marker on every n -th data point. Floating point value; if n is less than 1 the chart will calculate additional intermediary points for you. For example, -0.5 will put twice as many markers as data points.
  • start:end:n - Draw a marker on every n -th data point in a range, from start to end index values, inclusive. All parameters are optional (may be absent), so 3::1 would be from the fourth element to the last, step 1, and omitting this parameter entirely would default to first : last :1. All values can be floating point numbers. start and end can be negative, to count backward from the last value. If both start and end are negative, be sure that they are listed in increasing value (for example, -6:-1:1). If the n step value is less than 1, it will calculate additional data points by interpolating the data values given. Default values are first:last:1
  • x : y - Draw a marker at a specific x/y point on the chart. This point does not have to be on a line. Add the @ character before the marker type to use this option. Specify the coordinates as floating point values, where 0:0 is the bottom left corner of the chart and 1:1 is the top right corner of the chart. For example, to add a red, 15-pixel diamond to the center of a chart, use @d,FF0000,0,0.5:0.5,15 .
< size >
The size of the marker, in pixels. Most take a single number value for this parameter; the V, H, and S markers support the syntax < size >[: width ] where the optional second part specifies the line or marker length.
< opt_z_order >
[ Optional ] The layer on which to draw the marker, compared to other markers and all other chart elements. This is a floating point number from -1.0 to 1.0, inclusive, where -1.0 is the bottom and 1.0 is the top. Chart elements (lines and bars) are just lower than zero. If two markers have the same value, they are drawn in the order given by the URL. Default value is 0.0 (just above the chart elements).
< opt_offset >
[ Optional ] Let you specify horizontal and vertical offsets from the specified location. Here is the syntax, which uses a : delimiter: reserved :< horizontal_offset >:< vertical_offset > . If specified, you can include an empty ,, value in the chm parameter string for < opt_z_order >. Examples: o,FF9900,0,4,12,, :10 o,FF9900,0,4,12.0,, :-10:20 o,FF9900,0,4,12,1, ::20
  • reserved - Leave blank.
  • < horizontal_offset > - A positive or negative number specifying the horizontal offset, in pixels. Optional; leave blank if not used.
  • < vertical_offset > - A positive or negative number specifying the vertical offset, in pixels. Optional; leave blank if not used.

Примеры

Описание Пример

Here's an example of several of the shape and line markers.

  • a,990066,0,0.0,9.0 - Purple arrow, first series, first point, size 9.
  • c,FF0000,0,1.0,20.0 - Red cross, first series, second point, size 9.
  • d,80C65A,0,2,20.0 - Green diamond, first series, third point, size 9.
  • H,000000,0,3,1:40 - Black horizontal line, first series, data point 3, one pixel wide, forty pixels long.
  • o,FF9900,0,4.0,12.0 - Orange circle, first series, fifth point, size 12.
  • s,3399CC,0,5.0,11.0 - Blue square, first series, sixth point, size 11.
  • v,BBCCED,0,6.0,1.0 - Vertical line up to point, first series, seventh point, one pixel wide.
  • V,3399CC,0,7.0,1.0 - Vertical line bottom to top of chart, first series, eighth point, one pixel wide.
  • x,FFCC33,0,8.0,20.0 - Yellow 'X', first series, ninth point, size 20.
  • H,FFFF00,0,9,2 - Horizontal yellow line the width of the chart at data point 9.
  • h,FF0000,0,0.5,1 - Red horizontal line at designated height, first series, halfway up the chart, one pixel wide.
Line chart with markers
chm=
a,990066,0,0.0,9.0|
c,FF0000,0,1.0,20|
d,80C65A,0,2.0,20.0|
H,000000,0,3,1:40|
o,FF9900,0,4.0,12.0|
s,3399CC,0,5.0,11.0|
v,BBCCED,0,6,1.0|
V,3399CC,0,7,1.0|
x,FFCC33,0,8,20|
H,FFFF00,0,9,2|
h,FF0000,0,0.5,1

Here's an example using diamonds for one data series, and circles for the other data series.

If two or more markers occupy the same point, the markers are drawn in the order in which they appear in the chm parameter. Here, the circle is the first marker specified with chm , so it is drawn first. The diamond is specified and drawn second, which results in it being drawn on top of the circle.

Line chart, one line has 15 pixel circles on each data point the other line has 10 pixel diamonds. A diamond is drawn on the point that is common to both lines
chm=
o,FF9900,0,-1,15.0|
d,FF0000,1,-1,10.0

Here's a line chart with a marker on every second data point (-2 means every other point).

Line chart with marker on every second point
chd=t:
0,20,20,50,40,70,70,90,85,45,40,50
chm=
o,0066FF,0,-2,6
Here's a line chart with twice as many markers as data points (-0.5 means every half point). Line chart with marker on every second point
chd=t:
0,20,20,50,40,70,70,90,85,45,40,50
chm=
o,0066FF,0,-.5,6
This example shows how to use h and v markers to create grid lines with custom colors and thickness. The z-order value (the last value) is set to -1 so that the grid lines are drawn beneath the data line.
Line chart with marker on every second point
chm=
h,76A4FB,0,0:1:.2,2,-1|
V,76A4FB,0,::2,0.5,-1

This chart adds vertical fill lines to a line chart:

  • v - Vertical lines to the chart
  • FF0000 - Red lines
  • 0 - Series index
  • : :.5 - Range specifier: from start to end, every 0.5 points.
  • 2 - Thickness 2 pixels.
Line chart with marker on every second point
chm=
v,FF0000,0,::.5,2
This example adds an arrow and text marker to the chart using exact coordinates. The first D marker is the trace line under the bars. The second marker is the arrow, and the third marker is the arrow text.
chm=
D,003971,1,0,3|
@a,000000,0,.25:.75,7|
@tExpected,000000,0,.35:.85,10
A horizontal line fixed to a specific data point ( H ) can be useful for showing relative values, or emphasizing the height of a data value on a chart.
chm=H,FF0000,0,18,1

This graph demonstrates the markers that can specify line thickness and length in the < size > parameter.

  • E,000000,0,6,1:20 - Black error bar with 1 pixel wide lines, top and bottom bars 20 pixels long. The bottom is anchored to series 0 point 8, the top is anchored to series 1 point 8.
  • H,990066,1,2,5:50 - Purple, horizontal line five pixels wide, fifty pixels long centered on data point 2.
  • V,3399CC,0,8,3:50 - Blue, vertical line 3 pixels wide, fifty pixels long, centered on data point 8.
title="cht=lc&chd=s:2gounjqLaCf,jqLaCf2goun&chco=008000,00008033&chls=2.0,4.0,1.0&chs=250x150&chm=H,990066,1,2,5:50%7CV,3399CC,0,8,3:50%7CE,000000,0,6,1:20" src="/chart/image/images/chart_95.png" />
chm=
E,000000,0,6,1:20|
H,990066,1,2,5:50|
V,3399CC,0,8,3:50

Back to top

Text and Data Value Markers chm [ Bar, Line, Radar, Scatter ]

You can label specific points on your chart with custom text, or with formatted versions of the data at that point.

You can combine any chm markers using a pipe character ( | ) to separate the chm parameter sets.

A note on string values: Only URL-safe characters are permitted in label strings. To be safe, you should URL-encode any strings containing characters not in the character set 0-9a-zA-Z . You can find a URL encoder in the Google Visualization Documentation .

Syntax

Specify one set of the following parameters for each series that should be marked. To mark multiple series, create additional parameter sets, delimited by a pipe character. You do not need to mark up all series. If you do not assign markers to a data series, it will not get any markers.

chm=
  <marker_type>,<color>,<series_index>,<opt_which_points>,<size>,<opt_z_order>,<opt_placement>
    |...|
  <marker_type>,<color>,<series_index>,<opt_which_points>,<size>,<opt_z_order>,<opt_placement>
<marker_type>
The type of marker to use. You can choose from the following types:
  • f<text> - A flag containing text. Specify the character 'f', followed by custom URL-encoded text. To escape commas in text markers, precede the comma by a \ mark. Example: fHello\,+World!
  • t<text> - A simple text marker. Specify the character 't' followed by custom URL-encoded text. To escape commas in text markers, precede the comma by a \ mark. Example: tHello\,+World!
  • A< text > - An annotation marker. This is similar to a flag marker, but markers will coordinate their position so that they do not overlap. The only valid format for < opt_which_points > is nd , to signify the index of a point in the series.
  • N< formatting_string > - The value of the data at this point, with optional formatting. If you do not use the chds parameter (custom scaling) it gives the exact encoded value; if you do use that parameter with any format type the value will be scaled to the range that you specify. See an example of chds with numeric markers below. With this marker type in a stacked bar chart , if you specify -1 for < series_index > you will get a marker that shows the sum of all values in this stacked bar. The formatting string syntax is as follows:
    < preceding_text >*< number_type >< decimal_places >zs< x or y >*< following_text > .
    All of these elements are optional. Here is the meaning of each element:
    • <preceding_text> - Text to precede each value.
    • *...* - An optional block wrapped in literal asterisks, in which you can specify formatting details for numbers. The following values are supported, and are all optional:
      • <number_type> - The number format, for numeric values. Choose one of the following:
        • f - [ Default ] Floating point format. Consider specifying precision as well with the < decimal_places > value.
        • p - Percentage format. A % sign is appended automatically. Note: When using this format, data values from 0.0 — 1.0 map to 0 — 100% (for example, 0.43 will be shown as 43%).
        • e - Scientific notation format.
        • c< CUR > - Format the number in the currency specified, with the appropriate currency marker. Replace < CUR > with a three-letter currency code. Example: cEUR for Euros. You can find a list of codes on the ISO web site , although not all symbols are supported.
      • <decimal_places> - An integer specifying how many decimal places to show. The value is rounded (not truncated) to this length. Default is 2.
      • z - Display trailing zeros. Default is no .
      • s - Display group separators. Default is no .
      • x or y -Display the data from the x- or y-coordinate, as specified. The meaning of x data varies by chart type: experiment with your chart to determine what it means. Default is 'y' .
    • < following_text > - Text to follow each value.
< color >
The color of the markers for this set, in RRGGBB hexadecimal format .
< series_index >
The zero-based index of the data series on which to draw the markers. If this is a stacked bar chart and the marker type is N (data point values), you can specify -1 to create a summed value marker for each stack of bars. См. пример ниже.
< opt_which_points >
[ Optional ] Which point(s) to draw markers on. Default is all markers. Use one of the following values:
  • nd - Which data point to draw the marker on, where nd is the zero-based index in the series. If you specify a non-integer value, then the fraction indicates a calculated intermediate point. For example, 3.5 means halfway between point 3 and point 4.
  • -1 - Draw a marker on all data points. You can also leave this parameter empty to draw on all data points.
  • -n - Draw a marker on every n -th data point.
  • start : end : n - Draw a marker on every n -th data point in a range, from start to end index values, inclusive. All parameters are optional (may be absent), so 3::1 would be from the fourth element to the last, step 1, and omitting this parameter entirely would default to first : last :1. All values can be floating point numbers. start and end can be negative, to count backward from the last value. If both start and end are negative, be sure that they are listed in increasing value (for example, -6:-1:1). If the n step value is less than 1, it will calculate additional data points by interpolating the data values given. Default values are first:last:1
  • x : y - [ Not supported for N-type markers ] Draw a marker at a specific x/y point on the chart. This point does not have to be on a line. Add the at character ( @ ) before the marker type to use this option. Specify the coordinates as floating point values, where 0:0 is the bottom left corner of the chart, 0.5:0.5 is the center of the chart, and 1:1 is the top right corner of the chart. For example, to add a red, 15-pixel diamond to the center of a chart, use @d,FF0000,0,0.5:0.5,15 .
< size >
The size of the marker in pixels. If this is a scatter chart with a third data series (used to specify point sizes), this value will be scaled by the data range. So if the data range is 0—100 and < size > is 30, a data value of 100 would be 30 pixels wide, a data value of 50 would be 15 pixels wide, and so on.
< opt_z_order >
[ Optional ] The layer on which to draw the marker, compared to other markers and all other chart elements. This is a floating point number from -1.0 to 1.0, inclusive, where -1.0 is the bottom and 1.0 is the top. Chart elements (lines and bars) are just lower than zero. If two markers have the same value, they are drawn in the order given by the URL. Default value is 0.0 (just above the chart elements).
< opt_placement >
[ Optional ] Additional placement details describing where to put this marker, in relation to the data point. You can specify horizontal and/or vertical relative positioning, as well as offsets. Placement syntax is a string with : delimiters as shown here. All elements are optional: < horizontal_and_vertical_justification >:< horizontal_offset >:< vertical_offset > . If specified, you can include an empty ,, value in the chm parameter string for < opt_z_order >. Examples: N,000000,0,1,10,,b and N,000000,0,1,10,,lv and N,000000,0,1,10,,r::10 .
horizontal_and_vertical_justification
The anchor point of the marker. This behaves opposite to justification, so a left anchor actually puts the marker to the right of the data point. You can choose a horizontal and/or vertical justifier from the following list:
  • Horizontal placement : 'l', 'h', or 'r' - Left, center, or right-anchored, horizontally. Default is 'l'.
  • Vertical placement : 'b', 'v', 't' - Bottom, middle, or top-anchored, vertically. Default is 'b'.
  • Bar-relative placement [ Bar charts only] : 's', 'c', 'e' - Base, center, or top of a bar. For stacked charts, this is relative to the section of the bar for each series, not for the whole bar. If the series index given is -1 (stack total) it is in relation to the whole bar. This can be combined with vertical placement values: for example, 'be' or 'vs'. Default value is 'e'.
horizontal_offset
A horizontal offset for this marker, in pixels. Default is 0.
vertical_offset
A vertical offset for this marker, in pixels. Non-bar chart default: 15; bar chart chart default: 2 .

Описание Пример

Here's an example of value labels on a bar chart.

The first chart ( N*p0* ) specifies a data value marker, with values shown as a percentage, rounded to zero decimal places, in black, on all values, in 11-point text. Note that the data values are all between 0.0 and 1.0, which, in percentage format, are moved up two decimal places.

The second chart ( N*cEUR1* ) shows the same values formatted as Euro values, one decimal place, in black, on all values, in 11-point text.

Bar chart with percentage labels above each bar
chm=
N*p0*,000000,0,-1,11
chd=t:
0.4356,0.3562,0.4834,0.575,0.673,0.6091


Bar chart with Euro labels above each bar


chm=
N*cEUR1*,000000,0,-1,11

You can use the chds parameter to scale the numeric value displayed. You can use chds for all data formats, including simple and extended encoding. This will not affect the bar size or the axis labels, but only the data marker value.

This example shows a chart with simple-encoded values of 46, 39, 29, 30, 43, 41. Simple encoding range is 0—61 . The chds parameter defines a custom marker scale of 0—1, so marker values are scaled to this range, but the bar heights are not affected (if this were text format data , the bars would be scaled as well).


chd=s:underp
chm=N,000000,0,-1,11
chds=0,1

Here's an example of a chart with a text label at the minimum point and a flag label at the maximum point.

Line chart with 10pt blue text label, and flag with 15pt red text, drawn on the data points of a dashed green line.
chm=
tMin,0000FF,0,1,10|
fMax,FF0000,0,3,15

This example shows a stacked chart with values for individual series, plus the series total. To show the stacked series values, we must use the 'c' positioning option; if we did not, the top bar value would overlap the sum value at the top of each bar.
chm=
N,FF0000,-1,,12|
N,000000,0,,12,,c|
N,000000,1,,12,,c|
N,ffffff,2,,12,,c
Some more demonstrations of how vertical and horizontal placement work. This example demonstrates various combinations of anchor values for bar charts (which use s, c,and e for vertical placement). Note how a right anchor moves a marker left, and a top anchor moves a marker down, and vice-versa. The red dots show the base, center, and top of each bar. The number is the data value, fixed using different anchor values for each bar.
chm=
N,000000,0,0,10,,rs
N,000000,0,1,10,,ls
N,000000,0,2,10,,c
N,000000,0,3,10,,e
N,000000,0,4,10,,e::15
N,000000,0,5,10,,e::-12
Annotation markers automatically adjust the label position so that they don't overlap. The first chm value is for the line fill, the following values are all annotation markers.
chm=B,C5D4B5BB,0,0,0
AA,666666,0,3,15
AB,666666,0,5,15
AC,666666,0,24,15
AD,666666,0,25,15
AE,666666,0,26,15
AF,666666,0,51,15
AG,666666,0,60,15
AH,666666,0,73,15
AI,666666,0,80,15
AJ,666666,0,99,15
Another annotation marker example demonstrating city altitudes in Switzerland.

Back to top

Range Markers chm [ Bar, Candlestick, Line, Radar, Scatter ]

You can color horizontal or vertical bands of background fill to highlight specific areas of a chart.

You can combine any chm markers using a pipe character ( | ) to separate the chm parameter sets.

Syntax

Specify one set of the following parameters for each band to draw. To draw multiple bands, create additional parameter sets, delimited by a pipe character. Ranges are drawn in the order specified, so the last range drawn will be drawn on top of previous ranges.

chm=
  <direction>,<color>,0,<start_point>,<end_point>
    |...|
  <direction>,<color>,0,<start_point>,<end_point>
<direction>
Specifies horizontal or vertical shading. Use r for a horizontal range and R for a vertical range.
< color >
The range color as an RRGGBB format hexadecimal number .
0
Reserved — must be zero.
< start_point >
The start position of the range.
  • For horizontal range markers, this is a position on the y-axis, where 0.00 is the bottom of the chart, and 1.00 is the top of the chart.
  • For vertical range markers, this is a position on the x-axis, where 0.00 is the left of the chart, and 1.00 is the right of the chart.
< end_point >
The end position of the range.
  • For horizontal range markers, this is a position on the y-axis, where 0.00 is the bottom of the chart, and 1.00 is the top of the chart.
  • For vertical range markers, this is a position on the x-axis, where 0.00 is the left of the chart, and 1.00 is the right of the chart.

Примеры

Описание Пример

Range markers can be a thin line or a band of color.

  • r,E5ECF9,0,0.75,0.25 - Range marker, pale blue, (reserved), 0.5 of the height of the chart.
  • r,000000,0,0.1,0.11 - Range marker, black, (reserved), starts at 0.1 of the way up the y-axis and ends at 0.11 of the way up the y-axis (a thin black line).
Line chart with a pale blue horizontal band stretching from 25 percent to 75 percent of the way up the y-axis and a thin horizontal line ten percent of the way up the y-axis
chm=
r,E5ECF9,0,0.75,0.25|
r,000000,0,0.1,0.11

This example shows the vertical range markers. The first marker is a red line ( FF0000 ), and the second is a pale blue band ( A0BAE9 ).

Line chart with a pale blue vertical band stretching from 25 percent to 75 percent of the way along the x-axis and a thin vertical line ten percent of the way along the x-axis
chm=
R,FF0000,0,0.1,0.11|
R,A0BAE9,0,0.75,0.25

Markers are drawn in the order specified. In this example, you can see that the vertical red marker was drawn before the pale blue horizontal marker.

Line chart with a blue vertical band and paler blue horizontal band stretching from 25 percent to 75 percent of the way along the x and y-axis respectively. Thin vertical red line and thin horizontal black line ten percent of the way along the x and y-axis respectively
chm=
R,FF0000,0,0.1,0.11|
R,A0BAE9,0,0.75,0.25|
r,E5ECF9,0,0.75,0.25|
r,000000,0,0.1,0.11

Here's an example of a line chart that uses range markers to draw faint horizontal lines across the chart at the zero line, midpoint line, and top.

Sparkline with single yellow line and three equally spaced horizontal lines
chm=
r,000000,0,0.499,0.501|
r,000000,0,0.998,1.0|
r,000000,0,0.0,0.002

Back to top

Line Markers chm=D [ Bar, Candlestick, Line, Radar, Scatter ]

You can add a line that traces data in your chart. Most often, this is used in compound charts .

To add multiple lines (or combine this with any other chm markers), separate the chm parameter sets using a pipe ( | ) delimiter. You cannot make a dashed line marker with this parameter.

Syntax

chm=
  D,<color>,<series_index>,<which_points>,<width>,<opt_z_order>
Д
Indicates that this is a line marker.
< color >
The color of the line, in RRGGBB hexadecimal format .
< series_index >
The index of the data series used to draw the line. The data series index is 0 for the first data series, 1 for the second data series, and so on.
< which_points >
Which points in a series to use to draw the line. Use one of the following values:
  • 0 - Use all the points in the series.
  • start:end - Use a specific range of points in the series, from the start to end , inclusive (zero-based index). You can also use floating point values to specify intermediate points, or leave start or end blank to indicate the first or last data point, respectively. start and end can be negative, as a reverse index from the last value. If both start and end are negative, be sure to write them in increasing value (for example, -6:-1).
< size >
The width of the line in pixels.
< opt_z_order >
[ Optional ] The layer on which to draw the marker, compared to other markers and all other chart elements. This is a floating point number from -1.0 to 1.0, inclusive, where -1.0 is the bottom and 1.0 is the top. Chart elements (lines and bars) are just lower than zero. If two markers have the same value, they are drawn in the order given by the URL. Default value is 0.0 (just above the chart elements).

Примеры

Описание Пример

This is an example of drawing a marker line on a bar chart. The z-order is set to 1 , so the line is drawn on top of the bars.

This example uses the same data for both the bars and the data line.
Bar chart with line marker
chm=D,0033FF,0,0,5,1
chd=s:1XQbnf4

This is the same bar chart, but with an additional data series just for the line. This is an example of a compound chart. Compound charts are drawn by adding additional data series to the chd parameter, plus a value to chd telling the chart to "ignore" the additional data series.

See Compound Charts for more information.

Bar chart with line marker
chm=D,0033FF,1,0,5,1
chd=s1:1XQbnf4,43ksfg6

Back to top

Data Functions chfd [ All chd charts ]

You can specify a custom function to run over chart data using muParser function syntax . The data used in the function can come from one of two sources:

  • A data series from chd - The data is pulled from the specified series in chd .
  • A range of values declared in the chfd parameter itself - You declare a start, stop, and step value for an arbitrary data range.

It is important to note that in all cases you must assign the output to an existing series in chd ; that series will be overwritten by the function output. The chart is rendered only after all functions have been processes, so if you assign multiple functions to output to the same data series, the functions will be run in the order given, but only the output of the final function will be plotted on the chart. Note that you can chain functions, so that one function can take as input a series that was output by a previous function.

To assign colors or chm markers to a function line, assign the colors or markers to the function's series index. Note that markers are placed according to the data after it has been manipulated by the function.

Syntax

chfd=
  <output_series_index>,<function_data>,<function_string>
    |...|
  <output_series_index>,<function_data>,<function_string>
< output_series_index >
Zero-based index of a data series in chd to which the function output will be written. Any existing data will be completely overwritten by the function output. If a series is not being used as input for a function, best practice is to assign a single dummy value to that series.
< function_data >
The variables and data to plot. The data can be from a range that you define, or from one of the chd data series. You can specify multiple variables for each function, using a ; (semicolon) delimiter for multiple variables. Note that if you define multiple variables for a single function, and these variables have a different number of points, the function will stop when it reaches the first endpoint. For example, if a function defines both x=1—5 step 1 and y=1—10 step 1, the function will end when it reaches the fifth point.
< variable_name >,< input_series_index >
OR
< variable_name >,< start >,< end >,< step >
  • variable_name - An arbitrary string name for the variable. Use this in the function defined by function_string .
  • input_series_index - The index of a chd data series to use as input data.
  • start - The numeric start value of a range.
  • end - The numeric end value of a range.
  • step - The numeric step value from start to end . Can be positive or negative, but cannot be zero.
Examples: x,0,100,1 declares a variable named x with values 0, 1, 2, ... 100. x,0,100,1;r,0,3.1,.1 declares the same x variable plus a variable named r with values 0, 0.1, 0.2, ..., 3.0, 3.1. x,0 declares a variable named x that uses the data from the first chd series. These variables will be used by function_string . They will not be plotted on the graph unless you specify them in function_string . The smaller the step, the smoother your graph.
< function_string >
Your function, written in the muParser syntax . The function is applied to the variables and data specified in variable_data . You can only reference the variables declared in this local function set, not in another piped set of chfd parameters. Summary muParser functions are not supported (min, max sum, avg). IMPORTANT: Remember to use %2B instead of + in your functions!

Примеры

Описание Пример

A simple sine wave. Some things to notice:

  • chd=t:-1 - We use a dummy variable for the chart data, because our data is declared in the chfd parameter.
  • chco=FF0000 - Red is specified for the first series. Even though we don't use the data from chd , the corresponding color for that series will be used for that plotted function.
  • chfd=0,x,0,11,0.1,sin(x)*50%2B50 - We declare one variable, called x, with values 0—11, incremented by 0.1. It is assigned to the first series, which means it will get the first series color (FF0000). The function applied to x is sin(x) * 50 + 50. Note how we must encode the + in that function.

Sine wave specified by chfd
cht=lc
chd=t:-1
chco=FF0000
chfd=
0,x,0,11,0.1,sin(x)*50%2B50
chxt=x,y
This line uses data from the chd parameter.
chd=t:5,10
chfd=0,x,0,x*4

A mix of function and non-function lines.

Notice how the colors are specified by the series color parameter chco .

Notice the placement of markers on the function output; the data points are calculated from start , end , and step , so if your range is 0—11 step 0.1, point 0 is 0, point 1 is 0.1 and so on, until point 110, which has a value of 11.

One series using chfd, one using chd for its data.
chd=t:
-1
15,45
chco=
FF0000,000000
chfd=
0,x,0,11,0.1,sin(x)*50%2B50
chm=
c,00A5C6,0,110,10
a,00A5C6,0,60,10

To define a function in two dimensions, use an lxy chart, assign two dummy series, and assign a function to each.

  • 0,x,0,10,0.1,sin(x)*50%2B50 - Series 0 (the x-axis values) has a variable named x, with values from 0—10, step 0.1, and a function sin(x)*50 + 50
  • 0,y,0,10,0.1,sin(y)*50%2B50 - Series 0 (the y-axis values) has a variable named y, with values from 0—10, step 0.1, and a function sin(x)*50 + 50
A circle
cht=lxy
chd=t:-1|-1
chfd=
0,x,0,10,0.1,sin(x)*50%2B50|
1,y,0,10,0.1,cos(y)*50%2B50

The chfd parameter can really let you express your creativity.

Try clicking these images to open and play with them in the chart playground; you'll get hooked!



Back to top