Grouped Tooltips Text Configuration

Overview

AnyChart Stock Tooltips is very powerful way to show information in tooltips, they can show HTML formatted text, series icons, and can be displayed in various ways. This article cover almost all text related options of Grouped Tooltips.

to top

Text Configuration and Formatting

Formatting string is very important for it defines what information is shown in the tooltips for this or that series or indicator. AnyChart Stock provides very versatile way to configure this string, including HTML, special tokens and formatting options.

Basic XML Syntax to define what data should be shown in tooltip looks like that:

XML/JSON Syntax
Plain code
02   <grouped_tooltip>
03     <labels>
04       <format><![CDATA[Value: {%Value}]]></format>
05     </labels>
06   </grouped_tooltip>
01{
03    labels: {
04      format: "Value: {%Value}"
05    }
06  }
07}

to top

Tokens

To show values of series and technical indicator points you can use special tokens that are replaced by actual values when chart is shown. There are a lot of tokens in AnyChart Stock and you can use them with static text or alone.

Illustration below shows the tooltip and highlights sample tokens used to create it:

to top

Tokens Properties

Tokens Properties return certain value associated with the token. Some of the tokens are values themselves, but most of them - not. Table below list all tokens and their properties:

Token Group Available Properties
{%SeriesName}
{%SeriesIcon}
There are no properties for these tokens.
{%Value}
{%ValueChange}
{%PercentValueChange}
{%Open}
{%High}
{%Low}
{%Close}
{%Volume}
{%ChangeIcon} *
{%CustomField} **
"%ChangeColor" ***
First
Last
FirstVisible
LastVisible
Min
Max
MinVisible
MaxVisible
Current
{%Date} First
Last
FirstVisible
LastVisible
Current

* - {%ChangeIcon} is replaced by the icon that illustrates whether value grows or decreases, but as any numeric tokens it should know what point should be analyzed. Use of this token is described in details in Using Falling/Rising Icons.

** - {%CustomField} denotes any custom field that can be defined in data provider used by series. If you need some additional information do be shown in tooltip - you can use custom fields to store them and custom tokens to display them. This option is described in details in Using Custom Fields of Data-Provider.

*** - "%ChangeColor" token is used when you color text using HTML formatting. Using this token you can color the part of the text in Green (growth) or Red (decrease) to show the change direction. And should define what value should be used. Small sample:

<format><![CDATA[Change: <font color="%ChangeColor.Current"></font>]]></format>

You can see that %ChangeColor token is used in color attribute in <font> HTML tag. More detailed description can be found in Using Color Tokens.

Table below lists all available properties:

Property Name Description
First Value of the field from the first point in a series.
Last Value of the field from the last point in a series.
FirstVisible Value of the field from the first visible point in a series.
LastVisible Value of the field from the last visible point in a series.
Min Minimal value of the field in a series.
Max Maximal value of the field in a series.
MinVisible Minimal value of the field in the visible range of a series.
MaxVisible Maximal value of the field in the visible range of a series.
Current Value of the field from the point with the hovered date. If series doesn't have a point with the hovered date property returns empty string.

Illustration below shows what properties mean basing on the sample of {%Value} token for Line series. You can see the chart in the state when user zoomed to some range and all series data is not shown on the screen. Blue regions on the left and on the right are imaginable - user can't see the first and the last point, but these values can be shown in the tooltip using properties:

Illustration shows the properties of {%Value} token, but the model is applicable for all other tokens with the sample properties.

Live sample below shows usage of all properties of {%Value} token in grouped tooltip for two series.

Live Sample:  Grouped Tooltip - Using Token Properties

to top

Tokens formatting

All tokens that return date time or numerical values can be formatted.

1. Numerical tokens. All tokens below return numerical values:

You can define how numbers returned using these tokens are displayed: what is used as decimal or thousands separator, etc. If, for example, you want to show {%Value.Current} with plus ("+") sign when value is positive - you should write it as {%Value.Current}{plusSign:true}

This works for any tokens in different elements in AnyChart Stock. Learn more in Numbers Formatting article.

