show less time ticks on mobile

This commit is contained in:
Skip R. 2018-07-13 12:10:00 -07:00
parent f3f500b344
commit ebc142a94c
No known key found for this signature in database
GPG key ID: 1508C19D7436A26D

View file

@ -23,6 +23,10 @@ export default class Graph extends Component {
];
}
isSmallScreen() {
return window.innerWidth < 500;
}
render() {
return (
<div className="graph-container">
@ -46,8 +50,9 @@ export default class Graph extends Component {
axisBottom={{
format: (epoch) => {
const interval = this.isSmallScreen() ? 7 : 5;
const minutesAgo = Math.floor((Date.now() - epoch) / (1000 * 60));
if (minutesAgo % 5 !== 0 || minutesAgo === 0) {
if (minutesAgo % interval !== 0 || minutesAgo === 0) {
return undefined;
}