Highcharts不显示柱形图

时间:2016-04-16 07:26:18

标签: javascript highcharts

过去几个小时我一直试图让我的Highcharts加载。

一切似乎都是正确的。在Highcharts参考之前我有Jquery。

Chrome浏览器中的控制台没有错误。

我希望它看起来像这样(工作JQuery) Working Jquery

Side

以下是JSfiddle - Not working

谢谢你的帮助!

2 个答案:

答案 0 :(得分:2)

你不工作小提琴有两个问题:

首先,所有脚本都包含2次,包括html部分和JSfiddle的public class persontest{ public static void main(String[] args){ //Part 1 Person p2 = new Person("p2 Ryan", 19920604); p2.print(p2); // Here super class variable p2 is holding super class object. Hence print() method of Person class will be called which is indirectly calling toString() of Person class only //Test 1 p2-->Student p2=new Student();// It means Super class variable P2 is now holding subclass Student object. //It means now whenever we try to call a method, it will first check whether it is available in subclass or not // if available it will be called, if not available, it will check in superclass for same method p2.print(p2); //which 'toString' should be called?? // Now as you called print(p2)-> JVM will check whether a print method with one parameter is available in Student class or not? // As per your code it is not available, then it will check if Print method with one parameter is available in super class. It is available // Hence super class print method will be called. As there it is calling toString() which is available in that class only //hence Person class toString will be called //1.If p2 is now a Student Why can't invoke Student's print()? (Uncomment 'p2.print()') 工具。您需要删除外部资源或删除External resource代码。

其次,在您的javascript <script>的第一行,您错过了结束var chart_id = 'chart_id';之前的chart_id,让JQuery知道它是您正在引用的ID。

#是你想要的。

Working JSfiddle

答案 1 :(得分:1)

原始样本的HTML代码:

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>

<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>

包含您数据的Javascript代码:

$(function () {
    $('#container').highcharts({
        title: {
            text: '123456 Tool life by Location'
        },
        xAxis: {
            categories: ['T01', 'T02']
        },
        labels: {
            items: [{
                html: 'Some text',
                style: {
                    left: '50px',
                    top: '18px',
                    color: (Highcharts.theme && Highcharts.theme.textColor) || 'black'
                }
            }]
        },
        series: [{'data': [211, 550], 'type': 'column', 'name': 'Average'}]
    });
});

结果:http://jsfiddle.net/logual/9gpw688e/1/

enter image description here