2. Date time token {%Date}. You can add date into the tooltip using {%Date} token.

Date token can be formatted too - {%Date}{"%yyyy-%MM-%dd %hh:%mm %tt"}.

This formatting options are applicable to all date time tokens in AnyChart Stock. Learn more in Date/Time Formatting.

Here is a live sample with two Volume+MA technical indicators, the first one doesn't use any formatting in tooltip, and another uses formatting using scale parameter:

XML/JSON Syntax
Plain code
03     <format><![CDATA[{%SeriesIcon} <b><font color="%Color">{%SeriesName} {%Value}{scale:(1000)(1000)(1000)|( K)( M)( B),numDecimals:2}</font></b> ]]></format>
04   </separated_tooltip>
01{
03    format: "{%SeriesIcon} <b><font color=\"%Color\">{%SeriesName} {%Value}{scale:(1000)(1000)(1000)|( K)( M)( B),numDecimals:2}</font></b> "
04  }
05}

Live sample allows you to compare the result in one grouped tooltip:

Live Sample:  Grouped Tooltip - Setting Token Parameters

As you can see - scaling improves the look of the tooltips and axis labels tremendously and makes it easier to read.

to top

Font Settings and HTML tags

<font> node is used to configure font in any text elements in AnyChart Stock.

There are two options for font configuration:

Single Font

By default tooltip uses complex HTML formatting from defaults, but you can turn this formatting off and use uniform font for the item.

Sample XML to use uniform font:

XML/JSON Syntax
Plain code
01 <series type="Line" data_provider="dp1" color="#005ECB">
02   <name><![CDATA[IBM]]></name>
03   <tooltip_settings>
04     <grouped_tooltip>
05       <labels>
06         <font render_as_html="false" family="Tahoma" size="12" bold="true" />
07         <format><![CDATA[{%SeriesIcon} {%SeriesName} {%Value.Current}]]></format>
08       </labels>
09     </grouped_tooltip>
10   </tooltip_settings>
11 </series>
01{
02  type: "Line",
03  dataProvider: "dp1",
04  color: "#005ECB",
05  name: "IBM",
07    groupedTooltip: {
08      labels: {
09        font: {
10          renderAsHtml: false,
11          family: "Tahoma",
12          size: 12,
13          bold: true
14        },
15        format: "{%SeriesIcon} {%SeriesName} {%Value.Current}"
16      }
17    }
18  }
19}

As you can see you need to disable HTML mode using render_as_html attribute in <font> node and define font settings.

Live sample of setting different uniform font for different series in one grouped tooltip:

Live Sample:  Grouped Tooltip - Using General Font

As you can see from the sample different series can be now distinguished easier, but all text for one series is colored in one color and uses one font. HTML mode provides more options, but but its configuration is more complex.

to top

HTML Tags

By default all tooltips use HTML formatting. Depending on the type of series default is different.

With HTML formatting you have more flexibility. HTML gives you an ability to use %SeriesColor and %ChangeColor tokens, which color parts of the text depending on the value.

HTML tags should be specified using CDATA section. Sample XML with bold HTML tag <b>:

XML/JSON Syntax
Plain code
02   <grouped_tooltip>
03     <labels>
04       <format><![CDATA[{%SeriesIcon} <b>{%SeriesName}</b>]]></format>
05     </labels>
06   </grouped_tooltip>
01{
03    labels: {
04      format: "{%SeriesIcon} <b>{%SeriesName}</b>"
05    }
06  }
07}

XML syntax below shows sample HTML formatting. It uses coloring, series icon, and value. Each token is colored using <font> tag:

XML/JSON Syntax
Plain code
01 <tooltip_settings enabled="true" tooltip_mode="Grouped">
02   <grouped_tooltip>
03     <labels>
04       <format><![CDATA[{%SeriesIcon} <b><font color="%SeriesColor">{%SeriesName}</font><font color="#808080">Value: </font><font color="#333333">{%Value.Current}</font></b> ]]></format>
05     </labels>
06   </grouped_tooltip>
01{
02  enabled: true,
03  tooltipMode: "Grouped",
05    labels: {
06      format: "{%SeriesIcon} <b><font color=\"%SeriesColor\">{%SeriesName}</font><font color=\"#808080\">Value: </font><font color=\"#333333\">{%Value.Current}</font></b> "
07    }
08  }
09}

