[我正在尝试用两个Highcharts
实现一个timeline
xAxis
图表-一种类型为timeline
,另一种类型为datetime
显示相同的数据。我设法做到了,但是我在dataLabels
上的timeline xAxis
位置上遇到了麻烦。
alternate: false
,但我希望它们显示在xAxis
的顶部,而不是在下面-这显然是alternate: false
的默认行为。xAxis
链接在一起-当用户将鼠标悬停在xAxis
之一上的一个点上时,该点应在两个轴上突出显示。timeline
轴上放大框的高度并在框内显示dataLabels
?下面您可以看到当前版本的屏幕截图和jsFiddle
实时演示:
distance
属性设置为某个负值series: [{
dataLabels: {
alternate: false,
distance: -90
},
...
}, ...]
state
属性中的外观。使用mouseOver
和mouseOut
事件连接点,并使用setState
方法更改其状态。plotOptions: {
series: {
states: {
inactive: {
opacity: 1
}
},
marker: {
states: {
hover: {
fillColor: 'red'
}
}
},
point: {
events: {
mouseOver: function() {
var secondSeriesI = this.series.index ? 0 : 1,
secondSeries = this.series.chart.series[secondSeriesI];
secondSeries.points[this.index].setState('hover');
},
mouseOut: function() {
var secondSeriesI = this.series.index ? 0 : 1,
secondSeries = this.series.chart.series[secondSeriesI];
secondSeries.points[this.index].setState('');
}
}
}
}
}
marker.height
属性中的值:series: [{
dataLabels: {
alternate: false,
distance: 0,
marker: {
height: 150
}
},
...
}, ...]
实时演示: https://jsfiddle.net/BlackLabel/g2zn1p63/
API参考:
https://api.highcharts.com/highcharts/series.timeline.marker
https://api.highcharts.com/highcharts/series.timeline.marker.states.hover
https://api.highcharts.com/highcharts/series.timeline.states.inactive
https://api.highcharts.com/class-reference/Highcharts.Point#setState
https://api.highcharts.com/highcharts/series.timeline.dataLabels.distance