• Ecarts知识点积累(附示例)


    • echarts知识点:
     axisTick: {
            show:false,  //隐藏x轴刻度
        },
        axisLine: {
            show: false,  //隐藏x轴
        },
    
        //展示echarts图表中的数据,然后以柱形图或是其他形式的图形显示
        series: [
            {
                type: 'bar',
                data: [81, 78.9, 64.6, 63.6, 62, 61.4, 58.6, 57.3, 55.8, 38.4],
                barWidth: '34px',
                label: {
                    normal: {
                        show: true,
                        position: 'top',
                        formatter: (value) => value.value + '%',
                    },
                },
                itemStyle: {
                    normal: {
                        color: '#3E7AFF',  //改变图形颜色
                        barBorderRadius: [5, 5, 0, 0],  //改变图形的形状,变成圆弧形
                    },
                },
            },
        ],
    • 示例:
    var index = 0;
    var colorList = ['#f36c6c', '#e6cf4e', '#20d180', '#0093ff'];
    option = {
        tooltip: {
            trigger: 'axis',
            axisPointer: {
                type: 'shadow'
            }
        },
        legend: {
            show: false
        },
        grid: {
            left: 100
        },
        toolbox: {
            show: true,
            feature: {
                saveAsImage: {}
            }
        },
        xAxis: {
            type: 'value',
            //隐藏图表中的分割线
            splitLine: {
                show: false
            },
            //隐藏x轴下方的数据展示
            axisLabel: {
                show: false
            },
            //隐藏x轴中的刻度
            axisTick: {
                show: false
            },
            //隐藏x轴
            axisLine: {
                show: false
            }
    
        },
        yAxis: {
            type: 'category',
            inverse: true,
            axisLine: {
                show: false
            },
            axisTick: {
                show: false
            },
            axisPointer: {
                label: {
                    show: true,
                    margin: 30
                }
            },
            data: ['杭州', '宁波', '温州', '湖州', '嘉兴'],
            axisLabel: {
                margin: 100,
                fontSize: 14,
                align: 'left',
                color: '#333',
                //y轴旁边的序号样式
                rich: {
                    a1: {
                        color: '#fff',
                        backgroundColor: colorList[0],
                         30,
                        height: 30,
                        align: 'center',
                        borderRadius: 2
                    },
                    a2: {
                        color: '#fff',
                        backgroundColor: colorList[1],
                         30,
                        height: 30,
                        align: 'center',
                        borderRadius: 2
                    },
                    a3: {
                        color: '#fff',
                        backgroundColor: colorList[2],
                         30,
                        height: 30,
                        align: 'center',
                        borderRadius: 2
                    },
                    b: {
                        color: '#fff',
                        backgroundColor: colorList[3],
                         30,
                        height: 30,
                        align: 'center',
                        borderRadius: 2
                    }
                },
                formatter: function(params) {
                    if (index == 5) {
                        index = 0;
                    }
                    index++;
                    if (index - 1 < 3) {
                        return [
                            '{a' + index + '|' + index + '}' + '  ' + params
                        ].join('
    ')
                    } else {
                        return [
                            '{b|' + index + '}' + '  ' + params
                        ].join('
    ')
                    }
                }
            }
        },
        series: [{
                z: 2,
                name: 'value',
                type: 'bar',
                data: [3.66, 2.86, 1.82, 1.8, 1.53].map((item, i) => {
                    itemStyle = {
                        color: i > 3 ? colorList[3] : colorList[i]
                    }
                    return {
                        value: item,
                        itemStyle: itemStyle
                    };
                }),
                label: {
                    show: true,
                    position: 'right',
                    color: '#333333',
                    fontSize: 14,
                    offset: [10, 0]
                }
            }
    
        ]
    };

    示例图形如下:

  • 相关阅读:
    css中span元素的width属性无效果原因及多种解决方案
    CentOS、Ubuntu、Debian三个linux比较异同
    linux系统中/etc/syslog.conf文件解读
    /proc/interrupts 和 /proc/stat 查看中断的情况
    网卡优化RPS/RFS
    关于Linux网卡调优之:RPS (Receive Packet Steering)
    rsync详解之exclude排除文件
    Linux rsync 同步实践
    CentOS 6.3下rsync服务器的安装与配置
    解决linux下/etc/rc.local开机器不执行的原因
  • 原文地址:https://www.cnblogs.com/Chestnut-g/p/14174156.html
Copyright © 2020-2023  润新知