rebuildToolTip();
The rebuildToolTip method rerenders tooltip for map layer area.
To execute the example the HTML page must contain the MapChart component named map (see Example of Creating the MapChart Component). Draw a tooltip for map layer area with the RU-KYA identifier. Next decrease the map scale and refresh position of the created tooltip:
// Get map layer area with the RU identifier var shape = map.getShape("RU-KYA"); // Enable tooltip displaying shape._tooltipOn = true; // Get rectangular shape that limits map layer area var bounds = shape.getBoundsRect(); // Define label offsets from the left and top map edge var targetX = bounds.getLeft() + bounds.getWidth() / 2 + (map.getWidth() - map.getTopobaseSize().width) / 2; var targetY = bounds.getTop() + bounds.getHeight() / 2 + (map.getHeight() - map.getTopobaseSize().height) / 2; // Create a tooltip shape._ToolTip = new PP.MapToolTip({ Chart: map, MaskText: "{%Name} \n {%AreaTitle}: {%AreaValue:#,##.00}", TargetX: targetX, TargetY: targetY }); // Redraw the tooltip shape.rebuildToolTip(); // Find map center var pointZoom = new PP.Point(map.getWidth() / 2, map.getHeight() / 2); // Reduce map scale by two map.setScale(0.5, pointZoom, 0, 0); // Set initial center of map layer area to refresh tooltip position shape._tooltipRelX = bounds.getLeft() + bounds.getWidth() / 2; shape._tooltipRelY = bounds.getTop() + bounds.getHeight() / 2; // Update tooltip position shape.updateTooltipPosition();
After executing the example a tooltip is drawn for map layer area with the RU-KYA identifier. After reducing the map scale by two, tooltip position is updated:
See also: