2015-12-08 74 views
1

我用morris.js創建了一個圖表,但沒有正確顯示。Morris.js顯示不正確

enter image description here

這裏是我的代碼

initChart: function(){ 
      console.log('go! '); 
      var graphchart = document.createElement('div'); 
      graphchart.setAttribute('id','graphchart'); 
      graphchart.style.height = '200px'; 
      graphchart.style.width = '500px'; 

      new Morris.Line({ 

      element: graphchart, 
      data: [ 
       { y: '2006', a: 100, b: 90 ,c:50}, 
       { y: '2007', a: 75, b: 65 ,c:50}, 
       { y: '2008', a: 50, b: 40 ,c:50}, 
       { y: '2012', a: 100, b: 90 ,c:50} 
      ], 
      xkey: 'y', 
      ykeys: ['a', 'b','c'], 
      labels: ['Value1','Value2','Value3'] 
      }); 
      this.fire('my-devicelist-chart-created',{graph: graphchart}); 
     } 

那麼,什麼是我得到了一個錯誤的圖表中的問題? 我的HTML實現:

<style> 

    </style> 

    <div y-scroll fit id="myfirstchart"> 

     <paper-button on-tap="{{initStart}}"> 
     <core-icon icon="chevron-right" class="icon"></core-icon> 
     <span>{{language.test}}</span> 
     </paper-button> 

    </div> 

    </div> 
+0

你爲什麼認爲這是錯的?你在期待什麼? –

+0

看第一張圖,圖的線條不正確。 x軸未顯示。 –

回答

0

對於同樣的問題,所有的人。

resize: true 

幫我一把。創建Morris圖形時將其設置爲true(默認值:false)。