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
        }
    
    };
  • 相关阅读:
    hbase 2.0.2 分布式安装配置/jar包替换
    hive character '' not supported here
    request.getSession().getServletContext().getRealPath()的一些坑
    hive 自定义函数
    hive 导出数据的几种方式
    hive 分区表与数据产生关联的三种方式
    hive 日志配置/表头配置
    hive 3.1.0 安装配置
    zookeeper 客户端操作
    linux 循环读取文件的每一行
  • 原文地址:https://www.cnblogs.com/surplus/p/12387569.html
Copyright © 2011-2022 走看看