【发布时间】:2021-11-22 11:55:33
【问题描述】:
如何通过点击 Y 轴标签在甘特图中选择或突出显示 X 轴?
yAxis: {
className: "highcharts-color-0",
uniqueNames: true,
title: {
text: "Data"
},
labels: {
events: {
click: function () {
alert("hellowww");
const chart = this.chart;
const axis = this.axis;
const labelPos = this.pos;
const tick = axis.ticks[labelPos];
const x = chart.marginRight;
const width = tick.slotWidth;
const height = axis.height / axis.tickPositions.length;
const y = axis.top + labelPos * height;
chart.renderer
.rect(x, y, tick.slotWidth, height)
.attr({
fill: "yellow",
zIndex: 0
})
.add();
}
}
}
}
上面的代码在选择 Y 轴标签时工作正常,但我还想突出显示 X 轴中的选定行。有没有办法达到同样的效果?
码笔网址https://codepen.io/mehrotrarohit07/pen/PoKxvQp?editors=1010
【问题讨论】:
标签: angular highcharts gantt-chart highcharts-gantt