gpt4 book ai didi

javascript - Morris.js 显示不正确

转载 作者:行者123 更新时间:2023-11-28 06:37:21 26 4
gpt4 key购买 nike

我已经用 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>

最佳答案

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

resize: true

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

关于javascript - Morris.js 显示不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34157948/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com