首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何设置较大的负值以在莫里斯条形图中显示较短的条形图?

如何设置较大的负值以在莫里斯条形图中显示较短的条形图?
EN

Stack Overflow用户
提问于 2018-06-06 14:23:48
回答 1查看 239关注 0票数 1

看一下这个jsfiddle link

我将使用此图表显示欠购量,那么如何在图表中设置-20比-50更短的条形图?

-60甚至没有显示在图表上。

如果我取消注释//,{ material: '', value: 0, vendor: '' },那么图表将根据我的要求正确显示,但这不是我要找的修复程序。

我的图表将只包含负值,我如何解决这个问题?

代码语言:javascript
运行
复制
new Morris.Bar({
    // ID of the element in which to draw the chart.
    element: 'myfirstchart',
    // Chart data records -- each entry in this array corresponds to a point on
    // the chart.
    data: [
        { material: 'aaa', value: -20, vendor: 'aaa' },
        { material: 'bbb', value: -30, vendor: 'bbb' },
        { material: 'ccc', value: -40, vendor: 'ccc' },
        { material: 'ddd', value: -50, vendor: 'ddd' },
        { material: 'eee', value: -60, vendor: 'eee' }
        //,{ material: '', value: 0, vendor: '' }
    ],
    hoverCallback: function(index, options, content) {
        var row = options.data[index]; 
        return(row.value + "<br>" + row.vendor);
    },
    // The name of the data record attribute that contains x-values.
    xkey: 'material',
    // A list of names of data record attributes that contain y-values.
    ykeys: ['value'],
    // Labels for the ykeys -- will be displayed when you hover over the
    // chart.
    labels: ['not in use']
});
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50713460

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档