and thanks for your time.
I would like to do this that you can see in the picture.
I have the values for the labels in array and values for the yAxes in other array. The labels show the 59 minutes of the hour, and i want to show only the minutes (05, 10, 15, 20 .....etc) I can push in the array only this time values, but then when i put the "times" in the labels in chartjs, the chart only show 12 values in yAxes, and i want to show the 59 values in yAxes and only this xAxes...
if i do this:
import { Fragment } from "react";
import { Line } from "react-chartjs-2";
import "./GraficosDemo.css";
const GraficosDemo = ({ datosMeteoGraf, rotuloGrafico }) => {
var colors = [
"#007bff",
"#0097fc",
"#333333",
"#c3e6cb",
"#dc3545",
"#ed872d",
];
if (!datosMeteoGraf) return null;
const dataSetTWS = [];
const dataSetTWS_GUST = [];
const minutos = [];
//GRAFICO DE INTENSIDAD DE VIENTO
for (let i = 0; i < datosMeteoGraf.length; i++) {
dataSetTWS.push(datosMeteoGraf.TWS[i]);
}
//GRAFICO DE INTENSIDAD DE RACHAS DE VIENTO
for (let i = 0; i < datosMeteoGraf.length; i++) {
dataSetTWS_GUST.push(datosMeteoGraf.TWS_GUST[i]);
}
// console.log(dataSetTWS_GUST);
for (let i = 0; i < datosMeteoGraf.length; i++) {
if((new Date (datosMeteoGraf.TIME[i]).getMinutes()) % 5 === 0){
minutos.push(new Date(datosMeteoGraf.TIME[i]).toTimeString().slice(0, 5))
}
}
return (
<Fragment>
<Line
data={{
labels: minutos,
datasets:[
{
borderWidth: 0,
label: "Intensidad Última Hora",
data: dataSetTWS,
backgroundColor: "transparent",
borderColor: colors[1],
pointStyle: "dash",
},
{
borderWidth: 0,
label: "Intensidad Rachas de Viento",
data: dataSetTWS_GUST,
backgroundColor: "transparent",
borderColor: colors[4],
pointStyle: "dash",
},
],
}}
height={250}
options={{
maintainAspectRatio: false,
scales: {
yAxes: [
{
ticks: {
beginAtZero: true,
stepSize: 1,
},
},
],
xAxes: [
{
display:true,
}
]
},
}}
/>
</Fragment>
);
};
export default GraficosDemo;
i have this:
push in time array only the minutes multiples of 5
But i would like to keep all my values and show only this labels. Like in the picture at the top.
Could someone help me please? Thanks