Settings may look complex, but they allow to achieve great results:

Live Sample:  Grouped Tooltip - Using HTML Formatting

This sample uses static texts and color tokens that change color of the text depending on the values. See more about this in Color Tokens section.

Flash Player doesn't support all HTML tags. Full list of supported tags can be found in Font Configuration article.

to top

Using Data Provider Custom Fields

In Required and Custom Fields section of Data Provider Configuration article you can find the description how to add custom fields into the data provider. One of the places of application of this feature is tooltip text.

You can add custom fields values into the tooltip to provide additional information. XML for this may look like:

XML/JSON Syntax
Plain code
03     <data_provider data_set="dataSet1" id="dp1">
04       <fields>
05         <field type="Value" column="1" approximation_type="Average" />
06         <field type="Custom" custom_type_name="ExtraValue1" column="2" approximation_type="Average" />
07         <field type="Custom" custom_type_name="ExtraValue2" column="3" approximation_type="Average" />
08         <field type="Custom" custom_type_name="ExtraValue3" column="4" approximation_type="Average" />
09       </fields>
10     </data_provider>
13     <data_provider data_set="dataSet1" column="1" />
01{
03    {
04      dataSet: "dataSet1",
05      id: "dp1",
06      fields: [
07        {
08          type: "Value",
09          column: 1,
10          approximationType: "Average"
11        },
12        {
13          type: "Custom",
14          customTypeName: "ExtraValue1",
15          column: 2,
16          approximationType: "Average"
17        },
18        {
19          type: "Custom",
20          customTypeName: "ExtraValue2",
21          column: 3,
22          approximationType: "Average"
23        },
24        {
25          type: "Custom",
26          customTypeName: "ExtraValue3",
27          column: 4,
28          approximationType: "Average"
29        }
30      ]
31    }
32  ],
34    {
35      dataSet: "dataSet1",
36      column: 1
37    }
38  ]
39}

As you can see there is a standard value fields and three fields named: ExtraValue1, ExtraValue2 and ExtraValue3, which come from the data set.

XML syntax below shows how to use the fields from data provider:

XML/JSON Syntax
Plain code
01 <tooltip_settings enabled="true" tooltip_mode="Grouped">
02   <grouped_tooltip>
03     <labels>
04       <format><![CDATA[<textformat leading="4">{%SeriesIcon} <b><font color="%Color">{%SeriesName}:</font> {%Value}
05 <font color="#707070">ExtraParam1: </font>{%ExtraParam1}
06 <font color="#707070">ExtraParam2: </font>{%ExtraParam2}
07 <font color="#707070">ExtraParam3: </font>{%ExtraParam3}</b></textformat>]]></format>
08     </labels>
09   </grouped_tooltip>
01{
02  enabled: true,
03  tooltipMode: "Grouped",
05    labels: {
06      format: "<textformat leading=\"4\">{%SeriesIcon} <b><font color=\"%Color\">{%SeriesName}:</font> {%Value}\r\n<font color=\"#707070\">ExtraParam1: </font>{%ExtraParam1}\r\n<font color=\"#707070\">ExtraParam2: </font>{%ExtraParam2}\r\n<font color=\"#707070\">ExtraParam3: </font>{%ExtraParam3}</b></textformat>"
07    }
08  }
09}

When you add custom field value you should {%CustomFieldName} token, where CustomFieldName is the name in data provider, for example: <format>{%ExtraValue1}</format>.

Live sample below shows several custom fields in tooltip:

Live Sample:  Grouped Tooltip - Using Custom Fields Parameters

Another example of the similar situation: you show the line chart that visualizes closing price, but may also want to show open, high, low, close and volume in tooltip. You can either define custom name or use standard (reserved) names.

Following live sample shows how to do that:

