如何在 highchart 的箱形图中显示时间?
How to show time in box chart in highchart?
请在 Highcharts 选项中推荐下图示例?
enter image description here
您可以使用气泡系列类型和 Highcharts.SVGRenderer
class。
events: {
load: function() {
var xAxis = this.xAxis[0],
yAxis = this.yAxis[0],
x1 = xAxis.toPixels(1),
y1 = yAxis.toPixels(6),
x2 = xAxis.toPixels(1),
y2 = yAxis.toPixels(2),
x3 = xAxis.toPixels(2),
y3 = yAxis.toPixels(4),
x4 = xAxis.toPixels(2),
y4 = yAxis.toPixels(8);
this.renderer.path([
'M', x1, y1,
'L', x2, y2,
'Q', x2 + (x3 - x2) / 2, y2 + (y3 - y2) / 2 - 20, x3, y3,
'L', x4, y4,
'Q', x1 + (x4 - x1) / 2, y1 + (y4 - y1) / 2 - 20, x1, y1
])
.attr({
'stroke-width': 2,
stroke: 'red',
'stroke-dasharray': [5, 5]
})
.add();
}
}
现场演示: https://jsfiddle.net/BlackLabel/wk8p9vhc/
关于SVG路径: https://www.w3schools.com/graphics/svg_path.asp
API参考:
https://api.highcharts.com/highcharts/series.bubble
https://api.highcharts.com/class-reference/Highcharts.Axis#toPixels
请在 Highcharts 选项中推荐下图示例?
enter image description here
您可以使用气泡系列类型和 Highcharts.SVGRenderer
class。
events: {
load: function() {
var xAxis = this.xAxis[0],
yAxis = this.yAxis[0],
x1 = xAxis.toPixels(1),
y1 = yAxis.toPixels(6),
x2 = xAxis.toPixels(1),
y2 = yAxis.toPixels(2),
x3 = xAxis.toPixels(2),
y3 = yAxis.toPixels(4),
x4 = xAxis.toPixels(2),
y4 = yAxis.toPixels(8);
this.renderer.path([
'M', x1, y1,
'L', x2, y2,
'Q', x2 + (x3 - x2) / 2, y2 + (y3 - y2) / 2 - 20, x3, y3,
'L', x4, y4,
'Q', x1 + (x4 - x1) / 2, y1 + (y4 - y1) / 2 - 20, x1, y1
])
.attr({
'stroke-width': 2,
stroke: 'red',
'stroke-dasharray': [5, 5]
})
.add();
}
}
现场演示: https://jsfiddle.net/BlackLabel/wk8p9vhc/
关于SVG路径: https://www.w3schools.com/graphics/svg_path.asp
API参考:
https://api.highcharts.com/highcharts/series.bubble
https://api.highcharts.com/class-reference/Highcharts.Axis#toPixels