diff --git a/packages/lib/src/components/results/ChartComponent.wc.svelte b/packages/lib/src/components/results/ChartComponent.wc.svelte index d2582b7..a7d6d0d 100644 --- a/packages/lib/src/components/results/ChartComponent.wc.svelte +++ b/packages/lib/src/components/results/ChartComponent.wc.svelte @@ -78,6 +78,9 @@ /** * initialize the chart */ + + let noDataAvailable: boolean = false; + let canvas!: HTMLCanvasElement; let chart: Chart; @@ -391,7 +394,10 @@ * @param responseStore - the response store */ const setChartData = (responseStore: ResponseStore): void => { - if (responseStore.size === 0) return; + if (responseStore.size === 0) { + noDataAvailable = true; + return; + } let isDataAvailable: boolean = false; @@ -399,7 +405,12 @@ if (value.data !== null) isDataAvailable = true; }); - if (!isDataAvailable) return; + if (!isDataAvailable) { + noDataAvailable = true; + return; + } + + noDataAvailable = false; let chartLabels: string[] = []; @@ -589,6 +600,11 @@ {#if options.hintText} {/if} + + {#if noDataAvailable} +

No Data Available

+ {/if} + + +