在阅读Highcharts中的json文件时没有输出 [英] No output while reading json file in Highcharts

查看:92
本文介绍了在阅读Highcharts中的json文件时没有输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读json文件

http://www.megafileupload.com/dq4u/data.json

 < html> 
< head>
< script type ='text / javascript'src ='http://code.jquery.com/jquery-1.9.1.js'>< / script>
< script src =http://code.highcharts.com/stock/highstock.js>< / script>
< script src =http://code.highcharts.com/stock/highchart.js>< / script>
< script>

$(document).ready(function(){

var options = {
chart:{
renderTo:'container',
type:'heatmap'
},
title:{
text:'pairwise LD'
},

xAxis:{
类:['A','B','C','D','E','F','G','H','I','J']
},

yAxis:{
categories:['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],
title:null
},

colorAxis:{
min:0,
minColor:'#FFFFFF',
maxColor:Highcharts.getOptions()。colors [ 0]
},

图例:{
align:'right',
layout:'vertical',
margin:0,
verticalAlign:'top',
y:25,
symbolHeight:280
},
plotOptions:{
series:{
turboThreshold:0
}
},
系列:[{}]
};

$ .getJSON('data.json',function(data){
options.series [0] .data = data;
var chart = new Highcharts.Chart(选项);
});

});

< / script>
< / head>
< body>
< div id =container>< / div>
< / body>
< / html>

但是,当我在代码中粘贴相同的值时,没有输出可以看到输出。请帮助我如何解决这个问题?

解决方案

在图表中,您使用的heatmap不是内置的highstock核心,因此您需要添加对 http://code.highcharts.com/modules/heatmap.js



我建议你运行一个控制台( https://developer.chrome.com/devtools/docs/console ),其中所有错误都与描述一起返回,那么您就避免了上述问题。


I am reading a json file

http://www.megafileupload.com/dq4u/data.json

<html>
<head>
    <script type='text/javascript' src='http://code.jquery.com/jquery-1.9.1.js'></script>
    <script src="http://code.highcharts.com/stock/highstock.js"></script>
        <script src="http://code.highcharts.com/stock/highchart.js"></script>
    <script>

   $(document).ready(function() {

    var options = {
        chart: {
            renderTo: 'container',
            type: 'heatmap'
        },
          title: {
            text: 'pairwise LD'
        },

        xAxis: {
            categories: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J']
        },

        yAxis: {
            categories: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
            title: null
        },

        colorAxis: {
            min: 0,
            minColor: '#FFFFFF',
            maxColor: Highcharts.getOptions().colors[0]
        },

        legend: {
            align: 'right',
            layout: 'vertical',
            margin: 0,
            verticalAlign: 'top',
            y: 25,
            symbolHeight: 280
        },
        plotOptions:{
                   series:{
                          turboThreshold: 0
                          }
        },
        series: [{}]
    };

    $.getJSON('data.json', function(data) {
        options.series[0].data = data;
        var chart = new Highcharts.Chart(options);
    });

});

</script>
</head>
<body>
<div id="container"></div>
</body>
</html>

But there is no output while when i paste the same values in the code i can see the output. Pls help me how can i fix this issue?

解决方案

In you chart you use heatmap which is not build-in highstock core, so you need add a reference to http://code.highcharts.com/modules/heatmap.js.

I advice you to run a console (https://developer.chrome.com/devtools/docs/console), where all errors are returned with description, then you avoid a problems like above.

这篇关于在阅读Highcharts中的json文件时没有输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