Live Sample:  Grouped Tooltip - Using Custom Fields

If you need text or additional date time fields you can use "Text" and "DateTime" custom fields as described in Data Provider Configuration: Text Fields and Data Provider Configuration: DateTime Fields. Sample XML Snippet below shows two data providers with text fields:

XML/JSON Syntax
Plain code
01 <?xml version="1.0" encoding="UTF-8"?>
02 <stock xmlns="http://anychart.com/products/stock/schemas/1.9.0/schema.xsd">
03   <data>
04     <data_providers>
05       <general_data_providers>
06         <data_provider data_set="dataSet1" id="s1">
07           <fields>
08             <field type="Value" column="1" />
09             <field type="Text" custom_type_name="Description" column="2" />
10           </fields>
11         </data_provider>
12         <data_provider data_set="dataSet1" id="s2">
13           <fields>
14             <field type="Value" column="4" />
15             <field type="Text" custom_type_name="Note" column="3" />
16           </fields>
17         </data_provider>
18       </general_data_providers>
19     </data_providers>
20   </data>
21 </stock>
01{
02  data: {
03    dataProviders: {
04      generalDataProviders: [
05        {
06          dataSet: "dataSet1",
07          id: "s1",
08          fields: [
09            {
10              type: "Value",
11              column: 1
12            },
13            {
14              type: "Text",
15              customTypeName: "Description",
16              column: 2
17            }
18          ]
19        },
20        {
21          dataSet: "dataSet1",
22          id: "s2",
23          fields: [
24            {
25              type: "Value",
26              column: 4
27            },
28            {
29              type: "Text",
30              customTypeName: "Note",
31              column: 3
32            }
33          ]
34        }
35      ]
36    }
37  }
38}

To use these fields you just refer to them by name and provide formatting options if needed, here is a live sample of a chart with data providers configured as shown above and text fields used in grouped tooltip:

Live Sample:  Grouped Tooltip - Using Text and DateTime Fields

to top

Series Custom Attributes

Each series can have several custom attributes that contain additional information about the series. These attributes can be used in tooltip.

Syntax of series attributes definition:

XML/JSON Syntax
Plain code
01 <?xml version="1.0" encoding="UTF-8"?>
02 <stock xmlns="http://anychart.com/products/stock/schemas/1.9.0/schema.xsd">
03   <settings>
04     <tooltip_settings enabled="true" tooltip_mode="Grouped">
05       <grouped_tooltip>
06         <labels>
07           <format><![CDATA[{%SeriesIcon}<b> <font color="%Color">{%LongName}</font> <font color="#777777">({%ShortName}):</font> <font color="#333333">{%Value}</font></b> ]]></format>
08         </labels>
09       </grouped_tooltip>
10     </tooltip_settings>
11     <charts>
12       <chart>
13         <series_list>
14           <series type="Area" color="#DC3912" data_provider="dp1">
15             <attributes>
16               <attr name="ShortName"><![CDATA[MSFT]]></attr>
17               <attr name="LongName"><![CDATA[Microsoft Corp.]]></attr>
18             </attributes>
19           </series>
20           <series type="Area" color="#0066DD" data_provider="dp2">
21             <attributes>
22               <attr name="ShortName"><![CDATA[ORCL]]></attr>
23               <attr name="LongName"><![CDATA[Oracle Corp.]]></attr>
24             </attributes>
25           </series>
26         </series_list>
27       </chart>
28     </charts>
29   </settings>
30 </stock>
01{
02  settings: {
03    tooltipSettings: {
04      enabled: true,
05      tooltipMode: "Grouped",
06      groupedTooltip: {
07        labels: {
08          format: "{%SeriesIcon}<b> <font color=\"%Color\">{%LongName}</font> <font color=\"#777777\">({%ShortName}):</font> <font color=\"#333333\">{%Value}</font></b> "
09        }
10      }
11    },
12    charts: [
13      {
14        seriesList: [
15          {
16            type: "Area",
17            color: "#DC3912",
18            dataProvider: "dp1",
19            attributes: {
20              ShortName: "MSFT",
21              LongName: "Microsoft Corp."
22            }
23          },
24          {
25            type: "Area",
26            color: "#0066DD",
27            dataProvider: "dp2",
28            attributes: {
29              ShortName: "ORCL",
30              LongName: "Oracle Corp."
31            }
32          }
33        ]
34      }
35    ]
36  }
37}

