echarts柱状图遇到个问题,求求大佬救救

zyx7653296 2021-09-24 17:26:19

准备用柱状图来统计数量。然后这一步都挺正常的,设备就入库出库等选项。

 

到下面的柱状图,就把上面的入库等选项给包含进去了。。。我想问问有没有什么办法,把下面柱状图的无关选项给去掉。

 

这段代码如下:

var chartDom = document.getElementById('EchartZhu');
	var myChart = echarts.init(chartDom);
	var option;

	option = {
	  tooltip: {
	    trigger: 'axis',
	    axisPointer: {
	      // Use axis to trigger tooltip
	      type: 'shadow' // 'shadow' as default; can also be 'line' or 'shadow'
	    }
	  },
	  legend: {},
	  grid: {
	    left: '3%',
	    right: '4%',
	    bottom: '3%',
	    containLabel: true
	  },
	  xAxis: {
	    type: 'value'
	  },
	  yAxis: {
	    type: 'category',
	    data: ['外来人员', '机房巡检', '设备变更', '日常保障', '会议', '设备']
	  },
	  series: [
	    {
	      name: '入库',
	      type: 'bar',
	      stack: 'total',
	      label: {
	        show: true
	      },
	      emphasis: {
	        focus: 'series'
	      },
	      data: [,,,,,320]
	    },
	    {
	      name: '出库',
	      type: 'bar',
	      stack: 'total',
	      label: {
	        show: true
	      },
	      emphasis: {
	        focus: 'series'
	      },
	      data: [, , , , , 210]
	    },
	    {
	      name: '借用',
	      type: 'bar',
	      stack: 'total',
	      label: {
	        show: true
	      },
	      emphasis: {
	        focus: 'series'
	      },
	      data: [, , , , , 100]
	    },
	    {
	      name: '报废',
	      type: 'bar',
	      stack: 'total',
	      label: {
	        show: true
	      },
	      emphasis: {
	        focus: 'series'
	      },
	      data: [, , , , , 410]
	    },
	    {
	      name: '归还',
	      type: 'bar',
	      stack: 'total',
	      label: {
	        show: true
	      },
	      emphasis: {
	        focus: 'series'
	      },
	      data: [, , , , , 1320]
	    },
	    {
	      name: '录入数',
	      type: 'bar',
	      stack: 'total',
	      label: {
	        show: true
	      },
	      emphasis: {
	        focus: 'series'
	      },
	      data: [200,1320 ,500 ,,, ]
	    },
	    {
	      name: '未完成',
	      type: 'bar',
	      stack: 'total',
	      label: {
	        show: true
	      },
	      emphasis: {
	        focus: 'series'
	      },
	      data: [, , ,300,200, ]
	    },
	    {
	      name: '已完成',
	      type: 'bar',
	      stack: 'total',
	      label: {
	        show: true
	      },
	      emphasis: {
	        focus: 'series'
	      },
	      data: [, , ,500,600, ]
	    }
	  ]
	};

	option && myChart.setOption(option);

 

...全文
265 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复

搜一下 echarts tooltip formatter自定义

zyx7653296 2021-09-24
  • 举报
回复
@长夜将尽 来日可期 3Q,已解决,现在就差html把之前格式给返回,这个下去慢慢弄吧

87,987

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