向高图添加标题 [英] Adding titles to highcharts
本文介绍了向高图添加标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道是否可以添加标题,如下图红色方框所示.任何演示将不胜感激!
I'm wondering is it possible to add titles as shown in the image below in the red square. Any demo will be appreciated!
推荐答案
我认为您应该可以通过使用带有虚拟序列的以下配置来渲染第二个y轴来达到想要的效果:
I think that you should be able to achieve the wanted effect by using the below config with dummy series to render the second y-axis:
Highcharts.chart('container', {
chart: {
type: 'bar'
},
xAxis: [{
title: {
align: 'high',
rotation: 0,
y: -20,
x: 45,
text: 'test',
style: {
"color": "#333333",
"fontSize": "18px"
}
}
}, {
offset: 150,
tickLength: 0,
lineWidth: 0,
categories: ['26-35', '16-25', '36-45', '46-55', '56-65', '66-75', '75+'],
title: {
align: 'high',
rotation: 0,
y: -20,
x: 45,
text: 'test',
style: {
"color": "#333333",
"fontSize": "18px"
}
},
}],
series: [{
// dummy series
type: 'column',
data: [43934, 52503, 57177, 69658, 97031, 119931, 137133],
xAxis: 1,
showInLegend: false,
color: 'transparent',
enableMouseTracking: false
}, {
data: [43934, 52503, 57177, 69658, 97031, 119931, 137133],
name: 'main series'
}]
});
演示: https://jsfiddle.net/BlackLabel/3qu4Lv19/
使用的功能的API:
https://api.highcharts.com/highcharts/xAxis.offset
https://api.highcharts.com/highcharts/xAxis.categories
https://api.highcharts.com/highcharts/series. column.enableMouseTracking
这篇关于向高图添加标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文