As you can see from the listing - tooltip uses custom attributes. To put attribute value into the tooltip use {%SomeAttributeName} tokens, where SomeAttributeName is the name specified in: <attr name="AttrName"/>.

Live sample below shows series with ShortName and LongName attributes. These attributes are used in tooltip:

Live Sample:  Grouped Tooltip - Using Series Custom Attributes

to top

Technical Indicators Differences

Technical indicators use pretty similar to series visualization options. Different technical indicators are represented by some parameters that are displayed on the chart. For example, Volume+MA shows: Volume and Moving Average as Bar and Line series.

All visualization settings of technical indicator are identical to the series visualization series and so, the tooltip settings are similar too.

For example, Stochastic Oscillator. This indicator visualizes K-Period and D-Period. There is a special section for both of them in XML. XML below shows the settings for K-Period and D-Period:

XML/JSON Syntax
Plain code
02   <k_series type="Line" color="#253992">
03     <tooltip_settings>
04       <grouped_tooltip />
05     </tooltip_settings>
06   </k_series>
07   <d_series type="Line" color="#DB2A0E">
08     <tooltip_settings>
09       <grouped_tooltip />
10     </tooltip_settings>
11   </d_series>
01{
02  kPeriod: 15,
03  dPeriod: 5,
04  kSeries: {
05    type: "Line",
06    color: "#253992",
07    tooltipSettings: {
08      groupedTooltip: {}
09    }
10  },
11  dSeries: {
12    type: "Line",
13    color: "#DB2A0E",
14    tooltipSettings: {
15      groupedTooltip: {}
16    }
17  }
18}

As you can see settings are similar to series settings and for each parameter you can configure <tooltip_settings>.

Sample XML of indicator with tooltip formatting strings defined:

XML/JSON Syntax
Plain code
02   <k_series type="Line" color="#253992">
03     <tooltip_settings enabled="true">
04       <grouped_tooltip>
05         <labels>
06           <format><![CDATA[{%SeriesIcon} <b><font color="%Color">{%SeriesName} {%Value.Current}</font></b>]]></format>
07         </labels>
08       </grouped_tooltip>
09     </tooltip_settings>
10     <name><![CDATA[Stochastic: %K(15)]]></name>
11   </k_series>
12   <d_series type="Line" color="#DB2A0E">
13     <tooltip_settings enabled="true">
14       <grouped_tooltip>
15         <labels>
16           <format><![CDATA[{%SeriesIcon} <b><font color="%Color">{%SeriesName} {%Value.Current}</font></b>]]></format>
17         </labels>
18       </grouped_tooltip>
19     </tooltip_settings>
20     <name><![CDATA[%D(5)]]></name>
21   </d_series>
01{
02  kPeriod: 15,
03  dPeriod: 5,
04  kSeries: {
05    type: "Line",
06    color: "#253992",
07    tooltipSettings: {
08      enabled: true,
09      groupedTooltip: {
10        labels: {
11          format: "{%SeriesIcon} <b><font color=\"%Color\">{%SeriesName} {%Value.Current}</font></b>"
12        }
13      }
14    },
15    name: "Stochastic: %K(15)"
16  },
17  dSeries: {
18    type: "Line",
19    color: "#DB2A0E",
20    tooltipSettings: {
21      enabled: true,
22      groupedTooltip: {
23        labels: {
24          format: "{%SeriesIcon} <b><font color=\"%Color\">{%SeriesName} {%Value.Current}</font></b>"
25        }
26      }
27    },
28    name: "%D(5)"
29  }
30}

Live sample where tooltips are disabled for Slow Stochastic and configured for Fast Stochastic:

Live Sample:  Grouped Tooltip - Technical Indicators

