How can I accurately display daily working hours for a person, using input data of date and duration worked in seconds?
I am facing difficulty determining the offset for the duration displayed on the graph. For instance, if a person starts work at 9:30 am and finishes at 6pm, is there a method to show the bar from 9:30 until 6pm?
Furthermore, I am unsure if my current approach to the issue is correct.
Below is the code snippet I am currently using.
var chart = c3.generate({
data: {
x: 'x',
columns: [
['x', '2018-01-01', '2018-01-02', '2018-01-03', '2018-01-04', '2018-01-05', '2018-01-06'],
['Hours Worked', 35000, 37000, 29000, 32000, 33500, 0]
],
type:'bar'
},
axis: {
x: {
type: 'timeseries'
},
y: {
tick : {
format : function (y) {
var format = d3.time.format("%H:%M");
return format(new Date(new Date('01-01-2016 00:00:00').getTime() + (y * 1000)));
}
},
min:25200,
max:75600,
}
}
});
You can access the full code here https://jsfiddle.net/s66amhvv/3/.