Toggle navigation
柱状图 改 三角形
By
樱***j
2020-08-24 07:21:51
脚本
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
图表已生成
整理代码
刷新
代码
/** * pictorialBar 有一个数据为0时的bug * 数组中的数据中有 0 会产生bug * 解决方法: * 循环遍历,有0 的话,改成0.1,悬浮时通过formatter函数去修改成0 * 添加点击事件,如果出现点击的数据和console的数据不一样,那就是盖住了, * 解决方法:加宽当前盒子,grid使用left往右移动,盒子margin-left往左移动,隐藏掉当前空白的区域 * **/ // 遍历月份 var weekStr = ""; for (let k = 1; k <= 12; k++) { weekStr += k + "月份,"; } var weekData = weekStr.substring(0, weekStr.lastIndexOf(",")).split(","); option = { title: { text: '百分比', textStyle: { fontWeight: 'bold', fontSize: 14, color: '#0ab7ff' }, left: '5%', top: '25' }, toolbox: { // 工具栏 itemSize: 20, showTitle: false, right: 24, feature: { myTool: { //自定义工具 myTool show: true, title: "全屏显示", icon: "image://" + "images/full.png", //此处 图片路径前面必须加字符串 "image://" onclick: function () { //生成全屏显示的图表 if (setFullScreenToolBox(optionSalesBottom1)) { getChartData(chartScreen); } }, }, }, }, legend: { right:'6%', top:'9', itemWidth: 15, itemHeight: 15, icon: "circle", textStyle: { fontSize: 12, color: "#0ab7ff", }, }, tooltip: { trigger: 'axis', textStyle: { fontSize: 12, }, }, grid: { left: "2%", right: "2%", bottom: "5%", top: "16%", containLabel: true, }, xAxis: [ { type: 'category', axisLine: { lineStyle: { color: "#0ab7ff", fontSize: 8, }, }, data: weekData }, ], yAxis: [ { type: "value", splitLine: { lineStyle: { color: "rgba(31,86,146,0.7)", }, }, // min: 0, // max: 100, axisLabel: { formatter: '{value}%', color: '#0ab7ff', interval: 'auto', textStyle: { fontSize: 12 }, }, axisLine: { lineStyle: { color: "#0ab7ff", }, }, }, ], series: [ { name:'福彩', type: "pictorialBar", symbol:"triangle", stack:"aaa", barWidth: 20, itemStyle: { normal: { barBorderRadius: [50], color: new echarts.graphic.LinearGradient( 1, 1, 0, 0, [{ offset: 1, color: '#FEC21D' }, { offset: 0, color: '#FF5E1E' } ] ) } }, data:[20,30,40,50,60,70,70,60,50,40,30,20] }, { name:'体彩', barWidth: 20, type: "pictorialBar", symbol:"triangle", stack:"aaa", itemStyle: { normal: { barBorderRadius: [50], color: new echarts.graphic.LinearGradient( 1, 1, 0, 0, [{ offset: 1, color: '#27D7E9' }, { offset: 0, color: '#038CEF' } ] ) } }, data:[10,20,30,40,50,60,60,50,40,30,20,10] } ] };