From f5345fd4f30344eb8b5a5d5f76d1fceb1d501556 Mon Sep 17 00:00:00 2001 From: Gerard Burns Date: Thu, 18 Apr 2024 08:23:19 +0100 Subject: [PATCH] dont hide chart errors --- .../client/src/components/Component.svelte | 3 - .../components/app/charts/ApexChart.svelte | 64 ++----------------- 2 files changed, 5 insertions(+), 62 deletions(-) diff --git a/packages/client/src/components/Component.svelte b/packages/client/src/components/Component.svelte index de9ed4a7b8..43dda3729b 100644 --- a/packages/client/src/components/Component.svelte +++ b/packages/client/src/components/Component.svelte @@ -296,9 +296,6 @@ return false } - if (sectionDependsOnValue == null && sectionRealDependentValue == null) { - return false - } if (sectionDependsOnValue != null && sectionDependsOnValue !== sectionRealDependentValue) { return false } diff --git a/packages/client/src/components/app/charts/ApexChart.svelte b/packages/client/src/components/app/charts/ApexChart.svelte index 3f0ce221e5..2765fa2370 100644 --- a/packages/client/src/components/app/charts/ApexChart.svelte +++ b/packages/client/src/components/app/charts/ApexChart.svelte @@ -11,75 +11,27 @@ // Apex charts directly modifies the options object with default properties and internal variables. These being present could unintentionally cause issues to the provider of this prop as the changes are reflected in that component as well. To prevent any issues we clone this here to provide a buffer. $: optionsCopy = cloneDeep(options); - /* - export let invalid = false - - const parseValue = (value) => { - // A value like [10, 11, 12] actually would be output by parseInt as `10`, but this behaviour is odd and not something a - // reasonable user would expect. - if (Array.isArray(value)) { - return null; - } - - const parsedValue = parseInt(value, 10); - - if (Number.isNaN(parsedValue)) { - return null; - } - - return parsedValue - } - - const parseOptions = (optionsCopy) => { - const parsedOptions = { series: [], ...cloneDeep(optionsCopy)} - - // Object form of series, used by most charts - if (parsedOptions.series.some(entry => Array.isArray(entry?.data))) { - parsedOptions.series = parsedOptions.series.map(entry => ({ ...entry, data: parseValue})parseValue); - } else { - // Scalar form of series, used by non-axis charts like pie and donut - parsedOptions.series = parsedOptions.series.map(parseValue); - } - - return parsedOptions; - } - - $: parsedOptions = parseOptions(optionsCopy); - */ let chartElement; let chart; const updateChart = async (newOptions) => { - try { - await chart?.updateOptions(newOptions) - } catch(e) { - //console.log(e) - } + await chart?.updateOptions(newOptions) } const renderChart = async (newChartElement) => { - try { - await chart?.destroy() - chart = new ApexCharts(newChartElement, optionsCopy) - await chart.render() - } catch(e) { - //console.log(e) - } - } - - const isSeriesValid = (series) => { - return true + await chart?.destroy() + chart = new ApexCharts(newChartElement, optionsCopy) + await chart.render() } $: noData = optionsCopy == null || optionsCopy?.series?.length === 0 - $: hide = noData || !seriesValid + $: hide = noData // Call render chart upon changes to hide, as apex charts has issues with rendering upon changes automatically // if the chart is hidden. $: renderChart(chartElement, hide) $: updateChart(optionsCopy) - $: seriesValid = isSeriesValid(optionsCopy?.series || []) {#key optionsCopy?.customColor} @@ -89,13 +41,7 @@ Add rows to your data source to start using your component - {:else if $builderStore.inBuilder && !seriesValid} -
- - Your selected data cannot be displayed in this chart -
{/if} - {/key}