Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用highcharts(javascript)添加点_Javascript_Highcharts - Fatal编程技术网

使用highcharts(javascript)添加点

使用highcharts(javascript)添加点,javascript,highcharts,Javascript,Highcharts,我已开始使用highcharts.js,但未能在条形图中添加新点: 每次进入addPoint时,Firefox都会冻结:( 我正在使用Firebug,当它尝试添加点时,它总是冻结:( 我的问题与邮件支持中的问题相同:1)您的数据是否按x值排序?2)临时轮换id号?您试图添加多少点?您的数据看起来如何?(我指的是全部玩家和全部赌注)@ChananBerler它工作得很好。请提供更多信息,否则我们无法提供进一步帮助。 // if no graph if (! charts[0]) { //

我已开始使用highcharts.js,但未能在条形图中添加新点: 每次进入addPoint时,Firefox都会冻结:( 我正在使用Firebug,当它尝试添加点时,它总是冻结:(


我的问题与邮件支持中的问题相同:1)您的数据是否按x值排序?2)临时轮换id号?您试图添加多少点?您的数据看起来如何?(我指的是全部玩家和全部赌注)@ChananBerler它工作得很好。请提供更多信息,否则我们无法提供进一步帮助。
// if no graph
if (! charts[0])
{
    // make chart table
    var round_ids = [];
    var total_players = [];
    var total_bets = [];
    $.each(last_rounds_cache.last_rounds_data, function(index, value)
        {
            round_ids.push(Number(value[0]));
            total_players.push(Number(value[2]));
            total_bets.push(Number(value[3]));
        }
    )

    charts[0] = new Highcharts.Chart({
        chart: {
            renderTo: 'players_per_round',
            type: 'column',
            events: {
                click: function(e) {
                    // find the clicked values and the series
                    var x = e.xAxis[0].value,
                        y = e.yAxis[0].value,
                        series = this.series[0];

                    // Add it
                    series.addPoint([x, y]);

                }
            }
        },
        title: {
            text: 'Players/Bets per Round'
        },
        xAxis: {
            categories: round_ids,
        },
        yAxis: {
            min: 0,
            title: {
                text: 'Rainfall (mm)'
            }
        },
        legend: {
            layout: 'vertical',
            backgroundColor: '#FFFFFF',
            align: 'left',
            verticalAlign: 'top',
            x: 10,
            y: 10,
            floating: false,
            shadow: true
        },
        tooltip: {
            formatter: function() {
                return ''+
                    this.x +': '+ this.y;
            }
        },
        plotOptions: {
            column: {
                pointPadding: 0.2,
                borderWidth: 0
            }
        },
        series: [{
            name: 'Players',
            data: total_players
        }, {
            name: 'Bets',
            data: total_bets
        }]
    });
}
else
{
    if (newChartsPoints.length > 0)
    {


        $.each(newChartsPoints, function(index, value)
        {
            // retreive data
            var temp_round_id = value[0];
            var temp_total_players = value[1][0];
            var temp_total_bets = value[1][1];

            // add points
            var series = charts[0].series;
            series[0].addPoint([temp_round_id, temp_total_players], false);
            series[1].addPoint([temp_round_id, temp_total_bets], false);

            // add categories
            categories = charts[0].xAxis[0].categories;
            categories.push(temp_round_id);
            charts[0].xAxis[0].setCategories(categories, false);
            charts[0].redraw();
        });
    }
}