javascriptechartsapache-echarts

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


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 enter image description here

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


Solution

  • try this config:

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