React-chartjs-2行上升

时间:2019-10-15 09:07:06

标签: reactjs react-chartjs

我对图表不是特别友好,因此我的问题可能微不足道。我需要建立一个从1到2的图形,然后才上升。我只是不知道该api,请告诉我该怎么做。

enter image description here enter image description here

这是我最能做的:

import React, {Component} from 'react';
import {Line} from 'react-chartjs-2';

const data = {
  datasets: [
    {
      fill: false,
      backgroundColor: 'rgba(75,192,192,0.4)',
      borderColor: 'rgba(75,192,192,1)',
      pointRadius: 1,
      data: [1, 1.5, 2]
    }
  ]
};

const chartOptions = {
  "tooltips": {
    "enabled": false,
  }
};

class LineChart extends Component {

  componentDidMount() {

  }

  render() {

    return (
      <>
        <Line
          data={data}
          options={chartOptions}
          width={300}
          height={250}
        />
      </>
    );
  }
}

export default LineChart;

0 个答案:

没有答案