Morris.js显示不正确

时间:2015-12-08 14:06:17

标签: javascript css charts 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>

1 个答案:

答案 0 :(得分:0)

对于遇到同样问题的所有人。

resize: true

帮助我。在创建Morris图时将其设置为true(默认值:false)。