Home Forums StockChart Support Show tooltip when hovered over stripline label Reply To: Show tooltip when hovered over stripline label

#42027

@mustadirmahmood,

As mentioned earlier, it is not possible to display tooltip for stripline labels as of now. However, you can position a hidden div on top of a stripline label based on its bound and display a custom tooltip for that div with a few lines of code. Please take a look at the code snippet below.

function addStriplineLabelTooltip() {
    var stripLine = chart.axisX2[0].stripLines[0];
    var tooltip = $("<div class='tooltip'><span class='tooltiptext'>Tooltip Content</span></div>");
    $(tooltip).css({"height": "12px", "width": stripLine.get("label").width() + "px", "left": stripLine.get("bounds").x1 + "px", "top": stripLine.get("bounds").y1 - 11 + "px"})
    $(chart.container).append(tooltip);  
}

Please check this updated JSFiddle for a working example.

Tooltip for stripline label


Thangaraj Raman
Team CanvasJS