Toggle navigation
改变markPoint标注(气泡)颜色,全部显示气泡
By
逗***思
2020-01-08 05:48:07
脚本
16
21
作品使用的第三方脚本
数据管理
上传数据
支持小于 5M 任意格式(csv, xlsx, json, xml, ...)的数据文件
上传后可以通过生成的文件链接异步获取托管的数据。
历史数据
0 条
无历史数据
代码修改记录
信息提示
保存作品
对当前截图不满意?你还可以
上传本地截图
重新截图
作品名称
作品描述
标签
geo
grid
legend
markLine
markPoint
bar
effectScatter
line
lines
map
timeline
title
toolbox
tooltip
visualMap
作品默认版本
最新
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
20:11:45
图表已生成
整理代码
刷新
代码
var data = [50, 95, 91, 34, 90]; var markArr = [], temObj = null; var sum = 0; for (var i = 0; i < data.length; i++) { sum += data[i]; } var mean = sum / data.length; data.forEach(function(v, i) { if (v > mean) { temObj = { name: '车企' + i, value: v, xAxis: v, yAxis: i, id: i, itemStyle: { color: '#ffd54f' } }; } else { temObj = { name: '车企' + i, value: v, xAxis: v, yAxis: i, id: i, itemStyle: { color: '#fb8f8e' } }; } markArr.push(temObj); }); option = { backgroundColor: '', tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' } }, color: ['#22b8ed'], grid: { left: '1%', right: '8%', bottom: '8%', backgroundColor: '#333', containLabel: true }, yAxis: [{ name: '车企', type: 'category', data: ['车企0', '车企1', '车企2', '车企3', '车企4'], triggerEvent: true, axisTick: { alignWithLabel: true // 坐标值是否在刻度中间 } }], xAxis: [{ type: 'value', name: '数量', // triggerEvent: true, axisLabel: { formatter: '{value}' } }], series: [{ type: 'bar', data: data, barGap: '5%', // 柱图间距 barWidth: 35, // 柱图宽度 itemStyle: { normal: { barBorderRadius: [0, 7, 7, 0], color: '#22b8ed', label: { show: true, // 开启显示 position: 'right', // 在上方显示 textStyle: { // 数值样式 color: '#22b8ed', fontSize: 16 } } } }, markPoint: { // data: [ // {type: 'max', name: '最大值'}, // {type: 'min', name: '最小值'} // ] data: markArr } }] }; myChart.setOption(option); myChart.on('click', function(params) { console.log('clickclickclickclick111', markArr); console.log('clickclickclickclick111', params); if (params.componentType == 'yAxis') { markArr.forEach(function(v) { if (params.value == v.name) { console.log('ididididid', v.id); } }); } });