Learn more about technical indicators settings in Technical Indicator Settings.

to top

Series Icon

When you use {%SeriesIcon} token in tooltip formatting string it is replaced by icon. By default icon is a square 8x8 pixels. You can configure icon for each series: shape, size, fill and border.

Sample XML syntax of icon configuration:

XML/JSON Syntax
Plain code
01 <series color="#FF0000">
02   <tooltip_settings>
03     <grouped_tooltip>
04       <labels>
05         <icon type="Diamond" size="10">
06           <fill type="Solid" color="%Color" opacity="1" />
07           <border color="DarkColor(%Color)" opacity="0.8" />
08         </icon>
09       </labels>
10     </grouped_tooltip>
11   </tooltip_settings>
12 </series>
01{
02  color: "#FF0000",
04    groupedTooltip: {
05      labels: {
06        icon: {
07          type: "Diamond",
08          size: 10,
09          fill: {
10            type: "Solid",
11            color: "%Color",
12            opacity: 1
13          },
14          border: {
15            color: "DarkColor(%Color)",
16            opacity: 0.8
17          }
18        }
19      }
20    }
21  }
22}

As you can see:

Icon color is set using %Color token. This token value comes from series color attribute. You can use color transform options described in Color article or static color like <fill color="#55DD00"/>.

size attribute defines icon width and height in pixels.

Shape is set using type attribute. By default it is set to Square, but you can use any of the shapes listed below:

Type
Circle
Square
Diamond
Cross
DiagonalCross
HLine
VLine
Star4
Star5
Star6
Star7
TriangleUp
TriangleDown

Live sample of the tooltips with different icons in different series:

Live Sample:  Grouped Tooltip - Labels Icon Settings

to top

Color Tokens

As it was said above HTML formatting is used in tooltip text configuration. To color part of the text <font> tag is used. For example: <font color="#FF0000">{%Value.Current}</font>.

You can either use constant color or color tokens.

There are two color tokens that can be used:

XML to use {%Color} token. In this sample text is colored to the series color:

XML/JSON Syntax
Plain code
02   <grouped_tooltip>
03     <labels>
04       <format><![CDATA[<font color="%Color">{%SeriesName} {%Value}</font>]]></format>
05     </labels>
06   </grouped_tooltip>
01{
02  tooltipMode: "Grouped",
04    labels: {
05      format: "<font color=\"%Color\">{%SeriesName} {%Value}</font>"
06    }
07  }
08}

XML to use {%ChangeColor} token. In this sample text us either Green or Red - depending on the value:

XML/JSON Syntax
Plain code
02   <grouped_tooltip>
03     <labels>
04       <format><![CDATA[<font color="%ChangeColor">{%ValueChange.Current}</font>]]></format>
05     </labels>
06   </grouped_tooltip>
01{
03    labels: {
04      format: "<font color=\"%ChangeColor\">{%ValueChange.Current}</font>"
05    }
06  }
07}

Live sample below shows how {%Color} and {%ChangeColor} tokens can be used:

Live Sample:  Grouped Tooltip - Working with Color Tokens

to top

Falling/Rising Icons

Besides coloring the changes you can show them as icons: red arrow down or green arrow up. These icons are added into the tooltip using {%ChangeIcon} token.

{%ChangeIcon} has Current, First, Last, FirstVisible and LastVisible properties that define which value change should be shown and you should always specify property when you use this token. As the matter of fact {%ChangeIcon} is similar to {%ValueChange} and {%PercentValueChange}, but it shows only the trend.

XML to add these icons into the tooltip text:

XML/JSON Syntax
Plain code
02   <grouped_tooltip>
03     <labels>
04       <format><![CDATA[{%SeriesIcon} {%SeriesName} {%ChangeIcon} {%ValueChange}]]></format>
05     </labels>
06   </grouped_tooltip>
01{
03    labels: {
04      format: "{%SeriesIcon} {%SeriesName} {%ChangeIcon} {%ValueChange}"
05    }
06  }
07}

Visual appearance of icons can be configured, you can change size, fill and border.

