Angular ng2-chart with line chart using type category

31 Views Asked by At

im using chart (ng2-chart) with line chart, in options i using type category in xScales -> xAxes

{
   type: "category",
   labels: this.optionLabelsXAxis,
    ticks: {
     beginAtZero: true,
     callback: (value) => {
       return this.displayGraphX(value, this.getGroups)
     }
    }
}

optionLabelsXAxis = [1695834000000,1695848400000,1695862800000,1695877200000,1695891600000,1695906000000,1695920400000,1695934800000,1695949200000,1695963600000,1695978000000,1695992400000,1696006800000] (format in epoch)

Labels = [0,0,0,0,0,1695893280000,0,0,0,0,1695961500000,0,0,1695979680000,1695985200000,1695988800000,0,1695993900000,1696004700000,0]

Data = [0,0,0,0,0,0.16,0,0,0,0,9.16,0,0,0.16,9.888,9.89,0,9.81,9.16,0]

and result is like this Result Is like this

problem is its wrong place, first data is 1695893280000 (Thursday, September 28, 2023 4:28:00 PM) and places in chart with wrong place, any suggest for fix that ? rest all data in wrong place and example should be right is Result should be like this

0

There are 0 best solutions below