I have a scatter chart which is made using Highcharts and when I hover on each data points I am showing another chart inside the tooltip. when I hover on the tooltip about halfway from middle to top the tooltip is getting closed. also when I hover on the chart inside the tool tip the chart keeps re rendering. Please fnd attached code.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="https://code.highcharts.com/stock/highstock.js"></script>
<script src="https://code.highcharts.com/stock/modules/accessibility.js"></script>
</head>
<body>
<div id="scatter_container" style="height: 90vh;"></div>
<script>
function renderChart(point) {
(async () => {
const data = await fetch(
'https://demo-live-data.highcharts.com/aapl-c.json'
).then(response => response.json());
// Create the chart
Highcharts.stockChart('hc-tooltip', {
rangeSelector: {
selected: 1
},
title: {
text: 'AAPL Stock Price'
},
series: [{
name: 'AAPL',
data: data,
tooltip: {
valueDecimals: 2
}
}]
});
})();
}
Highcharts.addEvent(
Highcharts.Tooltip,
'refresh',
function () {
renderChart(this.chart.hoverPoint);
}
);
const series = [{
name: 'Basketball',
id: 'basketball',
marker: {
symbol: 'circle',
width: 32,
height: 32
}
}];
async function getData() {
// const response = await fetch(
// 'https://www.highcharts.com/samples/data/olympic2012.json'
// );
const response = await fetch('https://api.jsonbin.io/v3/qs/65b8d298dc746540189dacb7');
return response.json();
}
getData().then(data => {
const getData = sportName => {
const temp = [];
data.record.forEach(elm => {
// if (elm.sport === sportName && elm.weight > 0 && elm.height > 0) {
temp.push([elm.height, elm.weight]);
// }
});
return temp;
};
series.forEach(s => {
s.data = getData(s.id);
});
Highcharts.chart('scatter_container', {
chart: {
type: 'scatter',
zoomType: 'xy'
},
title: {
text: 'Olympics athletes by height and weight',
align: 'left'
},
subtitle: {
text:'',
align: 'left'
},
xAxis: {
title: {
text: 'Height'
},
labels: {
format: '{value} m'
},
startOnTick: true,
endOnTick: true,
showLastLabel: true
},
yAxis: {
title: {
text: 'Weight'
},
labels: {
format: '{value} kg'
}
},
legend: {
enabled: true
},
plotOptions: {
series: {
stickyTracking: false
},
scatter: {
marker: {
radius: 2.5,
symbol: 'circle',
states: {
hover: {
enabled: true,
lineColor: 'rgb(100,100,100)'
}
}
},
states: {
hover: {
marker: {
enabled: false
}
}
},
jitter: {
x: 0.005
}
}
},
credits:{
enabled:false
},
tooltip: {
shared: true,
split: true,
stickOnContact: true,
useHTML: true,
headerFormat: '',
pointFormat: '<div id="hc-tooltip" style="width:320px;height:45vh;"></div>'
},
series
});
});
</script>
</body>
</html>
what I am doing wrong?

