我遇到了高图问题,当我改变鼠标时,工具提示没有正确地更改为所选点,
如果有人提出建议,那就太好了,这是我的代码
document.body.style.zoom=0.7;
Highcharts.chart('container', {
chart: {
type: 'line',
width: 300
},
title: {
text: 'Width is set to 300px'
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}]
});
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/series-label.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>
<div id="container"></div>
答案 0 :(得分:1)
请在github:https://github.com/highcharts/highcharts/issues/1753上查看有关此问题的讨论。要解决此问题,您可以使用normalize
方法包装来更正 chartX 和 chartY 属性:
document.body.style.zoom = 0.7;
(function(H) {
H.wrap(H.Pointer.prototype, 'normalize', function(proceed, e) {
var e = proceed.call(this, e),
zoom;
zoom = Number(document.body.style.zoom);
e.chartX /= zoom;
e.chartY /= zoom;
return e;
});
}(Highcharts));
答案 1 :(得分:0)
我发现问题是document.body.style.zoom=0.7;
当我删除它时,图表会很好