zoukankan      html  css  js  c++  java
  • 横向柱状图

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="ECharts">
    <title>Echarts绘制横向柱状图(圆角+渐变)</title>
    <script src="https://cdn.bootcss.com/echarts/3.5.4/echarts.min.js"></script>
    </head>
    <body>
    <div id="main" style=" 1000px;height:400px;"></div>
    <script type="text/javascript">
         var myChart = echarts.init(document.getElementById('main'));
    
        //初始化数据
        var category = ['小王', '小李', '小赵', '小马', '小刘', '小张', '小齐'];
        var barData = [3100, 2142, 1218, 581, 431, 383, 163];
    
        var option = {
            tooltip: {
                trigger: 'axis',
                axisPointer: {
                    type: 'shadow'
                }
            },
            grid: {
                left: '3%',
                right: '4%',
                bottom: '3%',
                containLabel: true
            },
            xAxis: {
                type: 'value',
                axisLine: {
                    show: false
                },
                axisTick: {
                    show: false
                }
            },
            yAxis: {
                type: 'category',
                data: category,
                splitLine: {show: false},
                axisLine: {
                    show: false
                },
                axisTick: {
                    show: false
                },
                offset: 10,
                nameTextStyle: {
                    fontSize: 15
                }
            },
            series: [
                {
                    name: '数量',
                    type: 'bar',
                    data: barData,
                    barWidth: 14,
                    barGap: 10,
                    smooth: true,
                    label: {
                        normal: {
                            show: true,
                            position: 'right',
                            offset: [5, -2],
                            textStyle: {
                                color: '#F68300',
                                fontSize: 13
                            }
                        }
                    },
                    itemStyle: {
                        emphasis: {
                            barBorderRadius: 7
                        },
                        normal: {
                            barBorderRadius: 7,
                            color: new echarts.graphic.LinearGradient(
                                0, 0, 1, 0,
                                [
                                    {offset: 0, color: '#3977E6'},
                                    {offset: 1, color: '#37BBF8'}
    
                                ]
                            )
                        }
                    }
                }
            ]
        };
        myChart.setOption(option);
    </script>
    </body>
    </html>
  • 相关阅读:
    [转]android刷新后R.java不见了
    adb常用指令
    [转]Intent跳转到系统应用中的拨号界面、联系人界面、短信界面及其他
    effective c/C++
    七种布局显示方式效果及实现
    修改Tabhost样式和字体大小的方法
    [转]android中SoundRecorder
    java中的IO整理
    在xp下面下载Android源代码
    linux网络 (二):无线网络操作
  • 原文地址:https://www.cnblogs.com/vali/p/8695669.html
Copyright © 2011-2022 走看看