rework clientwidth binds and size defaults for histograms

This commit is contained in:
Christoph Kluge
2024-10-08 18:46:59 +02:00
parent ed991de11a
commit f4102b948e
7 changed files with 86 additions and 119 deletions

View File

@@ -21,8 +21,8 @@
export let data;
export let usesBins = false;
export let width = 500;
export let height = 300;
export let width = null;
export let height = 250;
export let title = "";
export let xlabel = "";
export let xunit = "";
@@ -226,10 +226,13 @@
$: sizeChanged(width, height);
</script>
{#if data.length > 0}
<div bind:this={plotWrapper} />
{:else}
<Card class="mx-4" body color="warning"
>Cannot render histogram: No data!</Card
>
{/if}
<!-- Define Wrapper and NoData Card within $width -->
<div bind:clientWidth={width}>
{#if data.length > 0}
<div bind:this={plotWrapper} />
{:else}
<Card class="mx-4" body color="warning"
>Cannot render histogram: No data!</Card
>
{/if}
</div>