2013-03-05 74 views
0

我有JQPlot的問題,我設法在我的圖表中顯示條形,但由於某些原因線條沒有繪製。JQPlot只顯示條形圖,但不畫線

你可以看到的jsfiddle代碼(沒有在Internet Explorer的工作): http://jsfiddle.net/gkp2N/

如果我改變「seriesDefaults」到「系列」,它顯示兩行,但不抽吧。我花了兩個小時弄清楚這個希望有人能幫助我,謝謝!

這裏是JS代碼:

var s1 = [ 
    ['2013-02-04 4:00PM', 11], 
    ['2013-02-05 4:00PM', 11], 
    ['2013-02-06 4:00PM', 15], 
    ['2013-02-07 4:00PM', 12], 
    ['2013-02-08 4:00PM', 16], 
    ['2013-02-09 4:00PM', 7], 
    ['2013-02-10 4:00PM', 9], 
    ['2013-02-11 4:00PM', 6], 
    ['2013-02-12 4:00PM', 13], 
    ['2013-02-13 4:00PM', 12], 
    ['2013-02-14 4:00PM', 6], 
    ['2013-02-15 4:00PM', 13], 
    ['2013-02-16 4:00PM', 3], 
    ['2013-02-17 4:00PM', 9], 
    ['2013-02-18 4:00PM', 18], 
    ['2013-02-19 4:00PM', 18], 
    ['2013-02-20 4:00PM', 12], 
    ['2013-02-21 4:00PM', 14], 
    ['2013-02-22 4:00PM', 7], 
    ['2013-02-23 4:00PM', 5], 
    ['2013-02-24 4:00PM', 3], 
    ['2013-02-25 4:00PM', 9], 
    ['2013-02-26 4:00PM', 15], 
    ['2013-02-27 4:00PM', 14], 
    ['2013-02-28 4:00PM', 4], 
    ['2013-03-01 4:00PM', 0], 
    ['2013-03-02 4:00PM', 0], 
    ['2013-03-03 4:00PM', 0], 
    ['2013-03-04 4:00PM', 0], 
    ['2013-03-05 4:00PM', 0] 
]; 



var s2 = [ 
    ['2013-02-04 4:00PM', 55], 
    ['2013-02-05 4:00PM', 55], 
    ['2013-02-06 4:00PM', 75], 
    ['2013-02-07 4:00PM', 60], 
    ['2013-02-08 4:00PM', 80], 
    ['2013-02-09 4:00PM', 35], 
    ['2013-02-10 4:00PM', 45], 
    ['2013-02-11 4:00PM', 30], 
    ['2013-02-12 4:00PM', 65], 
    ['2013-02-13 4:00PM', 60], 
    ['2013-02-14 4:00PM', 30], 
    ['2013-02-15 4:00PM', 65], 
    ['2013-02-16 4:00PM', 15], 
    ['2013-02-17 4:00PM', 45], 
    ['2013-02-18 4:00PM', 90], 
    ['2013-02-19 4:00PM', 90], 
    ['2013-02-20 4:00PM', 60], 
    ['2013-02-21 4:00PM', 70], 
    ['2013-02-22 4:00PM', 35], 
    ['2013-02-23 4:00PM', 25], 
    ['2013-02-24 4:00PM', 15], 
    ['2013-02-25 4:00PM', 45], 
    ['2013-02-26 4:00PM', 75], 
    ['2013-02-27 4:00PM', 70], 
    ['2013-02-28 4:00PM', 20], 
    ['2013-03-01 4:00PM', 0], 
    ['2013-03-02 4:00PM', 0], 
    ['2013-03-03 4:00PM', 0], 
    ['2013-03-04 4:00PM', 0], 
    ['2013-03-05 4:00PM', 0] 
]; 
var plot = $.jqplot('placeholder', [s1, s2], { 

    // Turns on animatino for all series in this plot. 
    animate: true, 
    // Will animate plot on calls to plot1.replot({resetAxes:true}) 
    animateReplot: true, 
    cursor: { 
     show: true, 
     zoom: true, 
     looseZoom: true, 
     showTooltip: false 
    }, 

    seriesColors: ["#eee", "#ccc"], 
    highlighter: { 
     show: true, 
     showLabel: true, 
     tooltipAxes: 'y', 
     sizeAdjust: 7.5, 
     tooltipLocation: 'ne' 
    }, 

    seriesDefaults: { 
     renderer: $.jqplot.BarRenderer, 
     xaxis: 'xaxis', 
     yaxis: 'yaxis', 
     rendererOptions: { 
      // Speed up the animation a little bit. 
      // This is a number of milliseconds. 
      // Default for bar series is 3000. 
      animation: { 
       speed: 2500 
      }, 
      barWidth: 15, 
      barPadding: -15, 
      barMargin: 0, 
      highlightMouseOver: false 

     } 
    }, 
    axesDefaults: { 
     tickRenderer: $.jqplot.CanvasAxisTickRenderer, 
     tickOptions: { 
      angle: 30 
     }, 
     showTicks: false 
    }, 
    axes: { 
     xaxis: { 
      renderer: $.jqplot.DateAxisRenderer, 
      tickInterval: '1 day' 

     }, 
     x2axis: { 
      renderer: $.jqplot.DateAxisRenderer 
     } 

    } 


}); 

回答

1

不要忘了包括插件需要(barRenderer):

<script class="include" src=" http://www.jqplot.com/deploy/dist/plugins/jqplot.barRenderer.min.js"></script>

編輯

工作實例on Fiddle

+0

嗨, 我檢查了你的小提琴,但它沒有顯示圖表,如果我按「運行」。 – 2013-03-07 17:24:27

+0

我編輯了我的回覆:參見[更新的小提琴](http://jsfiddle.net/gkp2N/6/)(外部資源已經改變爲jqplot中的哪些資源似乎無法在任何時候工作新的資源來自bitbuckets。 CLeonello是 - 我認爲 - jqplot的開發人員之一) – AnthonyLeGovic 2013-03-08 07:18:39