Динамические значки

Same dynamic icon marker as standalone image.
На справочной странице « Динамические значки инфографики» описаны все доступные типы динамических маркеров.

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

Оглавление

  1. Введение
    1. Отдельно стоящие иконки
    2. Динамические маркеры
  2. Общие функции значков
    1. Текстовые строки
    2. Тени
  3. Контекстные значки

Введение

API диаграмм позволяет создавать разнообразные интересные выноски, булавки или пузырьки, в которых сочетаются текст и изображения. Эти элементы называются динамическими значками . Вы можете либо создать отдельное изображение динамического значка, либо расположить динамический значок поверх диаграммы в качестве типа маркера с помощью параметра chem . На этой странице будет описано, как создавать динамические значки в виде отдельных изображений или маркеров на другой диаграмме. На справочной странице « Динамические значки инфографики» описаны все доступные типы динамических маркеров.

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

Отдельно стоящие иконки

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

Параметр Обязательный или необязательный Описание
chst=< icon_string_constant > Необходимый

Описывает, какой тип значка необходимо создать.

chld=< icon_data > Необходимый

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

  • icon_data — набор значений, разделенных вертикальной чертой, соответствующих значку. В документации на этой странице описано, какие значения требуются для каждого типа значков.
cht НЕ ИСПОЛЬЗУЕТСЯ Автономные динамические диаграммы со значками не используют параметр cht .
chs НЕ ИСПОЛЬЗУЕТСЯ Автономные динамические диаграммы со значками не используют параметр chs .
chd НЕ ИСПОЛЬЗУЕТСЯ Используйте параметр chld для передачи данных в отдельный динамический значок.

Пример

Same dynamic icon marker as standalone image.
https://chart.googleapis.com/chart?chst=d_bubble_icon_text_small&chld=ski|bb|Wheeee!|FFFFFF|000000

Динамические маркеры

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

Пример

Line chart with dynamic icon marker.
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 API, должен быть закодирован в UTF-8, а затем в кодировке URL. Это касается только символов, не безопасных для URL-адресов (символами, безопасными для URL-адресов, в основном являются английские буквы в верхнем и нижнем регистре, а также небольшой набор знаков препинания). Например, значение в кодировке UTF-8 и URL-адреса для буквы «è» — « %C3%A8 », а для китайского символа 駅 — « %E9%A7%85 ». Большинство браузеров позволяют использовать незакодированное значение в строке URL-адреса (например, 駅) и незаметно закодируют его. Однако возможно, что кто-то, просматривающий URL-адрес вашей диаграммы, использует браузер, который этого не делает, поэтому обычно лучше кодировать UTF-8 и URL-кодирование всех символов, отличных от ASCII, в текстовых строках. Обратите внимание, что это относится только к тексту, показанному в пузырьках или булавках, а не к символам &, | или другим символам, которые являются частью синтаксиса URL-адреса.

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

Тени

Вы можете добавить тени ко многим значкам или даже нарисовать тени для некоторых значков без самого значка!

Затененные значки Shadowed pin

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

Вот пример среднего текстового пузыря и булавки с тенями и без них:

Bubble without shadow
chst=d_bubble_icon_text_big
Bubble with shadow
chst=d_bubble_icon_text_big_withshadow
Plain pin with icon
chst=d_map_pin_icon
Plain shadowed pin with icon
chst=d_map_pin_icon_withshadow

Отдельно стоящие тениShadow only

Некоторые типы значков позволяют рисовать их тень самостоятельно. Это может потребоваться, если вы используете на графике несколько перекрывающихся затененных значков, и они расположены настолько близко, что тень от одного падает на другой значок. Например, вот два затененных пузыря: первым нарисован Роберт, затем Алиса:

Shadow overlapping another icon

Обратите внимание, как тень Алисы частично закрывает Роберта. Чтобы это исправить, вы можете сначала нарисовать тень Алисы, затем пузырь Роберта, а затем Алису без тени. Возможно, это не совсем реалистично с точки зрения освещения и теней, но позволяет избежать затемнения одного пузыря тенью другого:

Bubble and shadow drawn independently
chem=
y;s=bubble_text_small_shadow;d=bb,Alice,FF8,000;ds=0;dp=1;py=1 // Alice, no shadow
y;s=bubble_text_small_withshadow;d=bbtr,Robert,FF8,000;ds=0;dp=3.5;py=1 // Robert with shadow
y;s=bubble_text_small;d=bb,Alice,FF8,000;ds=0;dp=1;py=1 // Alice shadow

Для всех маркеров задан один и тот же z-порядок, равный 1 ( py=1 ), поэтому они рисуются в указанном порядке поверх элементов диаграммы (линии диаграммы). Сначала рисуется тень Алисы, затем поверх нее пузырь Роберта и, наконец, пузырь Алисы сверху.

См. документацию по вашему конкретному типу значков, чтобы узнать, можете ли вы нарисовать только их тень.

Контекстные значки

Contextual icon example

Вы можете указать значок, цвет, размер или расположение которого будет меняться в зависимости от точки, которой он назначен. Эти типы значков доступны только в виде динамических маркеров значков (параметр chem ), а не в виде отдельных значков.

Эти значки могут отображаться в серии, отличной от серии, в которой указан их цвет, размер или информация о расположении. Это означает, что значение ds параметра chem указывает серию, в которой будет отображаться значок, но значения для определения размера или цвета значка указаны в параметрах, приведенных ниже. Одним из хороших вариантов использования этого является использование скрытых серий данных для данных значков, но отображение значков на видимой линии или полосе. Вот некоторые примеры:

Значок, отображаемый в исходной серии Значок отображается в серии, не являющейся исходным кодом. Значок с использованием скрытой серии
chem=
y;s=cm_size; ds=0 ;...;
d=maps_pin, 0 ,10,50,10,8F8,000,hb
  • ds=0 — рендеринг серии 0 (красная линия)
  • d=maps_pin, 0 ,... — Данные из серии 0
chem=
y;s=cm_size; ds=1 ;...;
d=maps_pin, 0 ,10,50,10,8F8,000,hb
  • ds=1 — рендеринг серии 1 (синяя линия)
  • d=maps_pin, 0 ,.. . - Данные из серии 0
chd=t1:
10,20,30,5,10,60
10,20,30,70,60,5
chem=
y;s=cm_size;ds=0;dp=all;
d=disk,1,5,20,5,FFFF10,000
  • t1: - Показана первая серия и использованы данные строки. Все последующие серии скрыты.
  • ds=0 — маркеры отображаются в серии 0.
  • d=disk,1 ,... — данные на диске поступают из скрытой серии 1.

Типы маркеров контекста

Тип маркера chem значение Пример
Цветовая вариация s=cm_color
Изменение размера s=cm_size
Изменение цвета и размера s=cm_color_size
Вариант укладки s=cm_repeat
Укладка и изменение цвета s=cm_repeat_color

Строки выравнивания для контекстных значков

Контекстные значки поддерживают дополнительную строку выравнивания, позволяющую указать выравнивание и смещение значка относительно точки данных. Эта строка имеет следующий синтаксис:

<alignment>[+/-<h_anchor_offset>+/-<v_anchor_offset>]
выравнивание
Две буквы, описывающие выравнивание значка по точке. Примеры: tl (вверху слева) и rb (внизу справа). Полный список и описание см. в описании параметра Alignment_string параметра chem .
h_anchor_offset
[ Необязательно ] Горизонтальное смещение опорной точки в пикселях. Значениям , включая ноль, должен предшествовать + или -. Важно: URL-адрес должен быть закодирован как %2B.
v_anchor_offset
[ Необязательно ] Вертикальное смещение опорной точки в пикселях. Значениям , включая ноль, должен предшествовать + или -. Важно: URL-адрес должен быть закодирован как %2B.

