2015-12-08 77 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)。