【发布时间】:2021-01-01 08:40:05
【问题描述】:
我正在使用莫里兹折线图。但它在 x 轴上显示年数我认为它是字符串我试图修改它但它没有发生。这是它现在显示的图像。
这是我现在使用的代码
new Morris.Line({
// ID of the element in which to draw the chart.
element: 'kt_morris_1',
// Chart data records -- each entry in this array corresponds to a point on
// the chart.
data: [{
y: `${invoice_date0}`,
a: invoice_income0,
},
{
y: `${invoice_date1}`,
a: 75,
},
{
y: `${invoice_date2}`,
a: 50,
},
{
y: `${invoice_date3}`,
a: 75,
},
],
// The name of the data record attribute that contains x-values.
xkey: 'y',
// A list of names of data record attributes that contain y-values.
ykeys: ['a'],
// Labels for the ykeys -- will be displayed when you hover over the
// chart.
labels: ['Total Invoice'],
lineColors: ['#6e4ff5', '#f6aa33']
});
invoice_date0 中的变量是此格式中的日期dd-mm-Year
我想在 x 轴上显示我该怎么做?
【问题讨论】:
标签: javascript jquery chart.js morris.js