echarts icon indicating copy to clipboard operation
echarts copied to clipboard

[Feature] Custom axis label position

Open outsiderzy opened this issue 3 years ago • 0 comments

What problem does this feature solve?

I have a requirement. The axis tick display Monday of the week, and now i want to display the week number in the middle of the two ticks. Similar to add label above Minor Ticks. My data is like this: ["year":"2022", "week": 52, "monday": "2022/12/26"].

need your help, thanks a lot.

无标题

What does the proposed API look like?

xAxis: {
  axisLabel: {
      show: true,
      offset: '50%',
      formatter: function(value, index) {
          var year = _data.Week.Data[index].Year;
          var week = _data.Week.Data[index].Week;
          return `${year}\nWeek ${week}`;
      }
  },
  // or
  minorTick: {
      show: true,
      labelText: "2022\nWeek 26",
      splitNumber: 2,
      length: 0
  }
}

outsiderzy avatar Aug 03 '22 07:08 outsiderzy