Javascript 在$getJSON之前创建的HighChart

Javascript 在$getJSON之前创建的HighChart,javascript,jquery,json,highcharts,Javascript,Jquery,Json,Highcharts,我正在使用HighCharts制作一个包含列、向下展开系列和散点的图形。我遇到的问题是,HighChart是在成功退出$.getJSON函数之前创建的。我还发现了其他几篇文章,但还没有找到调用两个$.getJSON函数的地方。我正在使用的代码: $(function () { // Create the chart var options = { chart: { renderTo: 'container_genomefraction',

我正在使用HighCharts制作一个包含列、向下展开系列和散点的图形。我遇到的问题是,HighChart是在成功退出$.getJSON函数之前创建的。我还发现了其他几篇文章,但还没有找到调用两个$.getJSON函数的地方。我正在使用的代码:

$(function () {

    // Create the chart
    var options = {
        chart: {
            renderTo: 'container_genomefraction',
            type: 'column',
            events: {
                // Declare the events changing when the drilldown is activated
                drilldown: function(options) {
                    this.yAxis[0].update({
                        labels: {
                            format: '{value}'
                        },
                        title: {text : "Gbp"}
                    }, false, false);

                    options.seriesOptions.dataLabels = {
                        format: '{point.y:.1f}'
                    };

                    options.seriesOptions.tooltip = {
                        pointFormat: '<span style="color:{point.color}">{point.name}</span>: <b>{point.y:.2f}</b> of total<br/>'
                    };
                },
                // Declare the events changing when the drillup is activated
                drillup: function () {
                    this.yAxis[0].update({
                        labels: {
                            format: '{value}%'
                        },
                        title: {text : "Percentages"}
                    }, false, false);
                }
            }
        },
        title: {
            text: 'Comparison'
        },
        xAxis: {
            type: 'category'
        },
        yAxis: [{
            title: {
                enabled: true,
                text: 'Percentages',
                style: {
                    fontWeight: 'normal'
                }
            },
            labels: {
                format: '{value}%'
            }
        },{
            min: 0,
            title :{
                text : 'input'
            },
            labels: {
                format : '{value}'
            },
            opposite: true

        }],
        legend: {
            enabled: false
        },

        plotOptions: {
            series: {
                marker: {
                    fillColor: '#FFFFFF',
                    lineWidth: 2,
                    lineColor: null, // inherit from series
                    size : 50
                },
                borderWidth: 0,
                dataLabels: {
                    enabled: true,
                    format: '{point.y:.1f}%'
                }
            }
        },
        tooltip: {
            headerFormat: '<span style="font-size:11px">{series.name}</span><br>',
            pointFormat: '<span style="color:{point.color}">{point.name}</span>: <b>{point.y:.2f}%</b> of total<br/>'

        },

        // Declare an empty series
        series: [{
            name: '',
            colorByPoint: true,
            data: []
        }],
        credits: {
            enabled: false
        },
        // Declare an empty drilldown series
        drilldown: {
            series: [{
                name : '',
                id: '',
                data: []
            }]
        }
    };
    // Your $.getJSON() request is now synchronous...
    $.ajaxSetup({
        async: false
    });

    // Get the input into one series
    $.getJSON('/uploads/fraction.json', function (list) {
        options.series = list;

    });
    // Get the drilldown estimated and total size into one series
    $.getJSON('/uploads/drilldown.json', function (list2) {
        options.drilldown.series = list2;
        var chart = new Highcharts.Chart(options);
    });  

    $.ajaxSetup({
        async: true
    });
}); 

加载页面时,图形将显示上一次搜索完成的值,当我重新加载页面时,将显示正确的数据。有人能帮我吗

在第一个getJSON成功回调中添加第二个getJSON方法,如下所示:

//Get the genome fraction into one series
$.getJSON('/uploads/fraction.json', function (list) {
    options.series = list;

    //Get the drilldown estimated and total genome size into one series
    $.getJSON('/uploads/drilldown.json', function (list2) {
      options.drilldown.series = list2;
      var chart = new Highcharts.Chart(options);
    });  
});

在第一个getJSON成功回调中添加第二个getJSON方法,如下所示:

//Get the genome fraction into one series
$.getJSON('/uploads/fraction.json', function (list) {
    options.series = list;

    //Get the drilldown estimated and total genome size into one series
    $.getJSON('/uploads/drilldown.json', function (list2) {
      options.drilldown.series = list2;
      var chart = new Highcharts.Chart(options);
    });  
});

尝试将第二个getJSON移动到第一个getJSON成功回调中,并在前后删除ajaxSetup。尝试在
$中设置
缓存:false
。ajaxSetup({})
?尝试将第二个getJSON移动到第一个getJSON成功回调中,并在之前和之后删除ajaxSetup。尝试在
$中设置
缓存:false
。ajaxSetup({})
?不知道这会解决问题!非常感谢!不知道这会解决问题!非常感谢!
//Get the genome fraction into one series
$.getJSON('/uploads/fraction.json', function (list) {
    options.series = list;

    //Get the drilldown estimated and total genome size into one series
    $.getJSON('/uploads/drilldown.json', function (list2) {
      options.drilldown.series = list2;
      var chart = new Highcharts.Chart(options);
    });  
});