I have a highStock chart in my app. this chart has 3 y-axis and 2 x-axis. I show one x-axis at bottom and the other one at the top. and splited three Y-Axis by 'height' property. And I linked yAxis[0] to xAxis[0] and the other two y-axis to second x-axis.
this is y-axis:
this.stockChartOptions.yAxis = [
{
opposite:false,
height : '32%',
title : { text :'pe' },
},
{
opposite: false,
height : '32%',
top: '34%',
title : { text : 'pe forwards' },
offset :0
},
{
opposite:false,
height : '32%',
top : '68%',
title : { text : 'pe analytical' },
offset :0
}
]
And this is x-axis:
this.stockChartOptions.xAxis = [
{
categories : [],
type : 'datetime',
opposite:true,
labels : {
rotation : -45,
formatter: function() {
return new Date(this.value).toLocaleDateString('en-US');
}
},
},
{
categories : [],
type : 'datetime',
labels : {
rotation : -45,
formatter: function() {
return new Date(this.value).toLocaleDateString('en-US');
}
},
}
]
The question is: when I write a formatter method for the tooltip, the tooltip label for the second x-axis is not attached at it's corresponding x-axis. What is the problem? and how to solve it? here is the formatter method:
this.stockChartOptions.tooltip = {
formatter: function () {
const xAxisBox = new Date(this.x).toLocaleDateString('en-US');
return ['<b>' + xAxisBox + '</b>'].concat(
this.points ?
this.points.map(item => {
return ` ${item.series.name} : ${item.y}`;
}): ['']
);
},
}
And here is an image of the problem:
EDIT: Here is a JSFiddle link which show exactly the problem: https://jsfiddle.net/avq6yd2n/28/