【问题标题】:HighCharts isn't workingHighCharts 不工作
【发布时间】:2016-11-18 09:31:35
【问题描述】:

我刚刚使用highcharts 创建了一个php 页面。我按照他们网站上的说明进行操作,最终无法使用图表。我不知道我的图表不起作用的原因是什么。还有关于 jquery.js 的 Jq.js,我只是重命名了它。

<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<script src="jschart/jq.js"></script>
<script src="jschart/jschart.js"></script>

<script src="jschart/esporting.js"></script>
<script type="text/javascript">

$(function () { 
    $('container')({
        chart: {
            type: 'bar'
        },
        title: {
            text: 'Fruit Consumption'
        },
        xAxis: {
            categories: ['Apples', 'Bananas', 'Oranges']
        },
        yAxis: {
            title: {
                text: 'Fruit eaten'
            }
        },
        series: [{
            name: 'Jane',
            data: [1, 0, 4]
        }, {
            name: 'John',
            data: [5, 7, 3]
        }]
    });
});
</script>

</head>
<body background="http://www.footpatrol.co.uk/templates/footpatrol.co.uk/_images//blog/_2013/adidas-Rick-Owens-Tech-Runner/adidas-Rick-Owens-Tech-Runner-10.jpg" >

<div id ="content">

	<div id="container" style="width:100%; height:400px;">asdf</div>

	<div style="width:100%" >
		<table class="tablename" border="2" style="margin: auto">
		<tr  style="font-size:30px">
			<th>NCFS</th>
			<th>NFCL</th>
			<th>MICROTOP</th>
			<th>SONION</th>
			<th>ZAMA</th>
			<th>TOYOTA</th>
		</tr>
		<tr><td>asdfasdf</td>
			<td>asdfasdf</td>
			<td>asdfasdf</td>
			<td>asdfasdf</td>
			<td>asdfasdf</td>
			<td>asdfasdf</td>
		</tr>
		</table>
	</div>


</div>
	
	
</center>
</body>
</html>

【问题讨论】:

  • 你检查过控制台吗?
  • 你缺少一个哈希值,应该是$('#container')({...
  • 哦,我检查了它
  • 仍然无法工作@Azola
  • @EarvinNillCastillo 初始化函数应该在 document.ready 函数中

标签: php html css charts highcharts


【解决方案1】:
  1. 我不确定jq.js 是不是 jquery 库。如果没有,则包括jquery library
  2. $('container') 应该是 $('#container')

【讨论】:

  • 在哪里添加新的 jquery.js
  • 如果 jq.js 不是 jquery 库,则在包含 jq.js 之前添加它
  • @EarvinNillCastillo 感谢演示。在 JS 文件中你不能添加脚本标签。无论如何,您能否给我包含的 js 文件(例如:jq.js、jschart.js 和儿子)的 url,以便我可以设置 codepen 演示?
  • 它就在我的电脑里。
  • 如果您还没有修复它,请提供您的那些JS代码
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-12-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-10-09
  • 2011-09-01
  • 1970-01-01
相关资源
最近更新 更多