Grouped Tooltips Visualization and Layout

Overview

This article describes how to alter the visual appearance of Grouped tooltips: change background, width, rows spacing, separator and so on.

Rows Separator

Grouped tooltip consists of several elements that come from different data series or indicators, by default they are separated by the line feed only, but you can configure them to be separated by the visual separator.

Adding

Separator may consist of two lines: top and bottom, you can enable and disable each of them separately:

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         <separator>
07           <top_line enabled="true" />
08           <bottom_line enabled="false" />
09         </separator>
10       </grouped_tooltip>
11     </tooltip_settings>
12   </settings>
13 </stock>
01{
02  settings: {
03    tooltipSettings: {
04      enabled: true,
05      tooltipMode: "Grouped",
06      groupedTooltip: {
07        separator: {
08          topLine: {
09            enabled: true
10          },
11          bottomLine: {
12            enabled: false
13          }
14        }
15      }
16    }
17  }
18}

to top

Visual Settings

Each of the lines is configured as any other line, with opacity, color and thickness:

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         <separator>
07           <top_line enabled="true" color="Gray" thickness="2" />
08           <bottom_line enabled="true" color="Gray" thickness="1" opacity="0.5" />
09         </separator>
10       </grouped_tooltip>
11     </tooltip_settings>
12   </settings>
13 </stock>
01{
02  settings: {
03    tooltipSettings: {
04      enabled: true,
05      tooltipMode: "Grouped",
06      groupedTooltip: {
07        separator: {
08          topLine: {
09            enabled: true,
10            color: "Gray",
11            thickness: 2
12          },
13          bottomLine: {
14            enabled: true,
15            color: "Gray",
16            thickness: 1,
17            opacity: 0.5
18          }
19        }
20      }
21    }
22  }
23}

Sample below shows the grouped tooltip with separators configured as shown above:

Live Sample:  Grouped Tooltip - Using Items Separator

to top

Putting elements in one Row

When there are a lot of series in the chart, or, for example, some subsequent series are bound logically, you may want to display them in one row. To do so you need to set one element to be put in one line with previous - this can be done using put_in_line of <grouped_tooltip> node.

XML sample below shows four series, which will be shown in two rows instead of four:

XML/JSON Syntax
Plain code
01 <chart>
02   <series_list>
03     <series type="Spline" data_provider="dp4" color="Orange">
04       <name><![CDATA[Open]]></name>
05     </series>
06     <series type="Spline" data_provider="dp3" color="Blue">
07       <name><![CDATA[High]]></name>
08       <tooltip_settings>
09         <grouped_tooltip put_in_line="true" />
10       </tooltip_settings>
11     </series>
12     <series type="Spline" data_provider="dp2" color="Green">
13       <name><![CDATA[Low]]></name>
14     </series>
15     <series type="Spline" data_provider="dp1" color="Red">
16       <name><![CDATA[Close]]></name>
17       <tooltip_settings>
18         <grouped_tooltip put_in_line="true" />
19       </tooltip_settings>
20     </series>
21   </series_list>
22 </chart>
01{
02  seriesList: [
03    {
04      type: "Spline",
05      dataProvider: "dp4",
06      color: "Orange",
07      name: "Open"
08    },
09    {
10      type: "Spline",
11      dataProvider: "dp3",
12      color: "Blue",
13      name: "High",
14      tooltipSettings: {
15        groupedTooltip: {
16          putInLine: true
17        }
18      }
19    },
20    {
21      type: "Spline",
22      dataProvider: "dp2",
23      color: "Green",
24      name: "Low"
25    },
26    {
27      type: "Spline",
28      dataProvider: "dp1",
29      color: "Red",
30      name: "Close",
31      tooltipSettings: {
32        groupedTooltip: {
33          putInLine: true
34        }
35      }
36    }
37  ]
38}

Live Sample with grouped tooltip where for elements are put in two rows:

Live Sample:  Grouped Tooltips - Elements Rows

to top

Rows Spacing

You can change the space between the rows in a grouped tooltip using items_spacing attribute of <grouped_tooltip> node:

