胜利图表,如何更改轴和标签颜色

Osc*_*nco 4 javascript victory-charts

这应该是一件非常简单的事情,但是对于我的生活我无法达到我想要的效果,我有一个图表,在深色背景上,这意味着我想将标签的颜色更改为白色,但是我无法做到这一点。

在此处输入图片说明

我正在使用的代码:

<VictoryChart
            width={WIDTH}
          // theme={VictoryTheme.material}
          >
            {/* <VictoryBar data={data} x="quarter" y="earnings" /> */}
            <VictoryArea data={outcome} x="quarter" y="earnings" style={{ data: { fill: '#0074B7', fillOpacity: 0.7, stroke: '#0C7BBB', strokeWidth: 1 } }} />
            {/* <VictoryArea data={income} x="quarter" y="earnings" style={{ data: { fill: '#9BC578', fillOpacity: 0.7, stroke: '#37B875', strokeWidth: 1 } }} /> */}
          </VictoryChart>
Run Code Online (Sandbox Code Playgroud)

任何帮助表示赞赏。

Jos*_*ose 8

我让我的图表数字改变,但我使用自定义主题来做它,但我想它是相似的。我在下面发布了一个例子

const chartTheme = {
  axis: {
    style: {
      tickLabels: {
        // this changed the color of my numbers to white
        fill: 'white',
      },
    },
  },
};


      <VictoryChart theme={ chartTheme }>
        <VictoryAxis label="Body Weight" />
        <VictoryAxis dependentAxis label="Time" />
        <VictoryLine
          data={ [
            { x: 1, y: 2 },
            { x: 2, y: 3 },
            { x: 3, y: 5 },
            { x: 4, y: 4 },
            { x: 5, y: 7 },
          ] }
        />
      </VictoryChart>
Run Code Online (Sandbox Code Playgroud)