From e548ae732eb0acae34e01bf9f092f5aa34fb79fa Mon Sep 17 00:00:00 2001 From: Johnny D Date: Tue, 21 Jan 2025 12:38:47 -0500 Subject: [PATCH] set columns from API xAxisKey + yAxisKeys --- src/components/charts/chart.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/components/charts/chart.ts b/src/components/charts/chart.ts index ca2cad07..65904d83 100644 --- a/src/components/charts/chart.ts +++ b/src/components/charts/chart.ts @@ -516,7 +516,6 @@ export default class AstraChart extends ClassifiedElement { chart.layers[0].result = chart.result?.items const opts = chart.params?.options - this.type = chart.type this.data = chart this.keyX = opts?.xAxisKey @@ -527,11 +526,7 @@ export default class AstraChart extends ClassifiedElement { this.yAxisLabelDisplay = opts?.yAxisLabelHidden ? 'hidden' : this.yAxisLabelDisplay this.colorTheme = opts?.theme this.yAxisColors = opts?.yAxisKeyColors - - // extract column names [i.e. all the keys] - if (chart.result?.items && chart.result.items.length > 0) { - this.columns = Object.keys(chart.result?.items?.[0]) - } + this.columns = opts && opts.xAxisKey ? [opts.xAxisKey, ...(opts.yAxisKeys ?? [])] : [] this.initializeChart() })