show less time ticks on mobile
This commit is contained in:
parent
f3f500b344
commit
ebc142a94c
1 changed files with 6 additions and 1 deletions
|
@ -23,6 +23,10 @@ export default class Graph extends Component {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isSmallScreen() {
|
||||||
|
return window.innerWidth < 500;
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div className="graph-container">
|
<div className="graph-container">
|
||||||
|
@ -46,8 +50,9 @@ export default class Graph extends Component {
|
||||||
|
|
||||||
axisBottom={{
|
axisBottom={{
|
||||||
format: (epoch) => {
|
format: (epoch) => {
|
||||||
|
const interval = this.isSmallScreen() ? 7 : 5;
|
||||||
const minutesAgo = Math.floor((Date.now() - epoch) / (1000 * 60));
|
const minutesAgo = Math.floor((Date.now() - epoch) / (1000 * 60));
|
||||||
if (minutesAgo % 5 !== 0 || minutesAgo === 0) {
|
if (minutesAgo % interval !== 0 || minutesAgo === 0) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue