我刚刚发现了 xCharts 并尝试从官方页面的文档中自己学习它。我已将以下代码应用于基本显示,以便稍后可以使用此图表,但图表根本没有显示在图中。有任何想法吗?谢谢。
我的代码:
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<figure style="width: 300px; height: 300px" id="myChart"></figure>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="js/d3.js"></script>
<script src="js/xcharts.css"></script>
<script src="js/xcharts.js">
var data = {
"xScale": "ordinal",
"yScale": "linear",
"type": "bar",
"main": [
{
"className": ".pizza",
"data": [
{
"x": "Pepperoni",
"y": 12
},
{
"x": "Cheese",
"y": 8
}
]
}
],
"comp": [
{
"className": ".pizza",
"type": "line-dotted",
"data": [
{
"x": "Pepperoni",
"y": 10
},
{
"x": "Cheese",
"y": 4
}
]
}
]
};
var myChart = new xChart('bar',datai,'#myChart');
</script>
<?php
// put your code here
?>
</body> </html>