zoukankan      html  css  js  c++  java
  • echart 样式修改

     坐标轴,字体颜色,如下:
    const option = {
                tooltip: {
                    show: true,
                    trigger: 'axis',
                    backgroundColor: "#fff",
                    textStyle: {
                        color: "#333333",
                    },
                    axisPointer: {
                        type: 'shadow',
                    },
                    formatter: function (params) {
                        const res = {}
                        params.map(item => {
                            res.name = item.name,
                                res.color = item.color,
                                res.value = item.value,
                                res.ratio = parseInt(item.value * 100 / calculateData.totalArea)

                        })
                        return `<div style="background:#fff; padding:0 10px 0 5px">
                        <p>${res.name}</p>
                        <p>
                         <i style='display: inline-block; 10px; height: 10px; background:${res.color}; margin-right: 5px; border-radius: 50%'></i>
                        <span style="padding-left:4px">面积:${res.value}m<sup>2</sup></span>
                        </p>            
                        <span style="padding-left:20px">占比:${res.ratio}%</span>
                        </div>`
                    },

                },
                xAxis: {
                    type: 'category',
                    data: dataX,
                    axisLabel: {
                        show: true,
                        textStyle: {
                            color: '#fff'
                        }
                    },
                    axisLine: {
                        lineStyle: {
                            type: 'solid',
                            color: '#0A55EB',
                        }
                    },
                },
                yAxis: {
                    type: 'value',
                    axisLabel: {
                        // formatter: '{value}',
                        textStyle: {
                            color: '#fff'
                        }
                    },
                    splitLine: { show: false },
                    axisLine: {
                        lineStyle: {
                            type: 'solid',
                            color: '#0A55EB',
                        }
                    },
                },
                series: [
                    {
                        name: '面积',
                        type: 'bar',
                        barWidth: '40%',
                        data: seriesDataTemp,
                    },
                ],
            };
  • 相关阅读:
    springboot(eureka子项目)+idea+jsp 404问题
    什么是区块链以及他的6个特征?
    elasticsearch启动时提示内存不足错误的解决方法
    ElasticSearch 安装root用户启动失败问题解决
    防抖节流(立即执行和延时执行)
    将数字转为千分制格式(最简单)
    微信H5跳转任意小程序
    原生html+css设置项目主题色(超简单)
    H5获取手机型号
    css属性——env()和constant()设置安全区域
  • 原文地址:https://www.cnblogs.com/zwjun/p/15711231.html
Copyright © 2011-2022 走看看