博客
关于我
百度图表柱子背景颜色使用渐变效果
阅读量:132 次
发布时间:2019-02-26

本文共 3925 字,大约阅读时间需要 13 分钟。

一、运行效果

这里写图片描述

二、具体代码

var app = echarts.init(document.getElementById("box"));    var option = {        title: {            text: '样本量分析',            left:'50%',            textStyle:{            }        },        tooltip: {            trigger: 'axis',            axisPointer: {                type: 'shadow'            }        },        legend: {            type:'plain',            data: ['2011年', '2012年', '2013年'],            bottom:'0px',        },        grid: {            left: '0%',            right: '4%',            bottom: '10%',            top:'15%',            containLabel: true        },        xAxis: {            type: 'value',            // data:[2000,4000,6000,8000,10000,12000],            onZero:false,            // 坐标轴            axisLine:{                lineStyle:{                    opacity:0,                    width:0                }            },            // 设置坐标轴上刻度            axisTick:{                show:false            },            // 自由分配x轴坐标            boundaryGap: [0, 0.01],        },        yAxis: {            type: 'category',            data: [],            show:false        },        series: [            {                name: '2011年',                type: 'bar',                data: [2000],                itemStyle:{                    normal:{                        color:new echarts.graphic.LinearGradient(0,0,1,0,[                            {                                offset:0,                                color:'#fff'                            },                            {                                offset:1,                                color:'#B0B0B0'                            }                        ])                    },                },                // 设置柱子的高度                barWidth:'20px',                // 设置显示数值的样式                label: {                    normal: {                        show: true,                        position: 'insideRight',                        color:'#333'                    }                },                // 设置柱子之间的间距                barGap:'100%'            },            {                name: '2012年',                type: 'bar',                data: [3900],                itemStyle:{                    normal:{                        color:new echarts.graphic.LinearGradient(0,0,1,0,[                            {                                offset:0,                                color:'#fff'                            },                            {                                offset:1,                                color:'#EF8945'                            }                        ])                    },                },                // 设置柱子的高度                barWidth:'20px',                // 设置显示数值的样式                label: {                    normal: {                        show: true,                        position: 'insideRight',                        color:'#333'                    }                },            },            {                name: '2013年',                type: 'bar',                data: [8000],                // 设置柱子的高度                barWidth:'20px',                itemStyle:{                    normal:{                        color:new echarts.graphic.LinearGradient(0,0,1,0,[                            {                                offset:0,                                color:'#fff'                            },                            {                                offset:1,                                color:'#6EA6DA'                            }                        ])                    },                },                // 设置显示数值的样式                label: {                    normal: {                        show: true,                        position: 'insideRight',                        color:'#333'                    }                },            }        ]    };    app.setOption(option);
你可能感兴趣的文章
mysql 中索引的问题
查看>>
MySQL 中锁的面试题总结
查看>>
MySQL 中随机抽样:order by rand limit 的替代方案
查看>>
MySQL 为什么需要两阶段提交?
查看>>
mysql 为某个字段的值加前缀、去掉前缀
查看>>
mysql 主从
查看>>
mysql 主从 lock_mysql 主从同步权限mysql 行锁的实现
查看>>
mysql 主从互备份_mysql互为主从实战设置详解及自动化备份(Centos7.2)
查看>>
mysql 主从关系切换
查看>>
MYSQL 主从同步文档的大坑
查看>>
mysql 主键重复则覆盖_数据库主键不能重复
查看>>
Mysql 事务知识点与优化建议
查看>>
Mysql 优化 or
查看>>
mysql 优化器 key_mysql – 选择*和查询优化器
查看>>
MySQL 优化:Explain 执行计划详解
查看>>
Mysql 会导致锁表的语法
查看>>
mysql 使用sql文件恢复数据库
查看>>
mysql 修改默认字符集为utf8
查看>>
Mysql 共享锁
查看>>
MySQL 内核深度优化
查看>>