XML for that looks like that:

XML/JSON Syntax
Plain code
01 <?xml version="1.0" encoding="UTF-8"?>
02 <stock xmlns="http://anychart.com/products/stock/schemas/1.9.0/schema.xsd">
03   <settings>
04     <tooltip_settings>
05       <grouped_tooltip>
06         <labels>
07           <falling_rising_icons size="12">
08             <falling>
09               <fill enabled="true" color="#CC3300" opacity="1" />
10               <border enabled="false" />
11             </falling>
12             <rising>
13               <fill color="Green" opacity="1" />
14               <border enabled="false" />
15             </rising>
16           </falling_rising_icons>
17           <format><![CDATA[{%SeriesIcon} {%SeriesName} {%ChangeIcon} {%ValueChange}]]></format>
18         </labels>
19       </grouped_tooltip>
20     </tooltip_settings>
21   </settings>
22 </stock>
01{
02  settings: {
03    tooltipSettings: {
04      groupedTooltip: {
05        labels: {
06          fallingRisingIcons: {
07            size: 12,
08            falling: {
09              fill: {
10                enabled: true,
11                color: "#CC3300",
12                opacity: 1
13              },
14              border: {
15                enabled: false
16              }
17            },
18            rising: {
19              fill: {
20                color: "Green",
21                opacity: 1
22              },
23              border: {
24                enabled: false
25              }
26            }
27          },
28          format: "{%SeriesIcon} {%SeriesName} {%ChangeIcon} {%ValueChange}"
29        }
30      }
31    }
32  }
33}

Live sample below shows icons configuration:

Live Sample:  Grouped Tooltip - Using Falling and Rising Icons

to top

Title

Grouped tooltip puts data from several series and/or indicators from one or several charts in one block and each series or indicator provides information about the data in it. To make this composite block of data more clear grouped tooltip has a title, which can be configured on <settings> and <chart> levels:

XML/JSON Syntax
Plain code
01 <?xml version="1.0" encoding="UTF-8"?>
02 <stock xmlns="http://anychart.com/products/stock/schemas/1.9.0/schema.xsd">
03   <settings>
04     <tooltip_settings>
05       <grouped_tooltip>
06         <title />
07       </grouped_tooltip>
08     </tooltip_settings>
09   </settings>
10 </stock>
01{
02  settings: {
03    tooltipSettings: {
04      groupedTooltip: {
05        title: {}
06      }
07    }
08  }
09}

You can put any text in this title, which describes your data better. By default grouped tooltip title displays current data.

to top

{%Date} token in title

If you don't like default title text or want to combine it with some text you can use {%Date} token along with some static text or formatting options:

XML/JSON Syntax
Plain code
01 <?xml version="1.0" encoding="UTF-8"?>
02 <stock xmlns="http://anychart.com/products/stock/schemas/1.9.0/schema.xsd">
03   <settings>
04     <tooltip_settings>
05       <grouped_tooltip>
06         <title>
07           <format><![CDATA[Date: {%Date}{"%yyyy-%MM-%dd"}]]></format>
08         </title>
09       </grouped_tooltip>
10     </tooltip_settings>
11   </settings>
12 </stock>
01{
02  settings: {
03    tooltipSettings: {
04      groupedTooltip: {
05        title: {
06          format: "Date: {%Date}{\"%yyyy-%MM-%dd\"}"
07        }
08      }
09    }
10  }
11}

Date formatting is done as with any other dates, see Date Time Formatting for more.

to top

Font and HTML Formatting

As any other text you can format title using plain text settings - using uniform font and font decoration:

XML/JSON Syntax
Plain code
01 <?xml version="1.0" encoding="UTF-8"?>
02 <stock xmlns="http://anychart.com/products/stock/schemas/1.9.0/schema.xsd">
03   <settings>
04     <tooltip_settings>
05       <grouped_tooltip>
06         <title>
07           <font render_as_html="false" family="Courier" bold="true" />
08         </title>
09       </grouped_tooltip>
10     </tooltip_settings>
11   </settings>
12 </stock>
01{
02  settings: {
03    tooltipSettings: {
04      groupedTooltip: {
05        title: {
06          font: {
07            renderAsHtml: false,
08            family: "Courier",
09            bold: true
10          }
11        }
12      }
13    }
14  }
15}

