在使用坐标系+热力图时,无论怎么设置(padding:0+borderWidth:0+xAxis.splitLine.show=false+yAxis.splitLine.show=false),在图中依然会存在空隙,这可怎么办?没办法吗?
配置项如下
// 这是借鉴了 clxgao兄弟的图来做说明,希望您别介意
// 我希望能够消除图中网格中间的空隙(分割线?),希望大神指点,实在没找到法子
var data = [
[0, 0, 1],
[0, 1, 0],
[0, 2, 1],
[1, 0, 1],
[1, 1, 1],
[1, 2, 1],
[2, 0, 0],
[2, 1, 0],
[2, 2, 1]
];
data = data.map(function(item) {
return {
value: [item[0], item[1], item[2]],
itemStyle: {
normal: {
borderColor: '#ffffff', //背景颜色
borderWidth: 0,
borderType: 'solid'
}
}
}
});
// 基于准备好的dom,初始化echarts实例
var axisType = {
type: 'category',
data: ['0', '1', '2'],
axisLine: {
show: false
},
axisTick: {
show: false
},
axisLabel: {
show: false
}
};
option = {
title: {
text: 'Awesome Chart'
},
tooltip: {
formatter: function(params) {
return '[' + params.value[0] + ', ' + params.value[1] + ']: ' + params.value[2]
}
},
// animation: false,
grid: {
top: '10%',
height: '50%',
width: '50%'
},
xAxis: axisType,
yAxis: axisType,
series: {
name: '2048',
type: 'heatmap',
data: data,
label: {
normal: {
//这里是去除模块上显示的数值,如果需要请自行设置
show: false
}
},
itemStyle: {
normal: {
borderWidth: 1,
borderColor: "#FFF"
}
}
}
};