antvis / component

🍱 AntV UI component based on G render engine.
https://github.com/antvis/component
MIT License
59 stars 39 forks source link

feat: add cfg in formatter params #303

Closed pepper-nice closed 1 year ago

pepper-nice commented 1 year ago

功能描述

极端场景,当图表仅有一个一条数据时。坐标轴标签超长情况处理需要根据X轴整体宽度决定。所以提供 cfg 参数,供业务层做定制。

xAxis: {
  label: {
     formatter: (text, tick, index, ticks, cfg) => {
       const { start, end } = cfg;
       const axisWidth = Math.abs(end.x - start.x);
       // handle ellipse
     }
  }
}
image