zoukankan      html  css  js  c++  java
  • echart修改字体大小

    tooltip: {//鼠标悬浮提示字体大小
                trigger: 'axis',
                textStyle: {
                    fontSize: getDpr()
                }
            },
            legend: {//标题
                data: ['事物量'],
                textStyle: {
                    color: '#adadad',
                    fontSize: getDpr()
                },
            },
    xAxis: [{//右下角横轴名称
                name: '时间',
                nameTextStyle: {
                    color: '#adadad',
                    fontSize: getDpr()
                },
                nameGap: 6,
                type: 'category',
                boundaryGap: false,
                axisLabel: {
                    textStyle: {
                        color: '#adadad',
                        fontSize: getDpr(),
                    }
                },
                data: xData
            }],
    yAxis: [{//y轴名称
                type: 'value',
                name: "单位:次",
                nameTextStyle: {
                    color: '#adadad',
                    fontSize: getDpr()
                },
                interval: 6000,
                nameGap: 11,
                splitLine: { //网格线
                    show: true,
                    lineStyle: {
                        color: ['#435357'],
                        type: 'solid'
                    }
                },
                axisLabel: {
                    textStyle: {
                        color: '#adadad',
                        fontSize: getDpr(),
                    }
                },
            }],
    series: [{//每项data中修改字体大小
                type: 'pie',
                radius: '70%',
                center: ['50%', '60%'],
                color: ['rgba(78, 181, 255, 0.74)', 'rgba( 0, 255, 255,0.1)'],
                data: [{
                    name: '已用磁盘空间' + '
    ' + used + 'TB',
                    value: used,
                    labelLine: {
                        normal: {
                            lineStyle: {
                                color: '#fff'
                            }
                        }
                    },
                    label: {
                        normal: {
                            textStyle: {
                                color: '#fff',
                                fontSize: getDpr(),
                            }
                        }
                    }
                }]
    }]
    //其中getDpr()为一个方法,根据屏幕大小去加载不同字体大小
    //图表根据屏幕大小去判断字体大小
    var getDpr = function getDpr() {
        var windowWidth = $(window).width();
        if (windowWidth < 1920) {
            return 12
        }
        if (windowWidth >= 1920 && windowWidth <= 3840) {
            return 18
        }
        if (windowWidth > 3840 && windowWidth <= 5760) {
            return 30
        }
    
    };
  • 相关阅读:
    5
    4
    3
    crontab -e 报错(E518: Unknown option: foldenable)
    解决无法修改日志时间的问题(Local time zone must be set--see zic manual page 2019 )
    ping测试丢包率
    关闭SELinux
    iotop使用方法
    mysql的备份
    修改uid gid 的起始范围
  • 原文地址:https://www.cnblogs.com/surplus/p/12387569.html
Copyright © 2011-2022 走看看