fix: custom SQL in the XAxis (#21847)

This commit is contained in:
Yongjie Zhao
2022-10-19 11:40:52 +08:00
committed by GitHub
parent b77335494a
commit 0a4ecca9f2
13 changed files with 50 additions and 23 deletions

View File

@@ -19,7 +19,7 @@
import {
buildQueryContext,
ensureIsArray,
getXAxis,
getXAxisColumn,
isXAxisSet,
QueryFormData,
} from '@superset-ui/core';
@@ -35,7 +35,9 @@ export default function buildQuery(formData: QueryFormData) {
{
...baseQueryObject,
columns: [
...(isXAxisSet(formData) ? ensureIsArray(getXAxis(formData)) : []),
...(isXAxisSet(formData)
? ensureIsArray(getXAxisColumn(formData))
: []),
],
...(isXAxisSet(formData) ? {} : { is_timeseries: true }),
post_processing: [

View File

@@ -26,7 +26,7 @@ import {
smartDateVerboseFormatter,
NumberFormatter,
TimeFormatter,
getXAxis,
getXAxisLabel,
} from '@superset-ui/core';
import { EChartsCoreOption, graphic } from 'echarts';
import {
@@ -102,7 +102,7 @@ export default function transformProps(
const { r, g, b } = colorPicker;
const mainColor = `rgb(${r}, ${g}, ${b})`;
const timeColumn = getXAxis(rawFormData) as string;
const timeColumn = getXAxisLabel(rawFormData) as string;
let trendLineData;
let percentChange = 0;
let bigNumber = data.length === 0 ? null : data[0][metricName];