mirror of
https://github.com/apache/superset.git
synced 2026-04-20 16:44:46 +00:00
feat(plugin-chart-echarts): support non-timeseries x-axis (#17917)
* feat(plugin-chart-echarts): support non-timeseries x-axis * fix tests * change formula return type from Date to number * add x_axis test coverage * rename func and improve coverage * add x-axis control to bar chart * remove redundant console.log * fix description * make x-axis control mandatory * 🙃 * fix x-axis formatter * fix showValues * fix implicit rDTTM_ALIAS references in postProcessing * replace TIME_COLUMN with DTTM_ALIAS * fix remaining implicit indexes * fix: Disable filtering on wide result sets (#18021) * fix: handle null values in time-series table (#18039) * cleanup column_type_mappings (#17569) Signed-off-by: Đặng Minh Dũng <dungdm93@live.com> * important change to MakeFile (#18037) * add missing is_timeseries to pivot op Co-authored-by: Erik Ritter <erik.ritter@airbnb.com> Co-authored-by: Grace Guo <grace.guo@airbnb.com> Co-authored-by: Đặng Minh Dũng <dungdm93@live.com> Co-authored-by: AAfghahi <48933336+AAfghahi@users.noreply.github.com>
This commit is contained in:
@@ -22,10 +22,7 @@ import {
|
||||
PostProcessingResample,
|
||||
QueryFormData,
|
||||
} from '@superset-ui/core';
|
||||
import {
|
||||
rollingWindowOperator,
|
||||
TIME_COLUMN,
|
||||
} from '@superset-ui/chart-controls';
|
||||
import { rollingWindowOperator } from '@superset-ui/chart-controls';
|
||||
|
||||
const TIME_GRAIN_MAP: Record<string, string> = {
|
||||
PT1S: 'S',
|
||||
@@ -65,7 +62,7 @@ export default function buildQuery(formData: QueryFormData) {
|
||||
method: 'asfreq',
|
||||
rule,
|
||||
fill_value: null,
|
||||
time_column: TIME_COLUMN,
|
||||
time_column: DTTM_ALIAS,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
import {
|
||||
DTTM_ALIAS,
|
||||
extractTimegrain,
|
||||
getNumberFormatter,
|
||||
NumberFormats,
|
||||
@@ -54,7 +55,6 @@ export function renderTooltipFactory(
|
||||
};
|
||||
}
|
||||
|
||||
const TIME_COLUMN = '__timestamp';
|
||||
const formatPercentChange = getNumberFormatter(
|
||||
NumberFormats.PERCENT_SIGNED_1_POINT,
|
||||
);
|
||||
@@ -97,7 +97,7 @@ export default function transformProps(
|
||||
let trendLineData;
|
||||
let percentChange = 0;
|
||||
let bigNumber = data.length === 0 ? null : data[0][metricName];
|
||||
let timestamp = data.length === 0 ? null : data[0][TIME_COLUMN];
|
||||
let timestamp = data.length === 0 ? null : data[0][DTTM_ALIAS];
|
||||
let bigNumberFallback;
|
||||
|
||||
const metricColtypeIndex = colnames.findIndex(name => name === metricName);
|
||||
@@ -106,7 +106,7 @@ export default function transformProps(
|
||||
|
||||
if (data.length > 0) {
|
||||
const sortedData = (data as BigNumberDatum[])
|
||||
.map(d => [d[TIME_COLUMN], parseMetricValue(d[metricName])])
|
||||
.map(d => [d[DTTM_ALIAS], parseMetricValue(d[metricName])])
|
||||
// sort in time descending order
|
||||
.sort((a, b) => (a[0] !== null && b[0] !== null ? b[0] - a[0] : 0));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user