博客
关于我
百度图表柱子背景颜色使用渐变效果
阅读量: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不会性能调优?看看这份清华架构师编写的MySQL性能优化手册吧
查看>>
MySQL不同字符集及排序规则详解:业务场景下的最佳选
查看>>
Mysql不同官方版本对比
查看>>
MySQL与Informix数据库中的同义表创建:深入解析与比较
查看>>
mysql与mem_细说 MySQL 之 MEM_ROOT
查看>>
MySQL与Oracle的数据迁移注意事项,另附转换工具链接
查看>>
mysql丢失更新问题
查看>>
MySQL两千万数据优化&迁移
查看>>
MySql中 delimiter 详解
查看>>
MYSQL中 find_in_set() 函数用法详解
查看>>
MySQL中auto_increment有什么作用?(IT枫斗者)
查看>>
MySQL中B+Tree索引原理
查看>>
mysql中cast() 和convert()的用法讲解
查看>>
mysql中datetime与timestamp类型有什么区别
查看>>
MySQL中DQL语言的执行顺序
查看>>
mysql中floor函数的作用是什么?
查看>>
MySQL中group by 与 order by 一起使用排序问题
查看>>
mysql中having的用法
查看>>