Highcharts方框图自定义标签的最大四分位数中位数和最小值



我想更改高图方框图的最大值、上四分位数、中值、下四分位数和最小值的工具提示标签。我认为这是可能的,但找不到解决方案。以下是我现在拥有的基本箱图的快速JSFiddle。

Highcharts.chart('container', {
chart: {
type: 'boxplot',
inverted: true,
},
title: {
text: 'Highcharts Box Plot Example'
},
legend: {
enabled: false
},
xAxis: {
lineWidth: 0,
tickWidth: 0,
labels: {
enabled: false
}
},
yAxis: {
gridLineWidth: 0,
labels: {
enabled: false,
}
},
series: [{
name: 'Observations',
data: [
[760, 801, 848, 895, 965]
],
dataLabels: {
enabled: true
}
}]
});

使用工具提示并读取point值,如本例所示:

示例:

// Set the tooltip:     
tooltip: {
formatter: function () {
//// Use this for hover the cursor over the graph and view the 
//// F12 developer tools - console - for get the results you need:
// console.log(this); 
// read values as :
// this.y (it's the maximun value) = 965
// this.point.low (it's the minimun value) = 760
// this.point.median (it's the median value) = 848
return 'The maximun value is <b>' + this.y +
'</b> and the minimun value is <b>' + this.point.low + '</b>';
}
},

这是经过修改的jsfiddle。

最新更新