feat: add period of three days

This commit is contained in:
Nikola Ubavic 2022-08-10 23:20:45 +02:00 committed by Rafael
parent a29f3fc13c
commit f079a2926b
2 changed files with 9 additions and 0 deletions

View file

@ -34,11 +34,13 @@ const REPRESENTING_OPTIONS = [
] ]
const PERIOD_OPTIONS = [ const PERIOD_OPTIONS = [
{ code: 'day', display: 'Last 24 hours' }, { code: 'day', display: 'Last 24 hours' },
{ code: 'threeDays', display: 'Last 3 days' },
{ code: 'week', display: 'Last 7 days' }, { code: 'week', display: 'Last 7 days' },
{ code: 'month', display: 'Last 30 days' } { code: 'month', display: 'Last 30 days' }
] ]
const TIME_OPTIONS = { const TIME_OPTIONS = {
day: DAY, day: DAY,
threeDays: 3 * DAY,
week: WEEK, week: WEEK,
month: MONTH month: MONTH
} }

View file

@ -46,6 +46,7 @@ const Graph = ({
const periodDomains = { const periodDomains = {
day: [NOW - DAY, NOW], day: [NOW - DAY, NOW],
threeDays: [NOW - 3 * DAY, NOW],
week: [NOW - WEEK, NOW], week: [NOW - WEEK, NOW],
month: [NOW - MONTH, NOW] month: [NOW - MONTH, NOW]
} }
@ -58,6 +59,12 @@ const Graph = ({
tick: d3.utcHour.every(1), tick: d3.utcHour.every(1),
labelFormat: '%H:%M' labelFormat: '%H:%M'
}, },
threeDays: {
freq: 12,
step: 6 * 60 * 60 * 1000,
tick: d3.utcDay.every(1),
labelFormat: '%a %d'
},
week: { week: {
freq: 7, freq: 7,
step: 24 * 60 * 60 * 1000, step: 24 * 60 * 60 * 1000,