XML/JSON Syntax
Plain code
01{
02  tooltipMode: "Grouped",
04    itemsSpacing: 10
05  }
06}

Live Sample of two similar chart and different spacing in their grouped tooltips:

Live Sample:  Grouped Tooltip - Items Spacing

to top

Positioning

By default tooltips is shown when you hover the chart and it follows the mouse as you move it over. You can change this behavior and set another positioning mode, if you'd like to.

Grouped tooltip positioning is set using anchor attribute of <grouped_tooltip> node. You can set one of the following value to it:

anchor
Float
LeftTop
CenterTop
RightTop
LeftCenter
RightCenter
LeftBottom
CenterBottom
RightBottom

All fixed anchors place tooltip in one position and tooltips always is shown there. Sample XML to set the anchor:

XML/JSON Syntax
Plain code
02   <grouped_tooltip anchor="RightTop" />
01{
02  tooltipMode: "Grouped",
04    anchor: "RightTop"
05  }
06}

Live sample with two similar charts and tooltips placed to "RightTop" and "RightBottom" positions:

Live Sample:  Grouped Tooltip - Position Anchor

to top

Background

Grouped tooltip has a common background and title background. Title background configuration is described in Grouped Title description.

Border and Fill

Standard <fill> and <border> nodes are used to configure this background. Sample XML for configuration:

XML/JSON Syntax
Plain code
02   <background>
03     <fill type="Gradient">
04       <gradient angle="90">
05         <keys>
06           <key color="#FEFEFE" />
07           <key color="#F1F1F1" />
08         </keys>
09       </gradient>
10     </fill>
11     <border color="#BDBDBD" />
12   </background>
01{
02  background: {
03    fill: {
04      type: "Gradient",
05      gradient: {
06        angle: 90,
07        keys: [
08          {
09            color: "#FEFEFE"
10          },
11          {
12            color: "#F1F1F1"
13          }
14        ]
15      }
16    },
17    border: {
18      color: "#BDBDBD"
19    }
20  }
21}

Live sample of the grouped tooltip with such settings:

Live Sample:  Grouped Tooltip - Fill and Border Settings

To learn more about the possible settings see Background Settings or XML Reference.

to top

Corners

As any other background you have an ability to configure corners shape using <corners> node. Sample XML for changing the corners of tooltip:

XML/JSON Syntax
Plain code
02   <background>
03     <corners type="Cut" left_top="0" right_top="0" right_bottom="10" left_bottom="0" />
04   </background>
01{
02  background: {
03    corners: {
04      type: "Cut",
05      leftTop: 0,
06      rightTop: 0,
07      rightBottom: 10,
08      leftBottom: 0
09    }
10  }
11}

Live sample of such settings:

Live Sample:  Grouped Tooltip - Background Corners Settings

To learn more about the possible settings see Background Settings or XML Reference.

to top

Shadow

You can also change and configure the shadow of tooltip. By default it is turned on, an you can either turn it off or reconfigure. Sample XML:

XML/JSON Syntax
Plain code
02   <background>
03     <shadow enabled="true" color="Red" angle="45" distance="5" blur_x="3" blur_y="3" />
04   </background>
01{
02  background: {
03    shadow: {
04      enabled: true,
05      color: "Red",
06      angle: 45,
07      distance: 5,
08      blurX: 3,
09      blurY: 3
10    }
11  }
12}

Live sample of grouped tooltip with red shadow:

Live Sample:  Grouped Tooltip - Background Shadow Settings

To learn more about all possible settings see XML Reference.

to top

Margins

You can configure inner margin between tooltip text and border. Simple XML Syntax:

XML/JSON Syntax
Plain code
02   <grouped_tooltip>
03     <background>
04       <inside_margin left="20" top="5" right="20" bottom="5" />
05     </background>
06   </grouped_tooltip>
01{
02  tooltipMode: "Grouped",
04    background: {
05      insideMargin: {
06        left: 20,
07        top: 5,
08        right: 20,
09        bottom: 5
10      }
11    }
12  }
13}

Live Sample with configured margins:

Live Sample:  Grouped Tooltip - Inside Margins Settings

to top