高图工具提示不跟随鼠标

问题描述 投票:0回答:2

我遇到了高图问题,当我更改鼠标时,工具提示未正确更改为所选点,

如果有人有建议会很好谢谢,这里是我的代码

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>
javascript jquery highcharts
2个回答
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));

现场演示:http://jsfiddle.net/BlackLabel/dnzqum5j/


0
投票

我发现问题是document.body.style.zoom=0.7;

当我删除它,图表工作得很好

© www.soinside.com 2019 - 2024. All rights reserved.