[转]echarts柱状图点击事件获取自定义参数

原文地址:https://www.jianshu.com/p/9c6d94e57ab3

复制代码
 1 series: [
 2           {
 3             label: {
 4               show: true,
 5               // labelText在bar外右上方
 6               position: 'top',
 7               // offset: [-11, -2],
 8               // distance: -12,
 9               color: '#37f8f5',
10               fontSize: '18',
11               fontWeight: 'bolder'
12             },
13             // barGap: '100%',
14             // barCategoryGap: '50%',
15             barWidth: 40, // 修改柱状图的宽度
16             data: [{value: 0, deptCode: "JE0"}, {value: 1131, deptCode: "JE504"}],//!!!这里数组元素由数值改为对象,则value是原来的值,其他自定义属性如deptCode可作为参数传递到点击获取的对象中
17             type: 'bar',
18             showBackground: true,
19             backgroundStyle: {
20               color: 'rgba(180, 180, 180, 0.2)'
21             },
22             itemStyle: {
23               color: '#36adee',
24               emphasis: {
25                 barBorderRadius: 1
26               },
27               normal: {
28                 // 渐变色
29                 color: new echarts.graphic.LinearGradient(
30                   0, 0, 0, 1,
31                   [
32                     { offset: 0, color: '#FFFFFF' },
33                     { offset: 1, color: '#83f5de' }
34                   ]
35                 ),
36                 shadowBlur: 20,
37                 shadowColor: 'rgba(64,95,94,0.5)',
38                 barBorderRadius: 5
39               }
40             }
41           }
42         ]
复制代码

 

posted @   dirgo  阅读(1665)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 25岁的心里话
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
历史上的今天:
2019-02-23 [转]list的交集,差集,并集
点击右上角即可分享
微信分享提示