如何将值从xkey
更改为string
?
我已经尝试将其更改为" iPhone",但它无效。
var line = new Morris.Line({
element: 'line-chart',
resize: true,
data: [
{y: '2011 Q1', item1: 2666},
{y: '2011 Q2', item1: 2778},
{y: '2011 Q3', item1: 4912},
{y: '2011 Q4', item1: 3767},
{y: '2012 Q1', item1: 6810},
{y: '2012 Q2', item1: 5670},
{y: '2012 Q2', item1: 5670},
{y: '2012 Q2', item1: 5670},
],
xkey: 'y',
ykeys: ['item1'],
labels: ['Item 1'],
lineColors: ['#3c8dbc'],
hideHover: 'auto'
});
答案 0 :(得分:0)
添加属性:parseTime:false。
您的代码已更改:
var line = new Morris.Line({ element: 'line-chart', resize: true, data: [ {y: '2011 Q1', item1: 2666}, {y: '2011 Q2', item1: 2778}, {y: '2011 Q3', item1: 4912}, {y: '2011 Q4', item1: 3767}, {y: '2012 Q1', item1: 6810}, {y: '2012 Q2', item1: 5670}, {y: '2012 Q2', item1: 5670}, {y: '2012 Q2', item1: 5670}, ], xkey: 'y', ykeys: ['item1'], labels: ['Item 1'], lineColors: ['#3c8dbc'], parseTime:false, hideHover: 'auto' });