Skip to content

Instantly share code, notes, and snippets.

@nvandoorn
Last active March 30, 2018 05:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nvandoorn/e1cc25e9ac2716d209a2eb1540ddcbc1 to your computer and use it in GitHub Desktop.
Save nvandoorn/e1cc25e9ac2716d209a2eb1540ddcbc1 to your computer and use it in GitHub Desktop.
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