0

默认情况下,Victory 将所有条形图分散在图表上: 在此处输入图像描述

和代码:

<VictoryChart
    width={650}
    theme={VictoryTheme.material}
    domainPadding={30}
  >
    <VictoryAxis
      tickFormat={data.map(x => x.title)}
      style={{
        axis: { stroke: 'rgb(236, 239, 241)', strokeWidth: 1, strokeDasharray: [10, 5]},
        grid: { stroke: false },
        ticks: { stroke: 'none', size: 0 },
        tickLabels: { fontSize: 12, padding: 15 }
      }}
    />
    <VictoryAxis
      crossAxis={false}
      domain={[0, 2000]}
      dependentAxis
      tickFormat={x => x}
      style={{
        axis: { stroke: false },
        axisLabel: { fontSize: 12, padding: 50 },
        ticks: { stroke: 'none', size: 0 },
        tickLabels: { size: 0, padding: 20 }
      }}
    />
    <VictoryBar
      data={dataset}
      y="value"
      x="title"
      style={{
        data: { fill: ({ datum }) => datum.color },
      }}
    />
  </VictoryChart>

如何使它们居中并使中间成为散射的入口点?我正在寻找类似根图表组件的对齐道具

4

0 回答 0