diff --git a/packages/client/src/components/app/charts/PieChart.svelte b/packages/client/src/components/app/charts/PieChart.svelte index e14061407e..38a42ee37b 100644 --- a/packages/client/src/components/app/charts/PieChart.svelte +++ b/packages/client/src/components/app/charts/PieChart.svelte @@ -14,16 +14,44 @@ export let donut export let palette - $: options = setUpChart(dataProvider) + $: options = setUpChart( + title, + dataProvider, + labelColumn, + valueColumn, + height, + width, + dataLabels, + animate, + legend, + donut, + palette + ) - // Fetch data on mount - const setUpChart = provider => { - if (!provider || !provider.rows?.length || !labelColumn || !valueColumn) { + const setUpChart = ( + title, + dataProvider, + labelColumn, + valueColumn, + height, + width, + dataLabels, + animate, + legend, + donut, + palette + ) => { + if ( + !dataProvider || + !dataProvider.rows?.length || + !labelColumn || + !valueColumn + ) { return null } // Fetch, filter and sort data - const { schema, rows } = provider + const { schema, rows } = dataProvider const data = rows .filter(row => row[labelColumn] != null && row[valueColumn] != null) .slice(0, 100)