Last active
March 30, 2018 05:24
-
-
Save nvandoorn/e1cc25e9ac2716d209a2eb1540ddcbc1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const chartConfig = ( | |
parser, | |
dateFormatter | |
) => ({ | |
responsive: true, | |
maintainAspectRatio: false, | |
scales: { | |
xAxes: [ | |
{ | |
type: 'time', | |
ticks: { | |
maxTicksLimit: 4, | |
autoSkip: true | |
}, | |
time: { | |
displayFormats: { | |
day: 'ddd', | |
hour: 'ddd H:mm' | |
}, | |
parser, | |
tooltipFormat: dateFormatter | |
} | |
} | |
], | |
yAxes: [ | |
{ | |
ticks: { | |
beginAtZero: true | |
} | |
} | |
] | |
}, | |
hover: { | |
intersect: false | |
}, | |
tooltips: { | |
intersect: false | |
} | |
}) | |
const parseDate = (datetime, tz = moment.tz.guess()) => | |
moment.unix(datetime).tz(tz) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment