首页 文章

具有实时更新系列的高图阈值颜色

提问于
浏览
0

我是'm trying to apply the new threshold/negativeColor features of Highcharts v3.0.2 to essentially the ' spline updating each second'的例子 .

在图表更新的动画期间,我在系列行中看到了奇怪的工件 - 它看起来像是动画到一组不同的控制点......然后它在动画(新数据)时快速恢复到正确的配置点进来)完成了 .

注释掉threshold / negativeColor功能会使这个视觉神器消失 .

我看到了一个bug吗?

更新:我发布以下代码作为示例,这是我添加的阈值/颜色/负色线(系列下的第一行)的股票高图演示(我的本地jquery是v1.10.2) . 这段代码看似行为不端 .

<html>
<head>
<script src="js/jquery.min.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>

<script>
$(function () {
    $(document).ready(function() {
        Highcharts.setOptions({
            global: {
                useUTC: false
            }
        });

        var chart;
        $('#container').highcharts({
            chart: {
                type: 'spline',
                animation: Highcharts.svg, // don't animate in old IE
                marginRight: 10,
                events: {
                    load: function() {

                        // set up the updating of the chart each second
                        var series = this.series[0];
                        setInterval(function() {
                            var x = (new Date()).getTime(), // current time
                                y = Math.random();
                            series.addPoint([x, y], true, true);
                        }, 1000);
                    }
                }
            },
            title: {
                text: 'Live random data'
            },
            xAxis: {
                type: 'datetime',
                tickPixelInterval: 150
            },
            yAxis: {
                title: {
                    text: 'Value'
                },
                plotLines: [{
                    value: 0,
                    width: 1,
                    color: '#808080'
                }]
            },
            tooltip: {
                formatter: function() {
                        return '<b>'+ this.series.name +'</b>
'+ Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) +'
'+ Highcharts.numberFormat(this.y, 2); } }, legend: { enabled: false }, exporting: { enabled: false }, series: [{ threshold: 0.5, color: '#FF0000', negativeColor: '#00FF00', name: 'Random data', data: (function() { // generate an array of random data var data = [], time = (new Date()).getTime(), i; for (i = -19; i <= 0; i++) { data.push({ x: time + i * 1000, y: Math.random() }); } return data; })() }] }); }); }); </script> </head> <body> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>

1 回答

  • 0

    事实上它看起来像一个臭虫,据报道here . 此时您只能禁用动画 .

相关问题