0

我正在尝试为我的反应项目创建一个图形组件。虽然我指定tickAmount为 10,但它显示了从 1 到 300 的所有数字。它应该只打印 10 个数据点:

       this.state = {
        //    data/:[],
        options: {
            chart: {
              id: "basic-bar"
            },
            xaxis: {
              categories: this.props.options, 
              interval: 50,
               width:1000,
              hideOverlappingLabels: true,
              tickAmount: 10,
              tickPlacement: 'between',
          },
        },
        //   options:,
          series:this.props.series
        };
      }
    render() {

        return (
            <React.Fragment>
             <Chart
              options={this.state.options}
              series={this.state.series}

              type="area"
              width="1000"
            />
            </React.Fragment>
        )
    }
}
4

1 回答 1

1

如果您在类别中提供数值,您还应该设置xaxis.type: 'numeric'

xaxis: {
    type: 'numeric',
    tickAmount: 10,
}
于 2019-09-14T13:51:12.800 回答