This is a sample map of Austria with a custom tooltips styling. The maps are generated by the Google Geochart API. This API wraps the tooltip content in a div that has the class google-visualization-tooltip
. We can use this class to make some customizations.
The following table shows the default tooltip and the customized version from above:
|
Default Tooltip |
Custom Tooltip |
Preview |
|
|
CSS |
background-color: white;
border: 1px solid #bdbdbd;
border-radius: 2px;
box-shadow: 0 2px 2px
0 rgba(204, 204, 204, 0.6);
|
background-color: #f6f6f6;
border: 1px solid #dddddd;
border-bottom: 2px solid
#dddddd;
border-radius: 5px;
box-shadow: 0 2px 2px
0 rgba(204, 204, 204, 0.6);
|
The map from above uses HTML tooltips. We used following construction for our tooltips:
<div class="tooltip-wrap">
<p class="tooltip-header">Linz</p>
<p class="tooltip-body">Linz is the...</p>
<small>From Wikipedia, the free encyclopedia</small>
</div>
The following box shows the configuration of the example map. The CSS for our tooltips can be found in the “Map Template” section:
Copy the following text and click on "Import" in the plugin.
Map settings
Name |
Value |
Description |
Region |
Austria |
List with all available regions |
Width |
auto |
Width of the map in pixel. 'Auto' means that the map is centered in the available width. |
Height |
auto |
Height of the map in pixel. 'Auto' means that the map is centered in the available height. |
Display mode |
Markers |
Specifies the display mode of the map. |
Border resolution |
Provinces |
The resolution of the map borders. |
Tooltips |
On |
Allows to display a tooltip for highlighted map elements. |
Tooltips: Trigger |
focus |
The user interaction that causes the tooltip to be displayed. |
Tooltips: Use HTML |
On |
Specifies if the tooltips should use HTML. This allows to customize the tooltips even more. For example, if this property is on, it is possible to display images wihtin the tooltip. |
Map template
CSS |
#{cssid} .tooltip-wrap {
max-width: 250px;
}
#{cssid} .google-visualization-tooltip {
border-radius: 5px;
background-color: #f6f6f6;
border: 1px solid #dddddd;
border-bottom: 2px solid #dddddd;
}
#{cssid} .tooltip-header {
padding: 10px;
font-size: 1.8em;
font-family: Times,serif;
}
#{cssid} .tooltip-body {
border: 1px solid #efefef;
border-bottom: 2px solid #efefef;
background-color: #ffffff;
border-radius: 5px;
padding: 10px;
}
#{cssid} small {
padding-left: 5px;
}
#{cssid} circle {
cursor: pointer;
} |
HTML |
<div id="{cssid}">
%%map%%
</div> |
JavaScript
Executed when a marker/region is clicked.
Click value can be defined for each map element.
|
|
Map elements (4)
Color |
Name |
Click Value |
|
Vienna |
|
|
Salzburg |
|
|
Graz |
|
|
Linz |
|
Comments
If you need help or have questions, please leave a comment.