Skip to content

Commit

Permalink
fix height & brush
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian committed Mar 26, 2024
1 parent f6abfbc commit 60c1baa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
<input type="text" placeholder="Suchbegriff" class="input" />
</section>
<section
class="col-span-full h-[85vh]"
class="col-span-full h-[88vh]"
bind:clientWidth={tableWidth}
bind:clientHeight={tableHeight}
>
Expand Down
17 changes: 7 additions & 10 deletions src/routes/Brush.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
let marginTop = 20;
let marginRight = 20;
let marginBottom = 20;
let marginLeft = 20;
let marginLeft = 28;
let chunkWidth = 18;
export let DATA_MIN = 1;
export let DATA_MAX = 827;
Expand Down Expand Up @@ -67,13 +67,10 @@
};
});
$: y = d3
.scaleBand(
data.map((d) => d.label),
[height - marginTop, marginBottom]
)
.paddingOuter(0.05)
.round(true);
$: y = d3.scaleBand(
data.map((d) => d.label),
[height - marginTop, marginBottom]
);
$: xChunk = d3.scaleLinear([0, numChunks], [marginLeft, width - marginRight]);
$: x = d3.scaleLinear([DATA_MIN, DATA_MAX], [marginLeft, width - marginRight]);
$: d3.select(gy).call(d3.axisLeft(y));
Expand All @@ -87,7 +84,7 @@
])
.on('brush', (/** @type {{ selection: [number, number]; }} */ e) => {
const selection = e.selection;
if (selection[1] - selection[0] < 150) {
if (selection[1] - selection[0] <= 180) {
const start = Math.round(x.invert(selection[0]));
const end = Math.round(x.invert(selection[1]));
Expand All @@ -96,7 +93,7 @@
})
.on('end', (/** @type {{ selection: [number, number]; }} */ e) => {
const selection = e.selection;
if (selection[1] - selection[0] > 150) {
if (selection[1] - selection[0] > 180) {
const start = Math.round(x.invert(selection[0]));
const end = Math.round(x.invert(selection[1]));
Expand Down
4 changes: 2 additions & 2 deletions src/routes/Devilstable.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@
}
</script>

<Brush {width} data={boolData} on:brush={(e) => (selection = e.detail)} />
<Brush height={200} {width} data={boolData} on:brush={(e) => (selection = e.detail)} />
<Detail
{width}
{height}
height={height - 200}
data={boolData.map((d) => {
return { label: d.label, values: d.values.slice(selection.start - 1, selection.end + 1) };
})}
Expand Down

0 comments on commit 60c1baa

Please sign in to comment.