利用Echarts图表插件,添加了数据表数据源,修改了代码,在设计器端x坐标轴显示了日期格式:
代码:
const {
yearmon: xAxisData,
rcyl: yAxisData1,
rcy: yAxisData2,
hs: yAxisData3,
remarks: yAxisData4
} = ForguncyEchartsHelper.splitDataSource(Context.oil_daily)
option = {
legend: {
top: 30
},
tooltip: {
trigger:'axis'
},
xAxis: {
type: 'category',
//name: '日期',
//type: 'time',
data: xAxisData,
axisLabel:{
formatter: function (value) {
// 格式化时间轴标签
return echarts.format.formatTime('yyyy/MM/dd', value);
}
}
},
yAxis: [
{
type: 'value',
name: '日产液油',
nameLocation:'middle',
//nameTextStyle:{
// color:'#A52A2A'
//} ,
nameGap: 40,
axisLine: {
lineStyle: {
color: "rgba(173, 80, 80, 1)"
}
}
},
{
type: 'value',
name: '含水',
nameLocation: 'middle',
min:0,
max:100,
axisLine: {
lineStyle: {
color: '#007FFF'
}
},
nameGap:40,
splitLine: false
}
],
series: [
{
name:'日产液',
data: yAxisData1,
type: 'line',
//stack: 'a',
areaStyle:{},
//label: {
// show:true
//},
color: '#A52A2A' //褐色
},
{
name: '日产油',
data:yAxisData2,
type: 'line',
//stack: 'a',
areaStyle:{},
color: '#FF2400' //红色
},
{
name: '含水',
data: yAxisData3,
type: 'line',
yAxisIndex:1,
color:'#007FFF' //蓝色
}
{
name:'备注',
data: yAxisData4,
type: 'line'
}
]
};
在浏览器中打开,日期格式显示不出来。更换了浏览器同样不行,edge浏览器也不行
请问什么原因,如果解决?
|