0

I actually wanted to populate a fixed date range between two different dates in X-Axis and I wanted to show the Scatter points in that range.

Here is the state :

  label: 'Scatter Dataset',
  data: {
      datasets: typeof this.props.data === 'object' && this.props.data !== null ? this.props.data.datasets: []
  },
  options: {
    scales: {
        xAxes: [{
            display: true,
            type: 'time',
            time: {
                unit: 'hour',
                displayFormats: {
                    hour: 'DD (HH:mm)'
                }
            },
            distribution: 'series'
        }],
        yAxes: [{
            scaleLabel: {
                display:     true,
                labelString: 'value'
            }
        }]
    },

React chart js 2

<Scatter ref="chart" data={this.state.data} options={this.state.options} style={{padding: 10}} height={80}/>

enter image description here

Ram sai
  • 21
  • 8
  • Does this answer your question? [How to set the xAxes min and max values of time cartesian chart in Chart.js](https://stackoverflow.com/questions/68702009/how-to-set-the-xaxes-min-and-max-values-of-time-cartesian-chart-in-chart-js) – LeeLenalee Nov 25 '21 at 11:21
  • I'm able to add the min and max range but it is not taking the min range, example the min date is Feb 2nd, 2021, and the max date is Feb 4 2021 but in the graph, it is taking the min date from 1st of Feb. – Ram sai Nov 29 '21 at 14:23

0 Answers0