echart Radar chart Axis Label

1.4k views Asked by At

I am wondering how to show labels only on one axis in echarts like this some other radar chart

If I do:

axisLabel: {
    show: true
}

All the labels from all the axis are shown

Or, is it possible to use polar RadialAxis and AngleAxis and show strait lines instead of round ones between axis. Like this: enter image description here

3

There are 3 answers

0
Itamar On
0
Sarah McKenzy On

I made a workaround if someone stumbles on my question. I added text graphic and placed it on chart. Like this: enter image description here

1
Youyou On

The solution would consist of adding the data you want to display into the indicator option, and then slicing the first element of the array and apply the axisLabel option on the first element only.

This is a portion of my workaround:

indicator: [
  {
    name: data[0].name,
    max: data[0].max,
    color: "white",
    axisLabel: {
      show: true,
      color: "grey"
    }
  },
  ...data.slice(1).map((elem) => ({
    name: elem.name,
    max: elem.max,
    color: "white"
  }))
]

You can find the complete solution here