hide odd hours in small screen

This commit is contained in:
Damien Elmes 2020-08-05 18:58:31 +10:00
parent 818012e015
commit 365e584db8
2 changed files with 12 additions and 1 deletions

View file

@ -67,6 +67,9 @@ body {
@media only screen and (max-width: 600px) { @media only screen and (max-width: 600px) {
.tick text { .tick text {
font-size: 15px; font-size: 15px;
.tick-odd {
display: none;
} }
} }

View file

@ -85,7 +85,15 @@ export function renderHours(
.paddingInner(0.1); .paddingInner(0.1);
svg.select<SVGGElement>(".x-ticks") svg.select<SVGGElement>(".x-ticks")
.transition(trans) .transition(trans)
.call(axisBottom(x).tickSizeOuter(0)); .call(axisBottom(x).tickSizeOuter(0))
.selectAll("text")
.attr("class", (n: any) => {
if (n % 2 != 0) {
return "tick-odd";
} else {
return "";
}
});
const cappedRange = scaleLinear().range([0.1, 0.8]); const cappedRange = scaleLinear().range([0.1, 0.8]);
const colour = scaleSequential((n) => interpolateBlues(cappedRange(n))).domain([ const colour = scaleSequential((n) => interpolateBlues(cappedRange(n))).domain([