Warm tip: This article is reproduced from serverfault.com, please click

How to prevent highcharts from shortening labels with ellipsis

发布于 2015-06-19 10:02:26

Highcharts is truncating an x-axis label on a bullet chart. I want to prevent this happening and always show the full text without shortening.

enter image description here

I have tried

.highcharts-container { overflow: visible !important; }
.highcharts-axis-labels text
    { 
    overflow: visible !important;  
}

but it seems like the SVG is doing the truncation and ellipsis, not CSS as you can tell by seeing the rendered markup.

<text x="229.0625" style="color: rgb(96, 96, 96); cursor: default;     font-size: 9px; padding: 0px; fill: rgb(96, 96, 96);" text-anchor="middle"   transform="translate(0,0)" y="32" opacity="1">
<tspan>47…</tspan>
<title>47.5k</title>
</text>

I have tried adding the following property in the javascript:

labels: {
    autoRotation: false,
    style: {
    width: '200px',
    'min-width': '200px'
},

But it does not work. How can I prevent highcharts from truncating the label text?

Questioner
Dan Cook
Viewed
0
Paweł Fus 2016-10-05 18:58:36

Set proper styles for that labels, see API.

Example:

xAxis: {
    labels: {
        style: {
            textOverflow: 'none'
        }
    } 
}