React line chart with hours removed
<p>I want to remove every three hours from the bottom of the rope chart. I'm using react-chart-js2. I'm using the .map function to display these numbers. Is it possible to display only every three of them?
Chart</p>
<p>Here is the code that displays the hours: </p>
<pre class="brush:php;toolbar:false;">const data = {
labels: chart.prices?.map(x => moment(x[0]).format('h:mm a')),
datasets: [{
data: chart.prices?.map(x => x[1]),
backgroundColor: '#ffffff00',
borderColor: 'rgb(79 70 229)',
borderWidth: '2',
pointBorderColor: '#ffffff00',
tension: 0.4,
fill: {
target: "origin", // 3. Set the fill options
above: "rgba(79, 70, 229, 0.0625)"
}
}]
}</pre>
<p>I want only every third number to be displayed</p>