Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/427.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
JavaScript-xCharts的黑图_Javascript_Html_Web_Graph_Xcharts - Fatal编程技术网

JavaScript-xCharts的黑图

JavaScript-xCharts的黑图,javascript,html,web,graph,xcharts,Javascript,Html,Web,Graph,Xcharts,我设法得到了一份基本的xChart工作。虽然,它返回一些黑屏,而不是我想要的图形。我已经包括了所有需求,比如d3.js和所有xCharts的js。我的代码和输出如下: <html> <head> <meta charset="UTF-8"> <title></title> </head> <body> <figure style="w

我设法得到了一份基本的xChart工作。虽然,它返回一些黑屏,而不是我想要的图形。我已经包括了所有需求,比如d3.js和所有xCharts的js。我的代码和输出如下:

<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>

        <figure style="width: 400px; 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"></script>
        <script type="text/javascript">
            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', data, '#myChart');
        </script>
        <?php
        // put your code here
        ?>
    </body>
</html>

风险值数据={
“xScale”:“序号”,
“yScale”:“线性”,
“类型”:“条”,
“主要”:[
{
“类名”:“.pizza”,
“数据”:[
{
“x”:“意大利香肠”,
“y”:12
},
{
“x”:“奶酪”,
“y”:8
}
]
}
],
“公司”:[
{
“类名”:“.pizza”,
“类型”:“虚线”,
“数据”:[
{
“x”:“意大利香肠”,
“y”:10
},
{
“x”:“奶酪”,
“y”:4
}
]
}
]
}
var myChart=new xChart('bar',data',#myChart');


有人对此有什么想法以及如何修复它吗?

我想你只是忘记了引用CSS库。比如:

<link href="xcharts.css" rel="stylesheet">

指向文件的存放位置可能会奏效