vue echarts heatmap 热力图 单元格默认灰色改为白色

发布于 2022-09-13 01:27:13 字数 2035 浏览 17 评论 0

image.png

代码:

const days = ['12a', '1a', '2a', '3a', '4a', '5a', '6a']
const hours = [
'00:00~00:59',
'01:00~01:59',
'02:00~02:59',
'03:00~03:59',
'04:00~04:59',
'05:00~05:59',
'06:00~06:59',
'07:00~07:59',
'08:00~08:59',
'09:00~09:59',
'10:00~10:59',
'11:00~11:59',
'12:00~12:59',
'13:00~13:59',
'14:00~14:59',
'15:00~15:59',
'16:00~16:59',
'17:00~17:59',
'18:00~18:59',
'19:00~19:59',
'20:00~20:59',
'21:00~21:59',
'22:00~22:59',
'23:00~23:59',
]

const data = [

[0, 0, 5],
[0, 1, 1],
[0, 2, 0],
[0, 3, 0],
[0, 4, 0],
[0, 5, 0],
[0, 6, 0],
[0, 7, 0],
[0, 8, 0],
[0, 9, 0],
[1, 0, 7],
[1, 1, 0],
[1, 2, 0],
[1, 3, 0],
[1, 4, 0],

]
const series = data.map(item => {

return [item[1], item[0], item[2] || '-']

})
const option = {

title: {
  text: '近一周事件发生热力图',
  textStyle: {
    color: '#999999',
    fontSize: 12,
    fontWeight: 'lighter',
  },
},
tooltip: {
  position: 'top',
},
grid: {
  height: '87%',
  top: '30px',
  bottom: '15px',
},
xAxis: {
  type: 'category',
  data: days,
  splitArea: {
    show: true,
  },
},
yAxis: {
  type: 'category',
  axisTick: { show: true },
  data: hours,
  axisLabel: {
    interval: 0,
  },
  splitArea: {
    show: true,
  },
},
visualMap: {
  min: 0,
  max: 4,
  calculable: true,
  orient: 'horizontal',
  left: 'center',
  inRange: {
    color: ['#ffffff', '#b2503b'],
  },
},
series: [
  {
    name: 'Punch Card',
    type: 'heatmap',
    data: series,
    label: {
      show: true,
      color: 'white',
    },
    itemStyle: {
      color: '#ffffff',
      borderType: 'solid',
      borderWidth: '1px',
      borderColor: '#000000',
    },
    emphasis: {
      itemStyle: {
        borderWidth: '1px',
        shadowBlur: 10,
        shadowColor: '#000000',
      },
    },
  },
],

}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

孤独患者 2022-09-20 01:27:13

echarts 图表后面背景色

"splitArea": { "show": true, "areaStyle": { "color": [ "blue" ] } }

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文