show less time ticks on mobile

This commit is contained in:
slice 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
1 changed files with 6 additions and 1 deletions

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;
}