Or create complex HTML formatted form to color parts of the title in different colors or give them different decoration:

XML/JSON Syntax
Plain code
01 <?xml version="1.0" encoding="UTF-8"?>
02 <stock xmlns="http://anychart.com/products/stock/schemas/1.9.0/schema.xsd">
03   <settings>
04     <tooltip_settings>
05       <grouped_tooltip>
06         <title>
07           <font render_as_html="true" />
08           <format><![CDATA[<u>Date: <b><font color="Black">{%Date.Current}{"%yyyy-%MM-%dd"}</font></b></u>]]></format>
09         </title>
10       </grouped_tooltip>
11     </tooltip_settings>
12   </settings>
13 </stock>
01{
02  settings: {
03    tooltipSettings: {
04      groupedTooltip: {
05        title: {
06          font: {
07            renderAsHtml: true
08          },
09          format: "<u>Date: <b><font color=\"Black\">{%Date.Current}{\"%yyyy-%MM-%dd\"}</font></b></u>"
10        }
11      }
12    }
13  }
14}

To learn more about text and HTML formatting see: Font Formatting Options.

to top

Background

Title has its own background and combination of text decoration, title background and tooltip background allows you to create a great looking tooltip. For example, settings like these:

XML/JSON Syntax
Plain code
02   <title enabled="true">
03     <font color="#FFFFFF" />
04     <background enabled="true">
05       <fill type="Gradient" color="White">
06         <gradient angle="90">
07           <keys>
08             <key color="#ED8686" position="0" />
09             <key color="#ED7979" position="0.1" />
10             <key color="#FAC3C3" position="0.15" />
11             <key color="#FFC4C4" position="0.25" />
12             <key color="#E86161" position="0.27" />
13             <key color="#B83939" position="0.7" />
14             <key color="#6E0404" position="1" />
15           </keys>
16         </gradient>
17       </fill>
18       <border enabled="true" color="#B83939" thickness="1" opacity="0.8" pixel_hinting="true" />
19       <corners type="Rounded" left_top="5" right_top="5" left_bottom="0" right_bottom="0" />
20     </background>
21   </title>
22   <background>
23     <corners type="Cut" left_top="6" right_top="6" left_bottom="0" right_bottom="0" />
24   </background>
01{
02  title: {
03    enabled: true,
04    font: {
05      color: "#FFFFFF"
06    },
07    background: {
08      enabled: true,
09      fill: {
10        type: "Gradient",
11        color: "White",
12        gradient: {
13          angle: 90,
14          keys: [
15            {
16              color: "#ED8686",
17              position: 0
18            },
19            {
20              color: "#ED7979",
21              position: 0.1
22            },
23            {
24              color: "#FAC3C3",
25              position: 0.15
26            },
27            {
28              color: "#FFC4C4",
29              position: 0.25
30            },
31            {
32              color: "#E86161",
33              position: 0.27
34            },
35            {
36              color: "#B83939",
37              position: 0.7
38            },
39            {
40              color: "#6E0404",
41              position: 1
42            }
43          ]
44        }
45      },
46      border: {
47        enabled: true,
48        color: "#B83939",
49        thickness: 1,
50        opacity: 0.8,
51        pixelHinting: true
52      },
53      corners: {
54        type: "Rounded",
55        leftTop: 5,
56        rightTop: 5,
57        leftBottom: 0,
58        rightBottom: 0
59      }
60    }
61  },
62  background: {
63    corners: {
64      type: "Cut",
65      leftTop: 6,
66      rightTop: 6,
67      leftBottom: 0,
68      rightBottom: 0
69    }
70  }
71}

Allow you to display nice looking tooltip as shown in this Live Sample, which also shows HTML formatting and use of Date token:

Live Sample:  Grouped Tooltip - Title Background Settings

to top