2014-11-21 37 views
0

我設法得到一個基本的xChart工作。雖然,它返回一些黑色的屏幕,而不是我想要的圖形。我已經包含了所有的需求,比如d3.js和所有的xCharts的JS。我的代碼和輸出繼電器如下:JavaScript - 黑圖由xCharts

<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> 

enter image description here

任何人有這件事,如何解決它的任何想法?

回答

-2

我想你簡直忘了引用CSS庫。類似於:

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

指向您已經存儲文件的位置可能會訣竅。