简体   繁体   English

Morris.js显示不正确

[英]Morris.js shown not correctly

I have created a graph with morris.js but it isn't shown correctly. 我已经用morris.js创建了一个图形,但是显示不正确。

在此处输入图片说明

Here is my code 这是我的代码

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});
        }

So what is the problem that i got an wrong graph? 那么我得到错误的图形是什么问题呢? My HTML implementation: 我的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>

For all people with the same problem. 对于所有有同样问题的人。

resize: true

Helped me out. 帮助我。 Set it to true (default: false) when you create your Morris graph. 创建Morris图时,将其设置为true(默认值:false)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM