X轴上的数据如何格式化成Y的样子?
$(function () {
Highcharts.setOptions({
lang: {
numericSymbols: ['k' , 'M' , 'G' , 'T' , 'P' , 'E'],
},
}),
Highcharts.chart('containers', {
plotOptions: {
column:{
dataLabels:{
enabled:true, // dataLabels设为true
style:{
color:'#D7DEE9'
}
}
}
},
credits:{
enabled: false
},
exporting: {
enabled: false
},
chart: {
type: 'column',
alignTicks: false
},
title: {
text: '流量使用排名'
},
yAxis: {
labels: {
},
title: {
text: ''
}
},
legend: {
enabled: false
},
xAxis: {
lables:{
formatter: function() {
}
},
categories:
['tests']
},
series: [{
showInLegend: false,
name: '总流量使用',
data: [
[11111111111]
]
}],
responsive: {
rules: [{
condition: {
maxWidth: 500
},
// Make the labels less space demanding on mobile
chartOptions: {
xAxis: {
labels: {
formatter: function () {
return this.value.replace('月', '')
}
}
},
yAxis: {
labels: {
align: 'left',
x: 0,
y: -2
},
title: {
text: ''
}
}
}
}]
}
});
});
function setSize(width) {
chart.setSize(width, 300);
}
你配置了全局,又单独配置了
xAxis
,所以没法应用全局的配置把上面这一段去掉,然后
data
每一项需要两个数字,一个是X轴
一个是Y轴
,如果每项只有一个数字的话,那就只有Y轴
了,全局的配置是针对数字进行转换的.具体的看例子
Highcharts Sample