2014-09-21 56 views
0

我有一个非常简单的问题为圆环图jqPlot传说不显示颜色色板/盒

代码:

$(document).ready(function(){ 
    var s1 = [['Status',600], ['Pictures',800], ['Starred',140], ['Comments',200]]; 
    //var s2 = [['a', 8], ['b', 12], ['c', 6], ['d', 9]]; 

    var plot3 = $.jqplot('chart3', [s1], { 
    seriesDefaults: { 
     // make this a donut chart. 
     renderer:$.jqplot.DonutRenderer, 
     rendererOptions:{ 
     // Donut's can be cut into slices like pies. 
     sliceMargin: 3, 
     // Pies and donuts can start at any arbitrary angle. 
     startAngle: -90, 
     showDataLabels: true, 
     // By default, data labels show the percentage of the donut/pie. 
     // You can show the data 'value' or data 'label' instead. 
     dataLabels: 'label' 
     } 
    }, 

    grid: { 
    drawGridLines: true,  // wether to draw lines across the grid or not. 
     // *Color of the grid lines. 
    background: 'white',  // CSS color spec for background color of grid. 
    borderColor: 'white',  // CSS color spec for border around grid. 
     shadow: false  
    } ,legend: { show:true, location: 'e' }  

    }); 
}); 

现在的传说确实出现,但不是在某种程度上,它应该是出现像这样.. enter image description here

没有颜色,没有框。我究竟做错了什么。我按照文件说过的..任何人?

+0

对我来说,它的工作检查http://jsfiddle.net/devmgs/1xcn4bf5/你可以检查控制台,如果您的设置发生任何错误 – dev 2014-09-22 05:09:23

回答

0

当您忘记包含jqPlot CSS文件时会发生这种情况。

确保你已经包括<link rel="stylesheet" href="https://bitbucket.org/cleonello/jqplot/raw/b5a7796a9ebf/src/jquery.jqplot.css" type="text/css"/>

然后事情应该制定出适合您。

那么,如果您已经包含jqPLot CSS文件,那么我们将不得不检查它,并发现问题。

希望它有帮助。