如:
var opt_chart=({
chart: {
renderTo: ‘div‘,
type: ‘bar‘
},
title: {
text: ‘‘
},
colors: [‘#4db3a4‘],
xAxis: {
categories: [‘1222222222221212121212121212121212‘,‘34556789-0987654323456789‘],
title: {
text: null
},
labels: {
useHTML: true,
enabled: true,
style :{
‘display‘:‘inline-block‘,
‘max-width‘:‘150px‘,
‘overflow‘:‘hidden‘,
‘text-overflow‘:‘ellipsis‘,
‘white-space‘:‘nowrap‘,
‘padding-right‘:‘15px‘
}
}
},
yAxis: {
min: 0,
title: {
text: ‘%‘,
align: ‘high‘
},
labels:{
overflow: ‘justify‘
}
},
tooltip: {
valueSuffix: ‘ %‘,
useHTML: true
},
plotOptions: {
bar: {
dataLabels: {
enabled: true
},
borderWidth: 10
}
},
legend: {
layout: ‘vertical‘,
align: ‘right‘,
verticalAlign: ‘top‘,
x: -40,
y: 100,
borderWidth: 1,
backgroundColor: ‘#FFFFFF‘,
shadow: true
},
credits: {
enabled: false
}
});
上述部分代码中
style :{
‘display‘:‘inline-block‘,
‘max-width‘:‘150px‘,
‘overflow‘:‘hidden‘,
‘text-overflow‘:‘ellipsis‘,
‘white-space‘:‘nowrap‘,
‘padding-right‘:‘15px‘
}
为文字过长,截取文字并用点号结尾
原文地址:http://java2013.blog.51cto.com/2841631/1698432