echart如何自定义标题!

有时候我们echart的标题需要有大有小!但是text只有一个!

其实有2种,一种较为简单,添加副标题即可

   title: [
                    {
                        text: '主标题',
                        left: '50%',
                        top: '40%',
                        textAlign: 'center',
                        textStyle: {

                            color: color,
                            fontStyle: 'normal',
                            fontWeight: 'normal',
                            fontFamily: 'sans-serif',
                            fontSize: 18,
                            lineHeight: 18,
                        },
                        subtext: '副标题',    // 副标题
                        subtextStyle: {    // 副标题样式
                            fontSize: '30',
                            fontWeight: '400',
                            color: subcolor,
                            textAlign: 'center',
                            textBorderColor: 'rgba(0, 0, 0, 0)',
                            textShadowColor: '#000',
                            textShadowBlur: '0',
                            textShadowOffsetX: 0,
                            textShadowOffsetY: 1,
                            rich: {
                                unit: {
                                    fontSize: 14,
                                    color: subcolor
                                }
                            }
                        }

                    },
                ],

第二种

   title: [
                    {
                        text: `{value|哈哈哈}}{aaaa|10}{unit|分}`,
                        textStyle: {    // 副标题样式
                            rich: {
                                aaaa:{
                                           fontSize: 14,
                                    color: subcolor
                                },
                                unit: {
                                    fontSize: 14,
                                    color: subcolor
                                }
                            }
                        }

                    },
                ],


相关内容

发表评论

验证码:
点击我更换图片

最新评论