看一下这个jsfiddle link
我将使用此图表显示欠购量,那么如何在图表中设置-20比-50更短的条形图?
-60甚至没有显示在图表上。
如果我取消注释//,{ material: '', value: 0, vendor: '' }
,那么图表将根据我的要求正确显示,但这不是我要找的修复程序。
我的图表将只包含负值,我如何解决这个问题?
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']
});
https://stackoverflow.com/questions/50713460
复制相似问题