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
        }
    
    };
  • 相关阅读:
    Ubuntu安装deb软件包错误(依赖关系问题)解决
    scrapy抓取的中文结果乱码解决办法
    删除Git记录里的大文件
    Ubuntu18.04 修改DNS
    linux实现ssh免密码登录
    Vim进阶指南
    查找相同图片并重命名
    Markdown进阶指南
    一眼看穿flatMap和map的区别
    Java8简明指南
  • 原文地址:https://www.cnblogs.com/surplus/p/12387569.html
Copyright © 2011-2022 走看看