设置 splitArea: {
interval: 0,
show: true,
},回发现最后两个连在一起了,
请问还有什么方法能解决x轴多一个刻度吗,这样看着太紧了
配置项如下
option = {
//标题组件
title: {
text: '全球数据统计',
textStyle: {
color: '#B03A5B',
fontWeight: 'normal',
},
subtext: '副标题文本',
subtextStyle: {
fontStyle: 'italic',
color: '#3385ff',
},
itemGap: 10,
left: 'center',
top: '0px',
backgroundColor: '#ccc'
},
//图例组件
legend: {
type: 'plain',
orient: 'vertical',
align: 'left',
right: 0,
top: '50px',
formatter: function(name) {
return echarts.format.truncateText(name, 40, '14px Microsoft Yahei', '…');
},
itemGap: 20,
tooltip: {
show: true
},
},
// 提示窗
tooltip: {
trigger: 'axis',
},
// 工具栏
toolbox: {
show: true,
feature: {
dataView: {
readOnly: false
},
saveAsImage: {}
}
},
// x轴
xAxis: {
name: '时间',
nameLocation: 'end',
nameGap: 30,
offset: 40,
nameRotate: 40,
type: 'category',
boundaryGap: true,
min: 'dataMin',
// 坐标轴线
axisLine: {
symbol: ['none', 'arrow'],
symbolOffset: [0, 0],
lineStyle: {
color: '#000'
}
},
// max: function(value) {
// return value.max + 1;
// },
// 坐标轴刻度
axisTick: {
show: true,
// interval: 1,
inside: true,
alignWithLabel: true
},
axisLabel: {
// rotate: -90,
margin: -30,
interval: 0,
formatter: function(value) {
if (value)
return value.split("").join("\n");
}
},
// 分割区域
splitLine: {
show: false
},
splitArea: {
interval: 0,
show: true,
},
data: [1992, 1994, 1994, 11995, 1996, 1997, 1998, 1999, 2000, 2001, 2002]
},
yAxis: {
position: 'bottom',
type: 'value',
name: '数量',
nameLocation: 'center',
nameGap: 40,
nameRotate: 0,
// max: function(value) {
// return value.max * 1.2;
// },
},
series: [{
data: [400, 632, 601, 634, 790, 830, 120, 335, 66, 599, 800],
type: 'bar',
name: '图列1'
}, {
data: [820, 932, 901, 934, 1290, 1330, 1320, 335, 666, 999, 1000],
type: 'line',
name: '2',
markPoint: {
data: [{
type: 'max',
name: '最大值'
},
{
type: 'min',
name: '最小值'
}
],
symbolSize: 50,
}
}, {
type: 'line',
markLine: {
silent: false,
symbolSize: 5,
data: [{
name: '100 参考线',
itemStyle: {
normal: {
show: true,
color: '#8fbdfd'
}
},
symbol: 'none',
yAxis: 1200
}]
}
}]
};