Knowledge Base

Auto-truncating long value axis labels with ellipsis and hover balloon

In some cases value axis title might be too long to fit. This demo shows how you can make the chart automatically truncate the title with ellipsis to fit actual plot area height, but still display full title in hover tooltip.

The demo uses AmCharts.addInitHandler() call to add init event to the serial chart.

The handler function, which is triggered on chart load, will check all value axes (assuming they are all vertical) if they have any titles set and if they fit into actual height of the plot area. If there are any labels that do not fit, the function will keep reducing the actual label until it fits. It will also add an SVG <title> node into title so that hovering over the title will produce the full-length tooltip.