Toggle navigation
修改tooltip
By
虹***岚
2020-05-06 08:31:40
脚本
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
图表已生成
整理代码
刷新
代码
const bShow = true; const toolTitleC = "font-size:12px; margin-bottom: 4px;"; const toolCricBg = "background: currentColor;display: inline-block;width: 6px;height: 6px;border-radius: 6px;margin-right: 4px;"; const toolLi= "list-style-type: none;line-height: 20px; height: 16px; width: 33.3%; float: left; border-radius: 0;"; option = { color: ['#45CCF9', '#FFA240', '#5572F9', '#FFC740', '#3FFA7E', ' #FF2800'], title: { show: false }, tooltip: { show: bShow, trigger: 'axis', // renderMode: 'richText', position: [0, 0], confine: false, textStyle: { color: '#333', // fontSize: 9 }, backgroundColor: '#E7F3F6', axisPointer: { // 坐标轴指示器,坐标轴触发有效 type: 'shadow' // 默认为直线,可选为:'line' | 'shadow' }, extraCssText: 'width: 100%;word-wrap:break-word;box-shadow: 0px 2px 4px rgba(0,0,0,0.12); background: linear-gradient(to bottom,#FFFFFF, #E7F3F6);', formatter: function(params) { //console.log(params); var list = ''; // const toolH = ''; for (let i = 0; i < params.length; i++) { let temps = '
' + params[i].seriesName + ': ' + params[i].data + '
'; list = list + temps; } toolH = '
' + params[0].name + '
' + '
' + list + '
'; return toolH; }, }, legend: { //通过点击legend(图例)控制哪些系列不显示 show: true, left: 14, top: 16, padding: [0, 8], itemGap: 8, itemWidth: 5, //图形宽度 默认25 itemHeight: 5, //图形宽度 默认14 textStyle: { //文字通用样式 // fontSize: 9 }, icon: 'circle', //默认显示矩形 data: ['客户指标', '行业最高值', '行业最低值', '行业均值', '行业中位数'] }, grid: { show: false, // left: 16, // right: 16, // bottom: 16, left: 8, right: 8, bottom: 4, top: 72, containLabel: true }, xAxis: { axisLine: { lineStyle: { color: '#DDDDDD' } }, axisLabel: { textStyle: { color: '#666', // fontSize: 10 } }, data: ["201901", "201801", "201701", "201601"] }, yAxis: { axisLine: { show: false }, axisLabel: { textStyle: { color: '#999', // fontSize: 9 }, formatter: function(value, index) { // 格式化成月/日,只在第一个刻度显示年份 var texts = value / 1000; if (index === 0) { texts = 0; } else { texts = texts + 'k'; } return texts; } }, axisTick: { length: 8, lineStyle: { color: "transparent", } }, splitLine: { lineStyle: { // 使用深浅的间隔色 color: '#f0f0f0' } } }, series: [{ name: '客户指标', type: 'bar', barWidth: 4, barGap: '120%', itemStyle: { normal: { barBorderRadius: 4, } }, data: [5000, 20000, 36121, 10342] }, { name: '行业最高值', type: 'bar', barWidth: 4, barGap: '120%', itemStyle: { normal: { barBorderRadius: 4, } }, data: [5134, 22100, 3563, 23225] }, { name: '行业最低值', type: 'bar', barWidth: 4, barGap: '120%', itemStyle: { normal: { barBorderRadius: 4, } }, data: [12321, 42140, 54312, 8741] }, { name: '行业均值', type: 'bar', barWidth: 4, barGap: '120%', itemStyle: { normal: { barBorderRadius: 4, } }, data: [2345, 7521, 9631, 53451] }, { name: '行业中位数', type: 'bar', barWidth: 4, barGap: '120%', itemStyle: { normal: { barBorderRadius: 4, // barBorderRadius: [30, 30, 0, 0], } }, data: [4213, 7842, 13513, 68901] } ] };