antvis/G2

axis.style 的回调属性返回 tick 值 #5045

pearmini posted onGitHub

  • 版本:5.0.7
export function alphabetIntervalAutoPaddingStyle(): G2Spec {
  return {
    type: 'interval',
    // padding: 'auto',
    transform: [{ type: 'sortX', by: 'y', reverse: true }],
    data: {
      type: 'fetch',
      value: 'data/alphabet.csv',
    },
    encode: {
      x: 'letter',
      y: 'frequency',
      color: 'steelblue',
    },
    axis: {
      y: {
        labelFormatter: (d) => d + '0000',
        style: {
          labelFontSize: 20,
          labelFill: (d) => {
            return (d > 0.06 ? 'red' : 'yellow') // 期待 d 是 tick 值,但目前是一个对象。
          },
        },
      },
      x: { labelFormatter: (d) => d + '0000' },
    },
  };
}

posted by pearmini almost 2 years ago

Fund this Issue

$0.00
Funded

Pull requests