How to change the font color and family only to vertical center aligned yaxis label in Apache Echarts

huangapple go评论52阅读模式
英文:

How to change the font color and family only to vertical center aligned yaxis label in Apache Echarts

问题

谢谢提前帮助。我正在使用apache echarts制作我的React项目。在项目中,我有一个垂直居中对齐的y轴标签。我想要更改它的颜色和字体。以下是我的问题的截图:How to change the font color and family only to vertical center aligned yaxis label in Apache Echarts

我尝试的代码如下:

yAxis: [
    {
        type: "value",
        name: "(x1000)",
        nameLocation: "middle",
        nameGap: 50,
        axisLabel: {
            textStyle: {
                color: "red",
            },
        },
    },
],

但这会更改0、0.2、0.4等数值的颜色。我不想更改这些数值的颜色,只想更改"(x1000)"标签的颜色。有人能帮助我解决这个问题吗?

英文:

Thanks for the help in advance. I am using apache echarts for my react project. In it, I have a vertically center aligned y-axis label. I want to change its color and font family.The screenshot of my issue
How to change the font color and family only to vertical center aligned yaxis label in Apache Echarts

Code I tried

yAxis: [
        {
            type: "value",
            name: "(x1000)",
            nameLocation: "middle",
            nameGap: 50,
            axisLabel: {
                textStyle: {
                    color: "red",
                },
            },
        },
    ],

but it changed the color of 0,0.2,0.4 etc values. I don't want that to change that but only the (x1000) label. Can anyone help me to solve this issue

答案1

得分: 0

尝试以下配置:

yAxis: [
    {
        type: "value",
        name: "(x1000)",
        nameLocation: "middle",
        nameGap: 50,
        nameTextStyle: {
            color: "red",
            fontFamily: "sans-serif"
        },
    },
],
英文:

try this config:

yAxis: [
        {
            type: "value",
            name: "(x1000)",
            nameLocation: "middle",
            nameGap: 50,
            nameTextStyle: {
                color: "red",
                fontFamily: "sans-serif"
            },
        },
    ],

huangapple
  • 本文由 发表于 2023年2月8日 13:31:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/75381691.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定