Skip to content

Commit

Permalink
optimize axes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Flick committed Mar 28, 2024
1 parent 559ab98 commit a7a700e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/routes/Brush.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
export let width = 400;
export let height = 150;
let marginTop = 20;
let marginRight = 20;
let marginRight = 0;
let marginBottom = 20;
let marginLeft = 28;
let chunkWidth = 18;
Expand Down
31 changes: 25 additions & 6 deletions src/routes/Detail.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
*/
export let data = [];
let marginTop = 20;
let marginRight = 20;
let marginRight = 0;
let marginBottom = 20;
let marginLeft = 25;
let marginLeft = 35;
/**
* @type {SVGGElement}
Expand Down Expand Up @@ -91,8 +91,15 @@
);
$: manuscript = scaleBandInvert(x)(mousePos[0]);
$: d3.select(gy).call(d3.axisLeft(y));
$: d3.select(gx).call(d3.axisBottom(x));
$: d3.select(gy)
.call(
d3
.axisRight(y)
.ticks(20)
.tickSize(width - marginLeft - marginRight)
)
.call((g) => g.selectAll('.tick text').attr('x', -25));
$: d3.select(gx).call(d3.axisTop(x));
$: verse = Math.floor(y.invert(mousePos[1]));
</script>
Expand All @@ -112,10 +119,11 @@
floating.style.opacity = '0';
}}
role="application"
class="mt-6"
>
<svg {width} {height}>
<g bind:this={gx} transform="translate(0,{height - marginBottom})" />
<g bind:this={gy} transform="translate({marginLeft},0)" />
<g bind:this={gx} transform="translate(0,{marginTop})" class="x-axis" />
<g bind:this={gy} transform="translate({marginLeft},0)" class="y-axis" />
{#each data as sigla}
<g data-manuscript={sigla.label}>
{#each sigla.values as hasVerse, i}
Expand Down Expand Up @@ -161,3 +169,14 @@
{/each}
</svg>
</div>
<style>
.x-axis :global(text) {
font-size: 1rem;
}
.y-axis :global(.tick line) {
stroke-opacity: 0.5;
stroke-dasharray: 2, 2;
}
</style>
6 changes: 6 additions & 0 deletions src/routes/Devilstable.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,9 @@
})}
data_start={selection.start}
/>

<style>
:global(.tick text) {
font-size: 0.75rem;
}
</style>

0 comments on commit a7a700e

Please sign in to comment.