javascript - HighCharts Boost 模块和大数据集

标签 javascript highcharts

我无法对大数据集使用 HighCharts Boost 模块。当用户单击图例以启用/禁用系列元素时,它无法动态刷新绘图。删除 Boost 解决了问题---但使情节更加缓慢......当然。这是一个 Plunker,它重现了 13000 多个数据点的问题。

https://plnkr.co/edit/unpcS3Dt0Fh6dknq2ykX?p=preview

有什么问题吗?有没有人也有这个问题?

<html>

  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge;" />
    <meta http-equiv="Content-Script-Type" content="text/javascript" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="Content-Style-Type" content="text/css" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="-1" />
    <title>Demo</title>
    <script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
    <script type="text/javascript" src="https://code.highcharts.com/highcharts.js"></script>
    <script type="text/javascript" src="https://code.highcharts.com/modules/exporting.js"></script>
    <script type="text/javascript" src="https://code.highcharts.com/modules/boost.js"></script>
    <script type="text/javascript" src="dataset.js"></script>
    <script type="text/javascript">

        function hcPlot(xy, title, xlabel, ylabel) {

            $('#theplot').highcharts({
                credits: {
                    enabled: false
                },
                chart: {
                    type: 'line',
                    zoomType: 'xy'
                },
                title: {
                    text: title
                },
                yAxis: {
                    title: {
                        text: ylabel
                    },
                    gridLineWidth: 1,
                    startOnTick: true,
                    endOnTick: true,
                    labels: {
                        formatter: function () {
                            if (this.value != 0 && (this.value > 1.e4 || this.value < 1.e-4)) {
                                return this.value.toExponential();
                            } else {
                                return this.value;
                            }
                        }
                    }
                },
                xAxis: {
                    title: {
                        text: xlabel
                    },
                    gridLineWidth: 1,
                    startOnTick: true,
                    endOnTick: true,
                    labels: {
                        formatter: function () {
                            if (this.value != 0 && (this.value > 1.e4 || this.value < 1.e-4)) {
                                return this.value.toExponential();
                            } else {
                                return this.value;
                            }
                        }
                    }
                },
                plotOptions: {
                    line: {
                        lineWidth: 1
                    },
                    series: {
                        animation: false,
                        enableMouseTracking: true,
                        marker: {radius: 2},
                        //step: 'center'
                    }
                },
                tooltip: {
                    formatter: function () {
                        var x = this.x;
                        var y = this.y;
                        if (x != 0 && (x > 1.e4 || x < 1.e-4)) {
                            x = x.toExponential(6);
                        }
                        if (y != 0 && (y > 1.e4 || y < 1.e-4)) {
                            y = y.toExponential(6);
                        }
                        return '(<b>' + x + '</b>, <b>' + y + '</b>)';
                    }
                },
                series: xy
            });

        }

        $(document).ready(function () {
            var title = 'Demo';
            var xlabel = '_xlabeltochange_';
            var ylabel = '_ylabeltochange_';
            hcPlot(dataset, title, xlabel, ylabel);
        });

    </script>
  </head>

  <body>
    <div id="theplot" class="plot" style="height: calc(100vh - 60px);"></div>
  </body>

</html>

最佳答案

这很可能是 v5.0.13 中引入的错误。我在这里报告:https://github.com/highcharts/highcharts/issues/7089 .在修复之前,您可以使用旧版本(例如 v5.0.12)。

例子:
https://plnkr.co/edit/XJrfLVGSrnZ4oc3ezUfk?p=preview

关于javascript - HighCharts Boost 模块和大数据集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45811931/

相关文章:

javascript - 请帮助我防止 Bootstrap 单选按钮过早提交我的表单(使用 Javascript?)

java - XPATH - 如何从网页获取文本?

javascript - 如何设置 Highcharts 图表最大 yAxis 值

javascript - 具有 10k 数据点的数据集的 Highcharts 替代方案?

javascript - 从远程元素突出显示 Highcharts 系列

javascript - 在 highcharts 的 Y 轴上显示带下划线的标签文本

javascript - Jasmine 数据提供程序无法工作(jasmine_data_provider_1.using 不是函数)

javascript - 如何禁用 jQuery 中的重复按键

javascript - 如何在 Strapi 中发布关系

javascript - 将轴标签与刻度下的类型类别对齐