Обратите внимание, что вы также можете использовать компонент of параметра chem для указания горизонтального и вертикального смещения. Если вы укажете значения of и h_anchor_offset v_anchor_offset , все смещения будут применены к вашему значку.

Примеры:


hb-0-0
Горизонтальный центр внизу
Никаких смещений

lb-0-0
Внизу слева
Никаких смещений

rb-0-0
Внизу справа
Никаких смещений

ht-0-0
Горизонтальный верх
Никаких смещений

hb-20-0
Горизонтальный центр внизу
-20 по горизонтали
0 вертикальный

hb%2b20-0
Горизонтальный центр внизу
+20 по горизонтали
0 вертикальный

hb-0%2b10
Горизонтальный центр внизу
0 горизонтальный
+10 по вертикали

hb-0-20
Горизонтальный центр внизу
0 горизонтальный
-20 вертикальный

Цветовое изменение ( cm_color )

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

Синтаксис

chem=y;s=cm_color;ds=<series_rendering_index>; ...other_values... ;
  d=<icon_shape>,<color_data_series>,<low_color>,<middle_color>,<high_color>,<icon_size>,<outline_color>,<alignment>
< форма_значка >
Значок, который нужно использовать. Укажите строку идентификатора, идентифицирующую одно из изображений, перечисленных в конце страницы .
< серия_данных_цвета >
Индекс ряда данных, начинающийся с нуля, используемый для изменения цвета значков.
< низкий_цвет >
Младшее значение цвета в диапазоне в виде трех- или шестизначного шестнадцатеричного цвета HTML (без знака #). Это связано с наименьшим возможным значением в доступном диапазоне данных.
< средний_цвет >
Среднее значение цвета в диапазоне в виде трех- или шестизначного шестнадцатеричного цвета HTML (без знака #). Это связано со средним значением в доступном диапазоне данных.
< высокий_цвет >
Максимальное значение цвета в диапазоне в виде трех- или шестизначного шестнадцатеричного цвета HTML (без знака #). Это связано с максимально возможным значением в доступном диапазоне данных.
< размер_значка >
Размер значка в пикселях. Поддерживаются следующие значения: 12, 16, 24.
< цвет_контура >
Цвет контура значка в виде трех- или шестизначного шестнадцатеричного цвета HTML (без знака #).
< выравнивание >
Необязательная строка , описывающая выравнивание и смещение значка.

Пример

  • s=cm_color — значок изменения цвета
  • ds=0 — визуализировать их в серии данных 0.
  • dp=all — Поставить иконку на все точки.
  • значения d:
    • petrol — идентификатор значка
    • 0 - Цвет из серии данных 0
    • 000,0FF,F55 — Определение цветовой шкалы
    • 24 - Размер значка
    • 000 — Черные контуры
    • hv — выравнивание значков по центру с точкой как по горизонтали, так и по вертикали.

chem=y;s=cm_color;
ds=0;
dp=all;
d=petrol,0,000,0FF,F55,24,000,hv

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


Изменение размера ( cm_size )

Вы можете изменить размер маркера контекстной диаграммы в соответствии с выбранным вами рядом данных.

Синтаксис

chem=y;s=cm_size;ds=<series_rendering_index>; ...other_values... ;
  d=<icon_type>,<size_data_series>,<zero_value_size>,<size_multiplier>,<min_size>,<outline_color>,<fill_color>,<alignment>
< тип_значка >
Форма иконы. Выберите одно из следующих значений: maps_pin , disk или square .
< size_data_series >
Индекс ряда данных, начинающийся с нуля, используемый для изменения размера значков.
< размер_нулевого_значения >
Базовый размер значка при минимальном значении данных для серии.
< размерный_множитель >
Коэффициент масштабирования размера. Это значение умножается на разницу между значением данных каждого значка и минимальным значением серии, чтобы вычислить окончательный размер значка. Таким образом, этот множитель не повлияет на значок со значением данных 0.
< минимальный_размер >
Минимальный размер любого значка в пикселях.
< цвет_контура >
Цвет контура значка в виде трех- или шестизначного шестнадцатеричного цвета HTML (без знака #).
< цвет_заливки >
Цвет заливки значка в виде трех- или шестизначного шестнадцатеричного цвета HTML (без знака #).
< выравнивание >
Необязательная строка , описывающая выравнивание и смещение значка.

Примеры

Базовый пример. Значок с нулевым значением отображается с размером нулевого значения, составляющим 30 пикселей. Размеры увеличиваются вместе с данными.

chd=t:0,10,20,30,40,50,60,70
chem=y;s=cm_size;ds=0;dp=all;py=-1;d=maps_pin,0,30,100,10,8F8,000,hb

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

  • chem=y — динамический маркер
  • s=cm_size — отклонение размера
  • ds=1 – отображается на основе серии данных 1 (синяя линия).
  • dp=all — Отрисовывается по всем точкам.
  • d=
    • maps_pin — использовать значок булавки на карте.
    • 0 — масштабировать размер в соответствии с рядом данных 0 (желтая линия).
    • 10 — Размер контакта при значении 0
    • 90 - Множитель размера
    • 10 – Минимальный размер
    • 8F8 — Цвет заливки
    • 000 — Цвет контура
    • hb — центрируйте их горизонтально внизу штифта.


chem=chem=y;s=cm_size;ds=1;dp=all;d=maps_pin,0,10,90,10,8F8,000,hb

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


Изменение цвета и размера ( cm_color_size )

Вы можете изменить цвет и размер маркера контекстной диаграммы в соответствии с выбранным вами рядом данных.

Синтаксис

chem=y;s=cm_color_size;ds=<series_rendering_index>; ...other_values... ;
  d=<icon_type>,<color_data_series>,<low_color>,<middle_color>,<high_color>,<size_data_series>,<zero_value_size>,<size_multiplier>,<min_size>,<outline_color>,<alignment>
< тип_значка >
Форма иконы. Выберите одно из следующих значений: maps_pin , disk или square .
< серия_данных_цвета >
Индекс ряда данных, начинающийся с нуля, используемый для изменения цвета значков.
< низкий_цвет >
Младшее значение цвета в диапазоне в виде трех- или шестизначного шестнадцатеричного цвета HTML (без знака #). Это связано с наименьшим возможным значением в доступном диапазоне данных.
< средний_цвет >
Среднее значение цвета в диапазоне в виде трех- или шестизначного шестнадцатеричного цвета HTML (без знака #). Это связано со средним значением в доступном диапазоне данных.
< высокий_цвет >
Максимальное значение цвета в диапазоне в виде трех- или шестизначного шестнадцатеричного цвета HTML (без знака #). Это связано с максимально возможным значением в доступном диапазоне данных.
< size_data_series >
Индекс ряда данных, начинающийся с нуля, используемый для изменения размера значков.
< размер_нулевого_значения >
Базовый размер значка при минимальном значении данных для серии.
< размерный_множитель >
Коэффициент масштабирования размера. Это значение умножается на разницу между значением данных каждого значка и минимальным значением серии, чтобы вычислить окончательный размер значка. Таким образом, этот множитель не повлияет на значок со значением данных 0.
< минимальный_размер >
Минимальный размер любого значка в пикселях.
< цвет_контура >
Цвет контура значка в виде трех- или шестизначного шестнадцатеричного цвета HTML (без знака #).
< выравнивание >
Необязательная строка , описывающая выравнивание и смещение значка.

Примеры

В этом примере используются две строки. Пины используют данные цвета из серии, в которой они визуализируются, но используют данные о размере из другой серии.
  • chd=s:0akAZtnkmi,nbMPJOKXXS — первая серия используется для построения желтой линии и определения цвета контакта. Вторая серия используется для синей линии и размера булавки.
  • chem=y — отображает динамический значок
  • s=cm_color_size — использовать контекстный значок изменения цвета и размера.
  • ds=1 — визуализировать элементы из серии данных 1, синяя линия.
  • dp=all — Ставим иконку на все точки.
  • d=
    • maps_pin — используйте символ булавки карты.
    • 1 — используйте серию данных 1 для цвета контакта.
    • 000,0FF,F55 — низкие, средние и высокие цвета.
    • 0 — используйте серию данных 0 для размера контакта.
    • 10 — Pin равен 10 пикселям при значении 0.
    • 90 – множитель размера 90.
    • 10 — минимальный размер вывода 10 пикселей.
    • 000 — Черный цвет контура.
    • hb — центрируйте контакты горизонтально вдоль нижнего края к каждой точке данных.


chd=s:0akAZtnkmi,nbMPJOKXXS
chem=y;s=cm_color_size;ds=1;dp=all;d=maps_pin,1,000,0FF,F55,0,10,90,10,000,hb

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


Вариант укладки ( cm_repeat )

Вы можете изменять высоту стопки значков в зависимости от значения данных в определенной точке.

Синтаксис

chem=y;s=cm_repeat;ds=<series_rendering_index>; ...other_values... ;
  d=<icon_shape>,<repeat_series_index>,<scaling_factor>,<stacking_direction>,<icon_size>,<fill_color>,<outline_color>,<spacing>,<alignment>
< форма_значка >
Значок, который нужно использовать. Укажите строку идентификатора, идентифицирующую одно из изображений, перечисленных в конце страницы .
< индекс_повторяющейся_серии >
Отсчитываемый от нуля индекс ряда данных, используемый для расчета количества значков, которые следует разместить в этой точке.
< коэффициент_масштабирования >
Значение ряда исходных данных масштабируется до значения от 0 до 1 и умножается на это значение, чтобы определить, сколько маркеров разместить в этой точке. Частичные значения усекаются.
< направление_укладки >
Направление укладки: либо «h» (строчные буквы) для горизонтального размещения, либо «V» (прописные буквы) для вертикального.
< размер_значка >
Размер каждого маркера в пикселях. Поддерживаются следующие значения: 12, 16, 24.
< цвет_заливки >
Цвет заливки значка в виде трех- или шестизначного шестнадцатеричного цвета HTML (без знака #).
< цвет_контура >
Цвет контура значка в виде трех- или шестизначного шестнадцатеричного цвета HTML (без знака #).
< интервал >
Сколько места следует поместить между каждым маркером в стопке (в пикселях).
< выравнивание >
Необязательная строка , описывающая выравнивание и смещение значка.

Пример

В этом примере используется второй фиктивный ряд данных. Он не отображается на диаграмме, а используется для равномерного распределения всех стопок, начиная с нижней части диаграммы.
  • chd=s1:0akAZtnkmi,AAAAAAAAAA — первая серия используется для построения линии и определения высоты стека. Второй используется для указания базы каждого стека значков со значением 0.
  • chem=y — отображает динамический значок
  • s=cm_repeat — использовать значок контекста варианта стека.
  • ds=1 — визуализировать элементы из серии данных 1.
  • dp=all — Ставим иконку на все точки.
  • d=
    • d=petrol — используйте символ бензина.
    • 0 — использовать серию данных 0 для количества повторений.
    • 9 – используйте коэффициент масштабирования 6.
    • V — сложите вертикально.
    • 16 Сделайте каждый маркер высотой 16 пикселей.
    • F00 — Цвет заливки значка.
    • 000 — Цвет контура значка.
    • 2 — два пикселя между каждым значком в стопке.
    • hb — центрировать стопки внизу


chd=s1:0akAZtnkmi,AAAAAAAAAA
chem=
y;s=cm_repeat;ds=1;dp=all;
d=petrol,0,9,V,16,F00,000,2,hb

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


Укладка и изменение цвета ( cm_repeat_color )

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

Синтаксис

chem=y;s=cm_repeat_color;ds=<series_rendering_index>; ...other_values... ;
  d=<icon_shape>,<repeat_series_index>,<scaling_factor>,<stacking_direction>,<icon_size>,<color_data_series>,<low_color>,<middle_color>,<high_color>,<outline_color>,<spacing>,<alignment>
< форма_значка >
Значок, который нужно использовать. Укажите строку идентификатора, идентифицирующую одно из изображений, перечисленных в конце страницы .
< индекс_повторяющейся_серии >
Отсчитываемый от нуля индекс ряда данных, используемый для расчета количества значков, которые следует разместить в этой точке.
< коэффициент_масштабирования >
Значение ряда исходных данных масштабируется до значения от 0 до 1 и умножается на это значение, чтобы определить, сколько маркеров разместить в этой точке. Частичные значения усекаются.
< направление_укладки >
Направление укладки: либо «h» (строчные буквы) для горизонтального размещения, либо «V» (прописные буквы) для вертикального.
< размер_значка >
Размер каждого маркера в пикселях. Поддерживаются следующие значения: 12, 16, 24.
< серия_данных_цвета >
Индекс ряда данных, начинающийся с нуля, используемый для изменения цвета значков.
< низкий_цвет >
Младшее значение цвета в диапазоне в виде трех- или шестизначного шестнадцатеричного цвета HTML (без знака #). Это связано с наименьшим возможным значением в доступном диапазоне данных.
< средний_цвет >
Среднее значение цвета в диапазоне в виде трех- или шестизначного шестнадцатеричного цвета HTML (без знака #). Это связано со средним значением в доступном диапазоне данных.
< высокий_цвет >
Максимальное значение цвета в диапазоне в виде трех- или шестизначного шестнадцатеричного цвета HTML (без знака #). Это связано с максимально возможным значением в доступном диапазоне данных.
< цвет_контура >
Цвет контура значка в виде трех- или шестизначного шестнадцатеричного цвета HTML (без знака #).
< интервал >
Сколько места следует поместить между каждым маркером в стопке (в пикселях).
< выравнивание >
Необязательная строка , описывающая выравнивание и смещение значка.

Пример

  • chem=y — отображает динамический значок
  • s=cm_repeat_color — используйте значок контекста укладки и изменения цвета.
  • ds=0 — визуализировать элементы в серии данных 0.
  • dp=all — Ставим иконку на все точки.
  • d=
    • petrol — используйте символ бензина.
    • 0 — использовать серию данных 0 для количества повторений.
    • 6 – используйте коэффициент масштабирования 6.
    • V — сложите вертикально.
    • 12 — Сделайте каждый маркер высотой 12 пикселей.
    • 0 — используйте серию 0 для указания цвета.
    • F00,0F0,00F — низкие, средние и высокие значения цвета.
    • 000 — Цвет контура значка.
    • 2 — два пикселя между каждым значком в стопке.
    • hv — центрировать стопки по вертикали и горизонтали в каждой точке данных.

chem=
y;s=cm_repeat_color;ds=0;dp=all;
d=petrol,0,6,V,12,0,F00,0F0,00F,000,2,hv

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

, Same dynamic icon marker as standalone image.
На справочной странице « Динамические значки инфографики» описаны все доступные типы динамических маркеров.

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

Оглавление

  1. Введение
    1. Отдельно стоящие иконки
    2. Динамические маркеры
  2. Общие функции значков
    1. Текстовые строки
    2. Тени
  3. Контекстные значки

Введение

API диаграмм позволяет создавать разнообразные интересные выноски, булавки или пузырьки, в которых сочетаются текст и изображения. Эти элементы называются динамическими значками . Вы можете либо создать отдельное изображение динамического значка, либо расположить динамический значок поверх диаграммы в качестве типа маркера с помощью параметра chem . На этой странице будет описано, как создавать динамические значки в виде отдельных изображений или маркеров на другой диаграмме. На справочной странице « Динамические значки инфографики» описаны все доступные типы динамических маркеров.

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

Отдельно стоящие иконки

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

Параметр Обязательный или необязательный Описание
chst=< icon_string_constant > Необходимый

Описывает, какой тип значка необходимо создать.

chld=< icon_data > Необходимый

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

  • icon_data — набор значений, разделенных вертикальной чертой, соответствующих значку. В документации на этой странице описано, какие значения требуются для каждого типа значков.
cht НЕ ИСПОЛЬЗУЕТСЯ Автономные динамические диаграммы со значками не используют параметр cht .
chs НЕ ИСПОЛЬЗУЕТСЯ Автономные динамические диаграммы со значками не используют параметр chs .
chd НЕ ИСПОЛЬЗУЕТСЯ Используйте параметр chld для передачи данных в отдельный динамический значок.

Пример

Same dynamic icon marker as standalone image.
https://chart.googleapis.com/chart?chst=d_bubble_icon_text_small&chld=ski|bb|Wheeee!|FFFFFF|000000

Динамические маркеры

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

Пример

Line chart with dynamic icon marker.
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 API, должен быть закодирован в UTF-8, а затем в кодировке URL. Это касается только символов, не безопасных для URL-адресов (символами, безопасными для URL-адресов, в основном являются английские буквы в верхнем и нижнем регистре, а также небольшой набор знаков препинания). Например, значение в кодировке UTF-8 и URL-адреса для буквы «è» — « %C3%A8 », а для китайского символа 駅 — « %E9%A7%85 ». Большинство браузеров позволяют использовать незакодированное значение в строке URL-адреса (например, 駅) и незаметно закодируют его. Однако возможно, что кто-то, просматривающий URL-адрес вашей диаграммы, использует браузер, который этого не делает, поэтому обычно лучше кодировать UTF-8 и URL-кодирование всех символов, отличных от ASCII, в текстовых строках. Обратите внимание, что это относится только к тексту, показанному в пузырьках или булавках, а не к символам &, | или другим символам, которые являются частью синтаксиса URL-адреса.

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

Тени

Вы можете добавить тени ко многим значкам или даже нарисовать тени для некоторых значков без самого значка!

Затененные значки Shadowed pin

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

Вот пример среднего текстового пузыря и булавки с тенями и без них:

Bubble without shadow
chst=d_bubble_icon_text_big
Bubble with shadow
chst=d_bubble_icon_text_big_withshadow
Plain pin with icon
chst=d_map_pin_icon
Plain shadowed pin with icon
chst=d_map_pin_icon_withshadow

Отдельно стоящие тениShadow only

Некоторые типы значков позволяют рисовать их тень самостоятельно. Это может потребоваться, если вы используете на графике несколько перекрывающихся затененных значков, и они расположены настолько близко, что тень от одного падает на другой значок. Например, вот два затененных пузыря: первым нарисован Роберт, затем Алиса:

Shadow overlapping another icon

Обратите внимание, как тень Алисы частично закрывает Роберта. Чтобы это исправить, вы можете сначала нарисовать тень Алисы, затем пузырь Роберта, а затем Алису без тени. Возможно, это не совсем реалистично с точки зрения освещения и теней, но позволяет избежать затемнения одного пузыря тенью другого:

Bubble and shadow drawn independently
chem=
y;s=bubble_text_small_shadow;d=bb,Alice,FF8,000;ds=0;dp=1;py=1 // Alice, no shadow
y;s=bubble_text_small_withshadow;d=bbtr,Robert,FF8,000;ds=0;dp=3.5;py=1 // Robert with shadow
y;s=bubble_text_small;d=bb,Alice,FF8,000;ds=0;dp=1;py=1 // Alice shadow

Для всех маркеров задан один и тот же z-порядок, равный 1 ( py=1 ), поэтому они рисуются в указанном порядке поверх элементов диаграммы (линии диаграммы). Сначала рисуется тень Алисы, затем поверх нее пузырь Роберта и, наконец, пузырь Алисы сверху.

См. документацию по вашему конкретному типу значков, чтобы узнать, можете ли вы нарисовать только их тень.

Контекстные значки

Contextual icon example

Вы можете указать значок, цвет, размер или расположение которого будет меняться в зависимости от точки, которой он назначен. Эти типы значков доступны только в виде динамических маркеров значков (параметр chem ), а не в виде отдельных значков.

Эти значки могут отображаться в серии, отличной от серии, в которой указан их цвет, размер или информация о расположении. Это означает, что значение ds параметра chem указывает серию, в которой будет отображаться значок, но значения для определения размера или цвета значка указаны в параметрах, приведенных ниже. Одним из хороших вариантов использования этого является использование скрытых серий данных для данных значков, но отображение значков на видимой линии или полосе. Вот некоторые примеры:

Значок, отображаемый в исходной серии Значок отображается в серии, не являющейся исходным кодом. Значок с использованием скрытой серии
chem=
y;s=cm_size; ds=0 ;...;
d=maps_pin, 0 ,10,50,10,8F8,000,hb
  • ds=0 — рендеринг серии 0 (красная линия)
  • d=maps_pin, 0 ,... — Данные из серии 0
chem=
y;s=cm_size; ds=1 ;...;
d=maps_pin, 0 ,10,50,10,8F8,000,hb
  • ds=1 — рендеринг серии 1 (синяя линия)
  • d=maps_pin, 0 ,.. . - Данные из серии 0
chd=t1:
10,20,30,5,10,60
10,20,30,70,60,5
chem=
y;s=cm_size;ds=0;dp=all;
d=disk,1,5,20,5,FFFF10,000
  • t1: - Показана первая серия и использованы данные строки. Все последующие серии скрыты.
  • ds=0 — маркеры отображаются в серии 0.
  • d=disk,1 ,... — данные на диске поступают из скрытой серии 1.

Типы маркеров контекста

Тип маркера chem значение Пример
Цветовая вариация s=cm_color
Изменение размера s=cm_size
Изменение цвета и размера s=cm_color_size
Вариант укладки s=cm_repeat
Укладка и изменение цвета s=cm_repeat_color

Строки выравнивания для контекстных значков

The contextual icons support an optional alignment string to specify an alignment and offset of the icon to the data point. This string has the following syntax:

<alignment>[+/-<h_anchor_offset>+/-<v_anchor_offset>]
alignment
Two letters describing the alignment of the icon to the point. Examples include tl (top left), and rb (bottom right). See the alignment_string parameter description of the chem parameter for a complete listing and description.
h_anchor_offset
[ Optional ] The horizontal offset of the anchor point, in pixels. Values including zero must be preceded by either + or -. Important: You must url-encode + as %2B.
v_anchor_offset
[ Optional ] The vertical offset of the anchor point, in pixels. Values including zero must be preceded by either + or -. Important: You must url-encode + as %2B.

Note that you can also use the of component of the chem parameter to specify horizontal and vertical offsets. If you specify both the of component and h_anchor_offset v_anchor_offset values, all offsets will be applied to your icon.

Examples:


hb-0-0
Horizontal center bottom
No offsets

lb-0-0
Bottom left
No offsets

rb-0-0
Bottom right
No offsets

ht-0-0
Horizontal top
No offsets

hb-20-0
Horizontal center bottom
-20 horizontal
0 vertical

hb%2b20-0
Horizontal center bottom
+20 horizontal
0 vertical

hb-0%2b10
Horizontal center bottom
0 horizontal
+10 vertical

hb-0-20
Horizontal center bottom
0 horizontal
-20 vertical

Color Variation ( cm_color )

You can vary the color of a contextual chart marker according to the point that it represents. You must specify a color range, and the data value will be scaled to a corresponding color within that range.

Syntax

chem=y;s=cm_color;ds=<series_rendering_index>; ...other_values... ;
  d=<icon_shape>,<color_data_series>,<low_color>,<middle_color>,<high_color>,<icon_size>,<outline_color>,<alignment>
< icon_shape >
The icon to use. Specify an ID string identifying one of the images listed at the end of the page .
< color_data_series >
The zero-based index of the data series used to vary the color of the icons.
< low_color >
The low color value in the range, as a three- or six-digit HTML hexadecimal color (no # mark). This is associated with the lowest possible value in the available data range.
< middle_color >
The middle color value in the range, as a three- or six-digit HTML hexadecimal color (no # mark). This is associated with the middle value in the available data range.
< high_color >
The high color value in the range, as a three- or six-digit HTML hexadecimal color (no # mark). This is associated with the highest possible value in the available data range.
< icon_size >
The size of the icon, in pixels. The following values are supported: 12, 16, 24.
< outline_color >
The outline color for the icon, as a three- or six-digit HTML hexadecimal color (no # mark).
< alignment >
An optional string describing the icon alignment and offset.

Example

  • s=cm_color - color variation icon
  • ds=0 - Render them on data series 0
  • dp=all - Put an icon on all points.
  • d values:
    • petrol - Icon identifier
    • 0 - Color from data series 0
    • 000,0FF,F55 - Definition of the color scale
    • 24 - Size of icon
    • 000 - Black outlines
    • hv - Align icons on center with the point both horizontally and vertically.

chem=y;s=cm_color;
ds=0;
dp=all;
d=petrol,0,000,0FF,F55,24,000,hv

Back to top


Size Variation ( cm_size )

You can vary the size alone of a contextual chart marker, according to the data series of your choice.

Syntax

chem=y;s=cm_size;ds=<series_rendering_index>; ...other_values... ;
  d=<icon_type>,<size_data_series>,<zero_value_size>,<size_multiplier>,<min_size>,<outline_color>,<fill_color>,<alignment>
< icon_type >
The shape of the icon. Choose one of the following values: maps_pin , disk , or square .
< size_data_series >
The zero-based index of the data series used to vary the size of the icons.
< zero_value_size >
The base size of the icon, at the minimum data value for the series.
< size_multiplier >
A size scaling factor. This value is multiplied against the difference between each icon's data value and the minimum series value, to calculate the final icon size. Therefore, an icon at the 0 data value will not be affected by this multiplier.
< min_size >
The minimum size for any icon, in pixels.
< outline_color >
The outline color for the icon, as a three- or six-digit HTML hexadecimal color (no # mark).
< fill_color >
The fill color for the icon, as a three- or six-digit HTML hexadecimal color (no # mark).
< alignment >
An optional string describing the icon alignment and offset.

Examples

A basic example. The icon with zero value is rendered at the zero value size, which is 30 pixels. Sizes increase along with the data.

chd=t:0,10,20,30,40,50,60,70
chem=y;s=cm_size;ds=0;dp=all;py=-1;d=maps_pin,0,30,100,10,8F8,000,hb

In this example, the icons take their size data from the yellow line, but are rendered on the blue line.

  • chem=y - Dynamic marker
  • s=cm_size - Size variance
  • ds=1 - Rendered on data series 1 (the blue line)
  • dp=all - Rendered on all points.
  • d=
    • maps_pin - Use a map pin icon
    • 0 - Scale the size according to data series 0 (the yellow line)
    • 10 - Pin size at value 0
    • 90 - Size multiplier
    • 10 - Minimum size
    • 8F8 - Fill color
    • 000 - Outline color
    • hb - Center them horizontally at the bottom of the pin.


chem=chem=y;s=cm_size;ds=1;dp=all;d=maps_pin,0,10,90,10,8F8,000,hb

Back to top


Color and Size Variation ( cm_color_size )

You can vary both color and size of a contextual chart marker, according to the data series of your choice.

Syntax

chem=y;s=cm_color_size;ds=<series_rendering_index>; ...other_values... ;
  d=<icon_type>,<color_data_series>,<low_color>,<middle_color>,<high_color>,<size_data_series>,<zero_value_size>,<size_multiplier>,<min_size>,<outline_color>,<alignment>
< icon_type >
The shape of the icon. Choose one of the following values: maps_pin , disk , or square .
< color_data_series >
The zero-based index of the data series used to vary the color of the icons.
< low_color >
The low color value in the range, as a three- or six-digit HTML hexadecimal color (no # mark). This is associated with the lowest possible value in the available data range.
< middle_color >
The middle color value in the range, as a three- or six-digit HTML hexadecimal color (no # mark). This is associated with the middle value in the available data range.
< high_color >
The high color value in the range, as a three- or six-digit HTML hexadecimal color (no # mark). This is associated with the highest possible value in the available data range.
< size_data_series >
The zero-based index of the data series used to vary the size of the icons.
< zero_value_size >
The base size of the icon, at the minimum data value for the series.
< size_multiplier >
A size scaling factor. This value is multiplied against the difference between each icon's data value and the minimum series value, to calculate the final icon size. Therefore, an icon at the 0 data value will not be affected by this multiplier.
< min_size >
The minimum size for any icon, in pixels.
< outline_color >
The outline color for the icon, as a three- or six-digit HTML hexadecimal color (no # mark).
< alignment >
An optional string describing the icon alignment and offset.

Examples

This example uses two lines. The pins use color data from the series on which they're rendered, but use size data from the other series.
  • chd=s:0akAZtnkmi,nbMPJOKXXS - First series is used to plot the yellow line and determine the pin color. The second series is used for the blue line, and the pin size.
  • chem=y - Render a dynamic icon
  • s=cm_color_size - Use the color and size variation context icon.
  • ds=1 - Render the items on data series 1, the blue line.
  • dp=all - Put the icon on all points.
  • d=
    • maps_pin - Use the map pin symbol.
    • 1 - Use data series 1 for the pin color.
    • 000,0FF,F55 - The low, medium, and high colors.
    • 0 - Use data series 0 for the pin size.
    • 10 - Pin is 10 pixels at value 0.
    • 90 - A size multiplier of 90.
    • 10 - Minimum pin size of 10 pixels.
    • 000 - Black outline color.
    • hb - Center the pins horizontally along the bottom edge to each data point.


chd=s:0akAZtnkmi,nbMPJOKXXS
chem=y;s=cm_color_size;ds=1;dp=all;d=maps_pin,1,000,0FF,F55,0,10,90,10,000,hb

Back to top


Stacking Variation ( cm_repeat )

You can vary the height of a stack of icons according to the data value at a specific point.

Syntax

chem=y;s=cm_repeat;ds=<series_rendering_index>; ...other_values... ;
  d=<icon_shape>,<repeat_series_index>,<scaling_factor>,<stacking_direction>,<icon_size>,<fill_color>,<outline_color>,<spacing>,<alignment>
< icon_shape >
The icon to use. Specify an ID string identifying one of the images listed at the end of the page .
< repeat_series_index >
The zero-based index of the data series used to calculate how many icons to place at this point.
< scaling_factor >
The source data series value is scaled to a value from 0 to 1 and multiplied by this value to determine how many markers to place on this point. Partial values are truncated.
< stacking_direction >
Stacking direction: either "h" (lowercase) for horizontal or "V" (uppercase) for vertical.
< icon_size >
The size of each marker, in pixels. The following values are supported: 12, 16, 24.
< fill_color >
The fill color for the icon, as a three- or six-digit HTML hexadecimal color (no # mark).
< outline_color >
The outline color for the icon, as a three- or six-digit HTML hexadecimal color (no # mark).
< spacing >
How much space to put between each marker in a stack, in pixels.
< alignment >
An optional string describing the icon alignment and offset.

Example

This example uses a second dummy data series. It is not rendered on the chart, but used as a way to space all the stacks evenly, starting at the bottom of the chart.
  • chd=s1:0akAZtnkmi,AAAAAAAAAA - First series is used to plot the line and determine the stack height. The second is used specify the base of each icon stack, at the 0 value.
  • chem=y - Render a dynamic icon
  • s=cm_repeat - Use the stacking variation context icon.
  • ds=1 - Render the items on data series 1.
  • dp=all - Put the icon on all points.
  • d=
    • d=petrol - Use the petrol symbol.
    • 0 - Use data series 0 for the repeat count.
    • 9 - Use a scaling factor of 6.
    • V - Stack vertically.
    • 16 - Make each marker 16 pixels high.
    • F00 - The icon fill color.
    • 000 - The icon outline color.
    • 2 - Two pixels between each icon in the stack.
    • hb - Center the stacks on the bottom


chd=s1:0akAZtnkmi,AAAAAAAAAA
chem=
y;s=cm_repeat;ds=1;dp=all;
d=petrol,0,9,V,16,F00,000,2,hb

Back to top


Stacking and Color Variation ( cm_repeat_color )

You can vary the both the height and color of an icon stack, according to the data value at a specific point.

Syntax

chem=y;s=cm_repeat_color;ds=<series_rendering_index>; ...other_values... ;
  d=<icon_shape>,<repeat_series_index>,<scaling_factor>,<stacking_direction>,<icon_size>,<color_data_series>,<low_color>,<middle_color>,<high_color>,<outline_color>,<spacing>,<alignment>
< icon_shape >
The icon to use. Specify an ID string identifying one of the images listed at the end of the page .
< repeat_series_index >
The zero-based index of the data series used to calculate how many icons to place at this point.
< scaling_factor >
The source data series value is scaled to a value from 0 to 1 and multiplied by this value to determine how many markers to place on this point. Partial values are truncated.
< stacking_direction >
Stacking direction: either "h" (lowercase) for horizontal or "V" (uppercase) for vertical.
< icon_size >
The size of each marker, in pixels. The following values are supported: 12, 16, 24.
< color_data_series >
The zero-based index of the data series used to vary the color of the icons.
< low_color >
The low color value in the range, as a three- or six-digit HTML hexadecimal color (no # mark). This is associated with the lowest possible value in the available data range.
< middle_color >
The middle color value in the range, as a three- or six-digit HTML hexadecimal color (no # mark). This is associated with the middle value in the available data range.
< high_color >
The high color value in the range, as a three- or six-digit HTML hexadecimal color (no # mark). This is associated with the highest possible value in the available data range.
< outline_color >
The outline color for the icon, as a three- or six-digit HTML hexadecimal color (no # mark).
< spacing >
How much space to put between each marker in a stack, in pixels.
< alignment >
An optional string describing the icon alignment and offset.

Example

  • chem=y - Render a dynamic icon
  • s=cm_repeat_color - Use the stacking and color variation context icon.
  • ds=0 - Render the items on data series 0.
  • dp=all - Put the icon on all points.
  • d=
    • petrol - Use the petrol symbol.
    • 0 - Use data series 0 for the repeat count.
    • 6 - Use a scaling factor of 6.
    • V - Stack vertically.
    • 12 - Make each marker 12 pixels high.
    • 0 - Use series 0 to specify the color.
    • F00,0F0,00F - The low, middle, and high color values.
    • 000 - The icon outline color.
    • 2 - Two pixels between each icon in the stack.
    • hv - Center the stacks vertically and horizontally on each data point.

chem=
y;s=cm_repeat_color;ds=0;dp=all;
d=petrol,0,6,V,12,0,F00,0F0,00F,000,2,hv

Back to top

, Same dynamic icon marker as standalone image.
The Infographics Dynamic Icons reference page describes all the types of dynamic marker types available.

This page describes how to create a variety of callouts, bubbles, pins, and other graphics that can be requested by URL, or added as markers on top of other charts.

Table of Contents

  1. Introduction
    1. Freestanding Icons
    2. Dynamic Markers
  2. Common Icon Features
    1. Text Strings
    2. Shadows
  3. Contextual Icons

Введение

The Chart API enables you to create a variety of interesting callouts, pins, or bubbles that mix text and images. These items are called dynamic icons . You can either create a freestanding dynamic icon image, or you can position a dynamic icon on top of your chart as a marker type using the chem parameter. This page will describe how to create dynamic icons as either freestanding images or as markers on another chart. The Infographics Dynamic Icons reference page describes all the types of dynamic marker types available.

The syntax for creating a dynamic icon depends on whether you want a freestanding icon, or as a dynamic marker in another chart.

Freestanding Icons

You can request a dynamic icon image the same way you request any of the other charts. A freestanding dynamic icon supports a different set of parameters than other charts do:

Parameter Required or Optional Описание
chst=< icon_string_constant > Необходимый

Describes which kind of icon to create.

  • icon_string_constant - A string constant describing the type of icon to create. See the selection of icons below to choose an icon.
chld=< icon_data > Необходимый

The specific data used to describe the icon's size, rotation, text, and other required data.

  • icon_data - A set of pipe-delimited values appropriate to the icon. The documentation on this page describes which values are required by each icon type.
cht NOT USED Freestanding dynamic icon charts don't use the cht parameter.
chs NOT USED Freestanding dynamic icon charts don't use the chs parameter.
chd NOT USED Use the chld parameter to pass data to a freestanding dynamic icon.

Example

Same dynamic icon marker as standalone image.
https://chart.googleapis.com/chart?chst=d_bubble_icon_text_small&chld=ski|bb|Wheeee!|FFFFFF|000000

Dynamic Markers

You can embed a dynamic icon as a marker type on several different types of charts using the chem parameter. See the chem documentation to learn how.

Example

Line chart with dynamic icon marker.
https://chart.googleapis.com/chart?
chs=300x140
cht=lc&chco=FF9900,224499
chd=t:75,74,66,30,10,5,3,1
chls=1|1
chem=y;s=bubble_icon_text_small;d=ski,bb,Wheeee!,FFFFFF;dp=2;ds=0
chm=v,ccccFF,0,::.2,2

Common Icon Features

Most icons can have text strings or shadows associated with them.

Text Strings

All display text passed to the Chart API must be UTF-8 encoded and then URL-encoded. This affects only non-URL-safe characters (URL-safe characters are mostly the English letters az both upper and lower case, plus plus a small set of punctuation). For example, the UTF-8 and URL-encoded value for the letter "è" is " %C3%A8 ", and for the Chinese character 駅 is " %E9%A7%85 ". Most browsers will let you use an unencoded value in the URL string (for example, 駅) and will encode it for you behind the scenes. However, it is possible that someone viewing your chart URL is using a browser that doesn't do this, so it is usually best to UTF-8 and URL-encode all non-ASCII characters in text strings. Note that this is only for the text shown in bubbles or pins, not for the &, |, or other characters that are part of the URL syntax.

When using the chem parameter to specify dynamic icon markers, you must also escape certain characters in your text, as described in the chem documentation.

Shadows

You can add shadows to many icons, or even draw shadows for some icons without the icon itself!

Shadowed Icons Shadowed pin

Many of these icons can be drawn with or without shadows. If shadowing is an option, the icon name will have a version that ends in _withshadow and another version without that ending. You can specify an icon with either ending, depending on whether you want the shadow or not.

Here's an example of a medium text bubble and a pin with and without shadows:

Bubble without shadow
chst=d_bubble_icon_text_big
Bubble with shadow
chst=d_bubble_icon_text_big_withshadow
Plain pin with icon
chst=d_map_pin_icon
Plain shadowed pin with icon
chst=d_map_pin_icon_withshadow

Freestanding ShadowsShadow only

Some icon types allow you to draw their shadow by itself. You might want to do this if you are using several overlapping shadowed icons on a graphic, and they are so close that the shadow from one falls across another icon. For example, here is two shadowed bubbles, Robert drawn first, then Alice:

Shadow overlapping another icon

Note how Alice's shadow partially covers Robert. To fix this, you can draw the Alice shadow first, then the Robert bubble, then Alice without a shadow. Perhaps not totally realistic in terms of lighting and shadows, but it avoids obscuring one bubble with the shadow of another:

Bubble and shadow drawn independently
chem=
y;s=bubble_text_small_shadow;d=bb,Alice,FF8,000;ds=0;dp=1;py=1 // Alice, no shadow
y;s=bubble_text_small_withshadow;d=bbtr,Robert,FF8,000;ds=0;dp=3.5;py=1 // Robert with shadow
y;s=bubble_text_small;d=bb,Alice,FF8,000;ds=0;dp=1;py=1 // Alice shadow

All markers specify the same z-order of 1 ( py=1 ), so they are drawn in the order listed, on top of the chart elements (the chart line). First the Alice shadow is drawn, then the Robert bubble on top of that, and finally the Alice bubble on top.

See the documentation of your specific icon type to learn whether you can draw its shadow alone.

Contextual Icons

Contextual icon example

You can specify an icon that varies its color, size, or stacking according to the point they are assigned to. These icon types are available as dynamic icon markers only ( chem parameter), not as freestanding icons.

These icons can be rendered on a series other than the series that specifies their color, size, or stacking information. This means that the chem parameter's ds value specifies the series on which to render the icon, but the values for determining the size or color of the icon are specified in the parameters given below. One good use of this is to use a hidden data series for icon data, but render the icons on a visible line or bar. Here are some examples:

Icon rendered on source series Icon rendered on non-source series Icon using hidden series
chem=
y;s=cm_size; ds=0 ;...;
d=maps_pin, 0 ,10,50,10,8F8,000,hb
  • ds=0 - Render on series 0 (red line)
  • d=maps_pin, 0 ,... - Data from series 0
chem=
y;s=cm_size; ds=1 ;...;
d=maps_pin, 0 ,10,50,10,8F8,000,hb
  • ds=1 - Render on series 1 (blue line)
  • d=maps_pin, 0 ,.. . - Data from series 0
chd=t1:
10,20,30,5,10,60
10,20,30,70,60,5
chem=
y;s=cm_size;ds=0;dp=all;
d=disk,1,5,20,5,FFFF10,000
  • t1: - First series is shown and used line data. All later series are hidden.
  • ds=0 - Markers rendered on series 0.
  • d=disk,1 ,... - Disk data comes from hidden series 1.

Context Marker Types

Marker Type chem s Value Пример
Color variation s=cm_color
Size variation s=cm_size
Color and size variation s=cm_color_size
Stacking variation s=cm_repeat
Stacking and color variation s=cm_repeat_color

Alignment Strings for Contextual Icons

The contextual icons support an optional alignment string to specify an alignment and offset of the icon to the data point. This string has the following syntax:

<alignment>[+/-<h_anchor_offset>+/-<v_anchor_offset>]
alignment
Two letters describing the alignment of the icon to the point. Examples include tl (top left), and rb (bottom right). See the alignment_string parameter description of the chem parameter for a complete listing and description.
h_anchor_offset
[ Optional ] The horizontal offset of the anchor point, in pixels. Values including zero must be preceded by either + or -. Important: You must url-encode + as %2B.
v_anchor_offset
[ Optional ] The vertical offset of the anchor point, in pixels. Values including zero must be preceded by either + or -. Important: You must url-encode + as %2B.

Note that you can also use the of component of the chem parameter to specify horizontal and vertical offsets. If you specify both the of component and h_anchor_offset v_anchor_offset values, all offsets will be applied to your icon.

Examples:


hb-0-0
Horizontal center bottom
No offsets

lb-0-0
Bottom left
No offsets

rb-0-0
Bottom right
No offsets

ht-0-0
Horizontal top
No offsets

hb-20-0
Horizontal center bottom
-20 horizontal
0 vertical

hb%2b20-0
Horizontal center bottom
+20 horizontal
0 vertical

hb-0%2b10
Horizontal center bottom
0 horizontal
+10 vertical

hb-0-20
Horizontal center bottom
0 horizontal
-20 vertical

Color Variation ( cm_color )

You can vary the color of a contextual chart marker according to the point that it represents. You must specify a color range, and the data value will be scaled to a corresponding color within that range.

Syntax

chem=y;s=cm_color;ds=<series_rendering_index>; ...other_values... ;
  d=<icon_shape>,<color_data_series>,<low_color>,<middle_color>,<high_color>,<icon_size>,<outline_color>,<alignment>
< icon_shape >
The icon to use. Specify an ID string identifying one of the images listed at the end of the page .
< color_data_series >
The zero-based index of the data series used to vary the color of the icons.
< low_color >
The low color value in the range, as a three- or six-digit HTML hexadecimal color (no # mark). This is associated with the lowest possible value in the available data range.
< middle_color >
The middle color value in the range, as a three- or six-digit HTML hexadecimal color (no # mark). This is associated with the middle value in the available data range.
< high_color >
The high color value in the range, as a three- or six-digit HTML hexadecimal color (no # mark). This is associated with the highest possible value in the available data range.
< icon_size >
The size of the icon, in pixels. The following values are supported: 12, 16, 24.
< outline_color >
The outline color for the icon, as a three- or six-digit HTML hexadecimal color (no # mark).
< alignment >
An optional string describing the icon alignment and offset.

Example

  • s=cm_color - color variation icon
  • ds=0 - Render them on data series 0
  • dp=all - Put an icon on all points.
  • d values:
    • petrol - Icon identifier
    • 0 - Color from data series 0
    • 000,0FF,F55 - Definition of the color scale
    • 24 - Size of icon
    • 000 - Black outlines
    • hv - Align icons on center with the point both horizontally and vertically.

chem=y;s=cm_color;
ds=0;
dp=all;
d=petrol,0,000,0FF,F55,24,000,hv

Back to top


Size Variation ( cm_size )

You can vary the size alone of a contextual chart marker, according to the data series of your choice.

Syntax

chem=y;s=cm_size;ds=<series_rendering_index>; ...other_values... ;
  d=<icon_type>,<size_data_series>,<zero_value_size>,<size_multiplier>,<min_size>,<outline_color>,<fill_color>,<alignment>
< icon_type >
The shape of the icon. Choose one of the following values: maps_pin , disk , or square .
< size_data_series >
The zero-based index of the data series used to vary the size of the icons.
< zero_value_size >
The base size of the icon, at the minimum data value for the series.
< size_multiplier >
A size scaling factor. This value is multiplied against the difference between each icon's data value and the minimum series value, to calculate the final icon size. Therefore, an icon at the 0 data value will not be affected by this multiplier.
< min_size >
The minimum size for any icon, in pixels.
< outline_color >
The outline color for the icon, as a three- or six-digit HTML hexadecimal color (no # mark).
< fill_color >
The fill color for the icon, as a three- or six-digit HTML hexadecimal color (no # mark).
< alignment >
An optional string describing the icon alignment and offset.

Examples

A basic example. The icon with zero value is rendered at the zero value size, which is 30 pixels. Sizes increase along with the data.

chd=t:0,10,20,30,40,50,60,70
chem=y;s=cm_size;ds=0;dp=all;py=-1;d=maps_pin,0,30,100,10,8F8,000,hb

In this example, the icons take their size data from the yellow line, but are rendered on the blue line.

  • chem=y - Dynamic marker
  • s=cm_size - Size variance
  • ds=1 - Rendered on data series 1 (the blue line)
  • dp=all - Rendered on all points.
  • d=
    • maps_pin - Use a map pin icon
    • 0 - Scale the size according to data series 0 (the yellow line)
    • 10 - Pin size at value 0
    • 90 - Size multiplier
    • 10 - Minimum size
    • 8F8 - Fill color
    • 000 - Outline color
    • hb - Center them horizontally at the bottom of the pin.


chem=chem=y;s=cm_size;ds=1;dp=all;d=maps_pin,0,10,90,10,8F8,000,hb

Back to top


Color and Size Variation ( cm_color_size )

You can vary both color and size of a contextual chart marker, according to the data series of your choice.

Syntax

chem=y;s=cm_color_size;ds=<series_rendering_index>; ...other_values... ;
  d=<icon_type>,<color_data_series>,<low_color>,<middle_color>,<high_color>,<size_data_series>,<zero_value_size>,<size_multiplier>,<min_size>,<outline_color>,<alignment>
< icon_type >
The shape of the icon. Choose one of the following values: maps_pin , disk , or square .
< color_data_series >
The zero-based index of the data series used to vary the color of the icons.
< low_color >
The low color value in the range, as a three- or six-digit HTML hexadecimal color (no # mark). This is associated with the lowest possible value in the available data range.
< middle_color >
The middle color value in the range, as a three- or six-digit HTML hexadecimal color (no # mark). This is associated with the middle value in the available data range.
< high_color >
The high color value in the range, as a three- or six-digit HTML hexadecimal color (no # mark). This is associated with the highest possible value in the available data range.
< size_data_series >
The zero-based index of the data series used to vary the size of the icons.
< zero_value_size >
The base size of the icon, at the minimum data value for the series.
< size_multiplier >
A size scaling factor. This value is multiplied against the difference between each icon's data value and the minimum series value, to calculate the final icon size. Therefore, an icon at the 0 data value will not be affected by this multiplier.
< min_size >
The minimum size for any icon, in pixels.
< outline_color >
The outline color for the icon, as a three- or six-digit HTML hexadecimal color (no # mark).
< alignment >
An optional string describing the icon alignment and offset.

Examples

This example uses two lines. The pins use color data from the series on which they're rendered, but use size data from the other series.
  • chd=s:0akAZtnkmi,nbMPJOKXXS - First series is used to plot the yellow line and determine the pin color. The second series is used for the blue line, and the pin size.
  • chem=y - Render a dynamic icon
  • s=cm_color_size - Use the color and size variation context icon.
  • ds=1 - Render the items on data series 1, the blue line.
  • dp=all - Put the icon on all points.
  • d=
    • maps_pin - Use the map pin symbol.
    • 1 - Use data series 1 for the pin color.
    • 000,0FF,F55 - The low, medium, and high colors.
    • 0 - Use data series 0 for the pin size.
    • 10 - Pin is 10 pixels at value 0.
    • 90 - A size multiplier of 90.
    • 10 - Minimum pin size of 10 pixels.
    • 000 - Black outline color.
    • hb - Center the pins horizontally along the bottom edge to each data point.


chd=s:0akAZtnkmi,nbMPJOKXXS
chem=y;s=cm_color_size;ds=1;dp=all;d=maps_pin,1,000,0FF,F55,0,10,90,10,000,hb

Back to top


Stacking Variation ( cm_repeat )

You can vary the height of a stack of icons according to the data value at a specific point.

Syntax

chem=y;s=cm_repeat;ds=<series_rendering_index>; ...other_values... ;
  d=<icon_shape>,<repeat_series_index>,<scaling_factor>,<stacking_direction>,<icon_size>,<fill_color>,<outline_color>,<spacing>,<alignment>
< icon_shape >
The icon to use. Specify an ID string identifying one of the images listed at the end of the page .
< repeat_series_index >
The zero-based index of the data series used to calculate how many icons to place at this point.
< scaling_factor >
The source data series value is scaled to a value from 0 to 1 and multiplied by this value to determine how many markers to place on this point. Partial values are truncated.
< stacking_direction >
Stacking direction: either "h" (lowercase) for horizontal or "V" (uppercase) for vertical.
< icon_size >
The size of each marker, in pixels. The following values are supported: 12, 16, 24.
< fill_color >
The fill color for the icon, as a three- or six-digit HTML hexadecimal color (no # mark).
< outline_color >
The outline color for the icon, as a three- or six-digit HTML hexadecimal color (no # mark).
< spacing >
How much space to put between each marker in a stack, in pixels.
< alignment >
An optional string describing the icon alignment and offset.

Example

This example uses a second dummy data series. It is not rendered on the chart, but used as a way to space all the stacks evenly, starting at the bottom of the chart.
  • chd=s1:0akAZtnkmi,AAAAAAAAAA - First series is used to plot the line and determine the stack height. The second is used specify the base of each icon stack, at the 0 value.
  • chem=y - Render a dynamic icon
  • s=cm_repeat - Use the stacking variation context icon.
  • ds=1 - Render the items on data series 1.
  • dp=all - Put the icon on all points.
  • d=
    • d=petrol - Use the petrol symbol.
    • 0 - Use data series 0 for the repeat count.
    • 9 - Use a scaling factor of 6.
    • V - Stack vertically.
    • 16 - Make each marker 16 pixels high.
    • F00 - The icon fill color.
    • 000 - The icon outline color.
    • 2 - Two pixels between each icon in the stack.
    • hb - Center the stacks on the bottom


chd=s1:0akAZtnkmi,AAAAAAAAAA
chem=
y;s=cm_repeat;ds=1;dp=all;
d=petrol,0,9,V,16,F00,000,2,hb

Back to top


Stacking and Color Variation ( cm_repeat_color )

You can vary the both the height and color of an icon stack, according to the data value at a specific point.

Syntax

chem=y;s=cm_repeat_color;ds=<series_rendering_index>; ...other_values... ;
  d=<icon_shape>,<repeat_series_index>,<scaling_factor>,<stacking_direction>,<icon_size>,<color_data_series>,<low_color>,<middle_color>,<high_color>,<outline_color>,<spacing>,<alignment>
< icon_shape >
The icon to use. Specify an ID string identifying one of the images listed at the end of the page .
< repeat_series_index >
The zero-based index of the data series used to calculate how many icons to place at this point.
< scaling_factor >
The source data series value is scaled to a value from 0 to 1 and multiplied by this value to determine how many markers to place on this point. Partial values are truncated.
< stacking_direction >
Stacking direction: either "h" (lowercase) for horizontal or "V" (uppercase) for vertical.
< icon_size >
The size of each marker, in pixels. The following values are supported: 12, 16, 24.
< color_data_series >
The zero-based index of the data series used to vary the color of the icons.
< low_color >
The low color value in the range, as a three- or six-digit HTML hexadecimal color (no # mark). This is associated with the lowest possible value in the available data range.
< middle_color >
The middle color value in the range, as a three- or six-digit HTML hexadecimal color (no # mark). This is associated with the middle value in the available data range.
< high_color >
The high color value in the range, as a three- or six-digit HTML hexadecimal color (no # mark). This is associated with the highest possible value in the available data range.
< outline_color >
The outline color for the icon, as a three- or six-digit HTML hexadecimal color (no # mark).
< spacing >
How much space to put between each marker in a stack, in pixels.
< alignment >
An optional string describing the icon alignment and offset.

Example

  • chem=y - Render a dynamic icon
  • s=cm_repeat_color - Use the stacking and color variation context icon.
  • ds=0 - Render the items on data series 0.
  • dp=all - Put the icon on all points.
  • d=
    • petrol - Use the petrol symbol.
    • 0 - Use data series 0 for the repeat count.
    • 6 - Use a scaling factor of 6.
    • V - Stack vertically.
    • 12 - Make each marker 12 pixels high.
    • 0 - Use series 0 to specify the color.
    • F00,0F0,00F - The low, middle, and high color values.
    • 000 - The icon outline color.
    • 2 - Two pixels between each icon in the stack.
    • hv - Center the stacks vertically and horizontally on each data point.

chem=
y;s=cm_repeat_color;ds=0;dp=all;
d=petrol,0,6,V,12,0,F00,0F0,00F,000,2,hv

Back to top