gpt4 book ai didi

jquery - 堆叠条形图 + Highcharts 中所选系列的边框

转载 作者:行者123 更新时间:2023-11-28 08:22:28 25 4
gpt4 key购买 nike

我正在使用 High 图表来呈现堆积条形图。

当用户点击特定系列时,如何在 Stacked Bar Chart 上获取边框?我尝试了 ma​​rker 选项,但它只选择了一个系列,但我希望选择整个系列。

目前我是这样的:-

但是,我想要这样:-

enter image description here

最佳答案

您可以使用渲染器在后台添加这样的矩形:http://jsfiddle.net/3Utat/25/

    mouseOver: function () {
var chart = this.series.chart,
r = chart.renderer,
shape = this.shapeArgs, // shape args for the points rect element
xAxis = this.series.xAxis,
yAxis = this.series.yAxis,
y = yAxis.toPixels(this.total), // top left y-position of the rect
x = this.plotX + chart.plotLeft - shape.width / 2, // point position + left offset + half width
height = yAxis.toPixels(yAxis.min) - y; // bottom - top

if (chart.hoverStack) {
chart.hoverStack.destroy();
}

chart.hoverStack = r.rect(x, y, shape.width, height).attr({
'stroke-width': 6, //border width
'stroke': 'black', //border color
'fill': 'transparent' //transparent fill color
}).add();

},
mouseOut: function () {
if (this.series.chart.hoverStack) {
this.series.chart.hoverStack.destroy();
this.series.chart.hoverStack = false;
}
}

示例是使用 mouseOvermouseOut 事件,但在您的情况下,您可以改用 click 事件。

关于jquery - 堆叠条形图 + Highcharts 中所选系列的边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28692598/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com