I am trying to plot a Stacked bar chart on every minute(24 hours) status change of a process, i.e. Running or Stop. Chart is having only y-axis with series in milliseconds. But It does not seems to plot the data as expected.
The data which is coming is like below:
19 x job process Stop NULL 2020-07-14 03:01:02.137 NULL
20 x job process Running NULL 2020-07-14 03:02:02.137 NULL
21 x job process Running NULL 2020-07-14 07:00:00.000 NULL
22 x job process Running NULL 2020-07-14 07:01:00.000 NULL
23 x job process Running NULL 2020-07-14 07:02:00.000 NULL
24 x job process Running NULL 2020-07-14 07:03:00.000 NULL
25 x job process Running NULL 2020-07-14 07:04:00.000 NULL
26 x job process Stop NULL 2020-07-14 07:05:00.000 NULL
27 x job process Running NULL 2020-07-14 07:06:00.000 NULL
28 x job process Running NULL 2020-07-14 07:07:00.000 NULL
29 x job process Running NULL 2020-07-14 07:08:00.000 NULL
Wher x is the job name and Running and stop is state. I am filtering this data in javascript to create my data series for chart, which is below:
data.forEach((element)=>{
if(element.State=="Running"){
var datetime = moment(element.CreatedDateTime).utc().valueOf();
statusSuccess.push(datetime)
}
else{
var datetime = moment(element.CreatedDateTime).utc().valueOf();
statusFailure.push(datetime)
}
});
The chart plotting and options creation is below:
Highcharts.chart('container', {
chart: {
type: 'bar'
},
title: {
text: "24 Hrs Status Variation For: "+this.resoucreName
},
credits: {
enabled: false
},
xAxis: {
},
yAxis: {
min:moment().subtract(1, 'days').utc().valueOf(),
dateTimeLabelFormats: {
second: '%A, %b %e, %H:%M:%S',
minute: '%A, %b %e, %H:%M',
hour: '%A, %b %e, %H',
day: '%H:%M:%S',
week: '%H:%M:%S',
month: '%H:%M:%S',
year: '%H:%M:%S'
}
},
tooltip: {
pointFormat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.y:%A, %b %e, %H:%M:%S}</b><br/>',
shared: true
},
legend: {
reversed: true
},
plotOptions: {
bar: {
stacking: 'normal'
}
},
series: [{
name: 'Success',
color:'#6FF3A3',
data: statusSuccess,
type: undefined,
},
{
name: 'Failed',
color:'#FF386C',
data: statusFailure,
type: undefined,
}
]
});
Below is the chart I am getting: Fiddle
But I am expecting like : ExpectedFiddle