refactor: Creates the VizType enum (#31193)
This commit is contained in:
parent
dbcb473040
commit
93ba8e16c3
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { QueryObject, SqlaFormData } from '@superset-ui/core';
|
||||
import { QueryObject, SqlaFormData, VizType } from '@superset-ui/core';
|
||||
import { boxplotOperator } from '@superset-ui/chart-controls';
|
||||
|
||||
const formData: SqlaFormData = {
|
||||
|
|
@ -27,7 +27,7 @@ const formData: SqlaFormData = {
|
|||
time_range: '2015 : 2016',
|
||||
time_grain_sqla: 'P1Y',
|
||||
datasource: 'foo',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
};
|
||||
const queryObject: QueryObject = {
|
||||
metrics: [
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { QueryObject, SqlaFormData } from '@superset-ui/core';
|
||||
import { QueryObject, SqlaFormData, VizType } from '@superset-ui/core';
|
||||
import { contributionOperator } from '@superset-ui/chart-controls';
|
||||
|
||||
const formData: SqlaFormData = {
|
||||
|
|
@ -27,7 +27,7 @@ const formData: SqlaFormData = {
|
|||
time_range: '2015 : 2016',
|
||||
granularity: 'month',
|
||||
datasource: 'foo',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
};
|
||||
const queryObject: QueryObject = {
|
||||
metrics: [
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { QueryObject, SqlaFormData } from '@superset-ui/core';
|
||||
import { QueryObject, SqlaFormData, VizType } from '@superset-ui/core';
|
||||
import { flattenOperator } from '@superset-ui/chart-controls';
|
||||
|
||||
const formData: SqlaFormData = {
|
||||
|
|
@ -27,7 +27,7 @@ const formData: SqlaFormData = {
|
|||
time_range: '2015 : 2016',
|
||||
granularity: 'month',
|
||||
datasource: 'foo',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
};
|
||||
const queryObject: QueryObject = {
|
||||
metrics: [
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
import { histogramOperator } from '@superset-ui/chart-controls';
|
||||
import { SqlaFormData } from '@superset-ui/core';
|
||||
import { SqlaFormData, VizType } from '@superset-ui/core';
|
||||
import { omit } from 'lodash';
|
||||
|
||||
const formData: SqlaFormData = {
|
||||
|
|
@ -26,7 +26,7 @@ const formData: SqlaFormData = {
|
|||
cumulative: true,
|
||||
normalize: true,
|
||||
groupby: ['country', 'region'],
|
||||
viz_type: 'histogram',
|
||||
viz_type: VizType.LegacyHistogram,
|
||||
datasource: 'foo',
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { QueryObject, SqlaFormData } from '@superset-ui/core';
|
||||
import { QueryObject, SqlaFormData, VizType } from '@superset-ui/core';
|
||||
import { pivotOperator } from '@superset-ui/chart-controls';
|
||||
|
||||
const formData: SqlaFormData = {
|
||||
|
|
@ -27,7 +27,7 @@ const formData: SqlaFormData = {
|
|||
time_range: '2015 : 2016',
|
||||
granularity: 'month',
|
||||
datasource: 'foo',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
show_empty_columns: true,
|
||||
};
|
||||
const queryObject: QueryObject = {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,12 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { DTTM_ALIAS, QueryObject, SqlaFormData } from '@superset-ui/core';
|
||||
import {
|
||||
DTTM_ALIAS,
|
||||
QueryObject,
|
||||
SqlaFormData,
|
||||
VizType,
|
||||
} from '@superset-ui/core';
|
||||
import { prophetOperator } from '@superset-ui/chart-controls';
|
||||
|
||||
const formData: SqlaFormData = {
|
||||
|
|
@ -27,7 +32,7 @@ const formData: SqlaFormData = {
|
|||
time_range: '2015 : 2016',
|
||||
time_grain_sqla: 'P1Y',
|
||||
datasource: 'foo',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
};
|
||||
const queryObject: QueryObject = {
|
||||
metrics: [
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { QueryObject, SqlaFormData } from '@superset-ui/core';
|
||||
import { QueryObject, SqlaFormData, VizType } from '@superset-ui/core';
|
||||
import { rankOperator } from '@superset-ui/chart-controls';
|
||||
|
||||
const formData: SqlaFormData = {
|
||||
|
|
@ -26,7 +26,7 @@ const formData: SqlaFormData = {
|
|||
time_range: '2015 : 2016',
|
||||
granularity: 'month',
|
||||
datasource: 'foo',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
truncate_metric: true,
|
||||
};
|
||||
const queryObject: QueryObject = {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,12 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { ComparisonType, QueryObject, SqlaFormData } from '@superset-ui/core';
|
||||
import {
|
||||
ComparisonType,
|
||||
QueryObject,
|
||||
SqlaFormData,
|
||||
VizType,
|
||||
} from '@superset-ui/core';
|
||||
import { renameOperator } from '@superset-ui/chart-controls';
|
||||
|
||||
const formData: SqlaFormData = {
|
||||
|
|
@ -26,7 +31,7 @@ const formData: SqlaFormData = {
|
|||
time_range: '2015 : 2016',
|
||||
granularity: 'month',
|
||||
datasource: 'foo',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
truncate_metric: true,
|
||||
};
|
||||
const queryObject: QueryObject = {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { QueryObject, SqlaFormData } from '@superset-ui/core';
|
||||
import { QueryObject, SqlaFormData, VizType } from '@superset-ui/core';
|
||||
import { resampleOperator } from '@superset-ui/chart-controls';
|
||||
|
||||
const formData: SqlaFormData = {
|
||||
|
|
@ -27,7 +27,7 @@ const formData: SqlaFormData = {
|
|||
time_range: '2015 : 2016',
|
||||
granularity: 'month',
|
||||
datasource: 'foo',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
};
|
||||
const queryObject: QueryObject = {
|
||||
metrics: [
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { QueryObject, SqlaFormData } from '@superset-ui/core';
|
||||
import { QueryObject, SqlaFormData, VizType } from '@superset-ui/core';
|
||||
import { rollingWindowOperator } from '@superset-ui/chart-controls';
|
||||
|
||||
const formData: SqlaFormData = {
|
||||
|
|
@ -27,7 +27,7 @@ const formData: SqlaFormData = {
|
|||
time_range: '2015 : 2016',
|
||||
granularity: 'month',
|
||||
datasource: 'foo',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
};
|
||||
const queryObject: QueryObject = {
|
||||
metrics: [
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { QueryObject, SqlaFormData } from '@superset-ui/core';
|
||||
import { QueryObject, SqlaFormData, VizType } from '@superset-ui/core';
|
||||
import { sortOperator } from '@superset-ui/chart-controls';
|
||||
|
||||
const formData: SqlaFormData = {
|
||||
|
|
@ -27,7 +27,7 @@ const formData: SqlaFormData = {
|
|||
time_range: '2015 : 2016',
|
||||
granularity: 'month',
|
||||
datasource: 'foo',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
};
|
||||
const queryObject: QueryObject = {
|
||||
metrics: [
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { QueryObject, SqlaFormData } from '@superset-ui/core';
|
||||
import { QueryObject, SqlaFormData, VizType } from '@superset-ui/core';
|
||||
import { timeCompareOperator } from '@superset-ui/chart-controls';
|
||||
|
||||
const formData: SqlaFormData = {
|
||||
|
|
@ -27,7 +27,7 @@ const formData: SqlaFormData = {
|
|||
time_range: '2015 : 2016',
|
||||
granularity: 'month',
|
||||
datasource: 'foo',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
};
|
||||
const queryObject: QueryObject = {
|
||||
metrics: [
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { QueryObject, SqlaFormData } from '@superset-ui/core';
|
||||
import { QueryObject, SqlaFormData, VizType } from '@superset-ui/core';
|
||||
import {
|
||||
timeCompareOperator,
|
||||
timeComparePivotOperator,
|
||||
|
|
@ -30,7 +30,7 @@ const formData: SqlaFormData = {
|
|||
time_range: '2015 : 2016',
|
||||
granularity: 'month',
|
||||
datasource: 'foo',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
show_empty_columns: true,
|
||||
};
|
||||
const queryObject: QueryObject = {
|
||||
|
|
|
|||
|
|
@ -16,12 +16,12 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { QueryFormData, QueryFormMetric } from '@superset-ui/core';
|
||||
import { QueryFormData, QueryFormMetric, VizType } from '@superset-ui/core';
|
||||
import { extractExtraMetrics } from '@superset-ui/chart-controls';
|
||||
|
||||
const baseFormData: QueryFormData = {
|
||||
datasource: 'dummy',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
metrics: ['a', 'b'],
|
||||
columns: ['foo', 'bar'],
|
||||
limit: 100,
|
||||
|
|
|
|||
|
|
@ -17,11 +17,11 @@
|
|||
* under the License.
|
||||
*/
|
||||
import { isDerivedSeries } from '@superset-ui/chart-controls';
|
||||
import { SqlaFormData, ComparisonType } from '@superset-ui/core';
|
||||
import { SqlaFormData, ComparisonType, VizType } from '@superset-ui/core';
|
||||
|
||||
const formData: SqlaFormData = {
|
||||
datasource: 'foo',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
};
|
||||
const series = {
|
||||
id: 'metric__1 month ago',
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { VizType } from '@superset-ui/core';
|
||||
import { displayTimeRelatedControls } from '../../src';
|
||||
|
||||
const mockData = {
|
||||
|
|
@ -35,7 +36,7 @@ const mockData = {
|
|||
exportState: {},
|
||||
form_data: {
|
||||
datasource: '22__table',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -16,12 +16,12 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { QueryFormData } from '@superset-ui/core';
|
||||
import { QueryFormData, VizType } from '@superset-ui/core';
|
||||
import { getStandardizedControls } from '../../src';
|
||||
|
||||
const formData: QueryFormData = {
|
||||
datasource: '30__table',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
standardizedFormData: {
|
||||
controls: {
|
||||
metrics: ['count(*)', 'sum(sales)'],
|
||||
|
|
@ -34,7 +34,7 @@ const formData: QueryFormData = {
|
|||
test('without standardizedFormData', () => {
|
||||
getStandardizedControls().setStandardizedControls({
|
||||
datasource: '30__table',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
});
|
||||
expect(getStandardizedControls().controls).toEqual({
|
||||
metrics: [],
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ export { default as ChartDataProvider } from './components/ChartDataProvider';
|
|||
export * from './types/Base';
|
||||
export * from './types/TransformFunction';
|
||||
export * from './types/QueryResponse';
|
||||
export * from './types/VizType';
|
||||
|
||||
export { default as __hack_reexport_chart_Base } from './types/Base';
|
||||
export { default as __hack_reexport_chart_TransformFunction } from './types/TransformFunction';
|
||||
|
|
|
|||
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
export enum VizType {
|
||||
Area = 'echarts_area',
|
||||
Bar = 'echarts_timeseries_bar',
|
||||
BigNumber = 'big_number',
|
||||
BigNumberTotal = 'big_number_total',
|
||||
BigNumberPeriodOverPeriod = 'pop_kpi',
|
||||
BoxPlot = 'box_plot',
|
||||
Bubble = 'bubble_v2',
|
||||
Bullet = 'bullet',
|
||||
Calendar = 'cal_heatmap',
|
||||
Chord = 'chord',
|
||||
Compare = 'compare',
|
||||
CountryMap = 'country_map',
|
||||
DistBar = 'dist_bar',
|
||||
EventFlow = 'event_flow',
|
||||
Funnel = 'funnel',
|
||||
Gauge = 'gauge_chart',
|
||||
Graph = 'graph_chart',
|
||||
Handlebars = 'handlebars',
|
||||
Heatmap = 'heatmap_v2',
|
||||
Histogram = 'histogram_v2',
|
||||
Horizon = 'horizon',
|
||||
LegacyArea = 'area',
|
||||
LegacyBar = 'bar',
|
||||
LegacyBubble = 'bubble',
|
||||
LegacyHeatmap = 'heatmap',
|
||||
LegacyHistogram = 'histogram',
|
||||
LegacyLine = 'line',
|
||||
LegacySankey = 'sankey',
|
||||
Line = 'echarts_timeseries_line',
|
||||
MapBox = 'mapbox',
|
||||
MixedTimeseries = 'mixed_timeseries',
|
||||
PairedTTest = 'paired_ttest',
|
||||
ParallelCoordinates = 'para',
|
||||
Partition = 'partition',
|
||||
Pie = 'pie',
|
||||
PivotTable = 'pivot_table_v2',
|
||||
Radar = 'radar',
|
||||
Rose = 'rose',
|
||||
Sankey = 'sankey_v2',
|
||||
Scatter = 'echarts_timeseries_scatter',
|
||||
SmoothLine = 'echarts_timeseries_smooth',
|
||||
Step = 'echarts_timeseries_step',
|
||||
Sunburst = 'sunburst_v2',
|
||||
Table = 'table',
|
||||
TimePivot = 'time_pivot',
|
||||
TimeTable = 'time_table',
|
||||
Timeseries = 'echarts_timeseries',
|
||||
Tree = 'tree_chart',
|
||||
Treemap = 'treemap_v2',
|
||||
Waterfall = 'waterfall',
|
||||
WordCloud = 'word_cloud',
|
||||
WorldMap = 'world_map',
|
||||
}
|
||||
|
|
@ -28,6 +28,7 @@ import {
|
|||
getChartBuildQueryRegistry,
|
||||
getChartMetadataRegistry,
|
||||
ChartMetadata,
|
||||
VizType,
|
||||
} from '@superset-ui/core';
|
||||
|
||||
import { LOGIN_GLOB } from '../fixtures/constants';
|
||||
|
|
@ -86,13 +87,13 @@ describe('ChartClient', () => {
|
|||
sliceId,
|
||||
formData: {
|
||||
granularity: 'second',
|
||||
viz_type: 'bar',
|
||||
viz_type: VizType.LegacyBar,
|
||||
},
|
||||
}),
|
||||
).resolves.toEqual({
|
||||
...sankeyFormData,
|
||||
granularity: 'second',
|
||||
viz_type: 'bar',
|
||||
viz_type: VizType.LegacyBar,
|
||||
});
|
||||
});
|
||||
it('returns promise of formData if only formData was given', () =>
|
||||
|
|
@ -101,13 +102,13 @@ describe('ChartClient', () => {
|
|||
formData: {
|
||||
datasource: '1__table',
|
||||
granularity: 'minute',
|
||||
viz_type: 'line',
|
||||
viz_type: VizType.LegacyLine,
|
||||
},
|
||||
}),
|
||||
).resolves.toEqual({
|
||||
datasource: '1__table',
|
||||
granularity: 'minute',
|
||||
viz_type: 'line',
|
||||
viz_type: VizType.LegacyLine,
|
||||
}));
|
||||
it('rejects if none of sliceId or formData is specified', () =>
|
||||
expect(
|
||||
|
|
@ -120,12 +121,12 @@ describe('ChartClient', () => {
|
|||
describe('.loadQueryData(formData, options)', () => {
|
||||
it('returns a promise of query data for known chart type', () => {
|
||||
getChartMetadataRegistry().registerValue(
|
||||
'word_cloud',
|
||||
VizType.WordCloud,
|
||||
new ChartMetadata({ name: 'Word Cloud', thumbnail: '' }),
|
||||
);
|
||||
|
||||
getChartBuildQueryRegistry().registerValue(
|
||||
'word_cloud',
|
||||
VizType.WordCloud,
|
||||
(formData: QueryFormData) => buildQueryContext(formData),
|
||||
);
|
||||
fetchMock.post('glob:*/api/v1/chart/data', [
|
||||
|
|
@ -138,7 +139,7 @@ describe('ChartClient', () => {
|
|||
return expect(
|
||||
chartClient.loadQueryData({
|
||||
granularity: 'minute',
|
||||
viz_type: 'word_cloud',
|
||||
viz_type: VizType.WordCloud,
|
||||
datasource: '1__table',
|
||||
}),
|
||||
).resolves.toEqual([
|
||||
|
|
@ -255,7 +256,7 @@ describe('ChartClient', () => {
|
|||
it('loadAllDataNecessaryForAChart', () => {
|
||||
fetchMock.get(`glob:*/api/v1/form_data/?slice_id=${sliceId}`, {
|
||||
granularity: 'minute',
|
||||
viz_type: 'line',
|
||||
viz_type: VizType.LegacyLine,
|
||||
datasource: '1__table',
|
||||
color: 'living-coral',
|
||||
});
|
||||
|
|
@ -275,12 +276,12 @@ describe('ChartClient', () => {
|
|||
});
|
||||
|
||||
getChartMetadataRegistry().registerValue(
|
||||
'line',
|
||||
VizType.LegacyLine,
|
||||
new ChartMetadata({ name: 'Line', thumbnail: '.gif' }),
|
||||
);
|
||||
|
||||
getChartBuildQueryRegistry().registerValue(
|
||||
'line',
|
||||
VizType.LegacyLine,
|
||||
(formData: QueryFormData) => buildQueryContext(formData),
|
||||
);
|
||||
|
||||
|
|
@ -296,7 +297,7 @@ describe('ChartClient', () => {
|
|||
},
|
||||
formData: {
|
||||
granularity: 'minute',
|
||||
viz_type: 'line',
|
||||
viz_type: VizType.LegacyLine,
|
||||
datasource: '1__table',
|
||||
color: 'living-coral',
|
||||
},
|
||||
|
|
|
|||
|
|
@ -19,11 +19,11 @@
|
|||
|
||||
/* eslint sort-keys: 'off' */
|
||||
/** The form data defined here is based on default visualizations packaged with Apache Superset */
|
||||
import { TimeGranularity } from '@superset-ui/core';
|
||||
import { TimeGranularity, VizType } from '@superset-ui/core';
|
||||
|
||||
export const bigNumberFormData = {
|
||||
datasource: '3__table',
|
||||
viz_type: 'big_number',
|
||||
viz_type: VizType.BigNumber,
|
||||
slice_id: 54,
|
||||
granularity_sqla: 'ds',
|
||||
time_grain_sqla: TimeGranularity.DAY,
|
||||
|
|
@ -39,7 +39,7 @@ export const bigNumberFormData = {
|
|||
|
||||
export const wordCloudFormData = {
|
||||
datasource: '3__table',
|
||||
viz_type: 'word_cloud',
|
||||
viz_type: VizType.WordCloud,
|
||||
slice_id: 60,
|
||||
url_params: {},
|
||||
granularity_sqla: 'ds',
|
||||
|
|
@ -56,7 +56,7 @@ export const wordCloudFormData = {
|
|||
|
||||
export const sunburstFormData = {
|
||||
datasource: '2__table',
|
||||
viz_type: 'sunburst_v2',
|
||||
viz_type: VizType.Sunburst,
|
||||
slice_id: 47,
|
||||
url_params: {},
|
||||
granularity_sqla: 'year',
|
||||
|
|
@ -71,7 +71,7 @@ export const sunburstFormData = {
|
|||
|
||||
export const sankeyFormData = {
|
||||
datasource: '1__table',
|
||||
viz_type: 'sankey',
|
||||
viz_type: VizType.LegacySankey,
|
||||
slice_id: 1,
|
||||
url_params: {},
|
||||
granularity_sqla: null,
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import {
|
|||
QueryFormData,
|
||||
DatasourceType,
|
||||
supersetTheme,
|
||||
VizType,
|
||||
} from '@superset-ui/core';
|
||||
|
||||
describe('ChartPlugin', () => {
|
||||
|
|
@ -59,7 +60,7 @@ describe('ChartPlugin', () => {
|
|||
const FORM_DATA = {
|
||||
datasource: '1__table',
|
||||
granularity: 'day',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
};
|
||||
|
||||
it('creates a new plugin', () => {
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
import fetchMock from 'fetch-mock';
|
||||
import { VizType } from '@superset-ui/core';
|
||||
import { getFormData } from '../../../../src/query/api/legacy';
|
||||
|
||||
import setupClientForTest from '../setupClientForTest';
|
||||
|
|
@ -28,7 +29,7 @@ describe('getFormData()', () => {
|
|||
|
||||
const mockData = {
|
||||
datasource: '1__table',
|
||||
viz_type: 'sankey',
|
||||
viz_type: VizType.LegacySankey,
|
||||
slice_id: 1,
|
||||
url_params: {},
|
||||
granularity_sqla: null,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
import fetchMock from 'fetch-mock';
|
||||
import { buildQueryContext, ApiV1 } from '@superset-ui/core';
|
||||
import { buildQueryContext, ApiV1, VizType } from '@superset-ui/core';
|
||||
import setupClientForTest from '../setupClientForTest';
|
||||
|
||||
describe('API v1 > getChartData()', () => {
|
||||
|
|
@ -39,7 +39,7 @@ describe('API v1 > getChartData()', () => {
|
|||
const result = await ApiV1.getChartData(
|
||||
buildQueryContext({
|
||||
granularity: 'minute',
|
||||
viz_type: 'word_cloud',
|
||||
viz_type: VizType.WordCloud,
|
||||
datasource: '1__table',
|
||||
}),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { buildQueryContext } from '@superset-ui/core';
|
||||
import { buildQueryContext, VizType } from '@superset-ui/core';
|
||||
import * as queryModule from '../../src/query/normalizeTimeColumn';
|
||||
|
||||
describe('buildQueryContext', () => {
|
||||
|
|
@ -24,7 +24,7 @@ describe('buildQueryContext', () => {
|
|||
const queryContext = buildQueryContext({
|
||||
datasource: '5__table',
|
||||
granularity_sqla: 'ds',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
});
|
||||
expect(queryContext.datasource.id).toBe(5);
|
||||
expect(queryContext.datasource.type).toBe('table');
|
||||
|
|
@ -37,7 +37,7 @@ describe('buildQueryContext', () => {
|
|||
{
|
||||
datasource: '5__table',
|
||||
granularity_sqla: 'ds',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
source: 'source_column',
|
||||
source_category: 'source_category_column',
|
||||
target: 'target_column',
|
||||
|
|
@ -75,7 +75,7 @@ describe('buildQueryContext', () => {
|
|||
{
|
||||
datasource: '5__table',
|
||||
granularity_sqla: 'ds',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
source: 'source_column',
|
||||
source_category: 'source_category_column',
|
||||
target: 'target_column',
|
||||
|
|
@ -103,7 +103,7 @@ describe('buildQueryContext', () => {
|
|||
const queryContext = buildQueryContext(
|
||||
{
|
||||
datasource: '5__table',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
},
|
||||
() => [
|
||||
{
|
||||
|
|
@ -133,7 +133,7 @@ describe('buildQueryContext', () => {
|
|||
buildQueryContext(
|
||||
{
|
||||
datasource: '5__table',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
x_axis: 'axis',
|
||||
},
|
||||
() => [{}],
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import {
|
|||
AnnotationType,
|
||||
buildQueryObject,
|
||||
QueryObject,
|
||||
VizType,
|
||||
} from '@superset-ui/core';
|
||||
|
||||
describe('buildQueryObject', () => {
|
||||
|
|
@ -34,7 +35,7 @@ describe('buildQueryObject', () => {
|
|||
query = buildQueryObject({
|
||||
datasource: '5__table',
|
||||
granularity_sqla: 'ds',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
});
|
||||
expect(query.granularity).toEqual('ds');
|
||||
});
|
||||
|
|
@ -43,7 +44,7 @@ describe('buildQueryObject', () => {
|
|||
query = buildQueryObject({
|
||||
datasource: '5__table',
|
||||
granularity_sqla: 'ds',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
metric: 'sum__num',
|
||||
secondary_metric: 'avg__num',
|
||||
});
|
||||
|
|
@ -54,7 +55,7 @@ describe('buildQueryObject', () => {
|
|||
query = buildQueryObject({
|
||||
datasource: '5__table',
|
||||
granularity_sqla: 'ds',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
extra_filters: [{ col: 'abc', op: '==', val: 'qwerty' }],
|
||||
adhoc_filters: [
|
||||
{
|
||||
|
|
@ -88,7 +89,7 @@ describe('buildQueryObject', () => {
|
|||
{
|
||||
datasource: '5__table',
|
||||
granularity_sqla: 'ds',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
my_custom_metric_control: 'sum__num',
|
||||
},
|
||||
{ my_custom_metric_control: 'metrics' },
|
||||
|
|
@ -101,7 +102,7 @@ describe('buildQueryObject', () => {
|
|||
{
|
||||
datasource: '5__table',
|
||||
granularity_sqla: 'ds',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
metrics: ['sum__num'],
|
||||
my_custom_metric_control: 'avg__num',
|
||||
},
|
||||
|
|
@ -115,7 +116,7 @@ describe('buildQueryObject', () => {
|
|||
query = buildQueryObject({
|
||||
datasource: '5__table',
|
||||
granularity_sqla: 'ds',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
limit: series_limit,
|
||||
});
|
||||
expect(query.series_limit).toEqual(series_limit);
|
||||
|
|
@ -126,7 +127,7 @@ describe('buildQueryObject', () => {
|
|||
query = buildQueryObject({
|
||||
datasource: '5__table',
|
||||
granularity_sqla: 'ds',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
series_limit,
|
||||
});
|
||||
expect(query.series_limit).toEqual(series_limit);
|
||||
|
|
@ -137,7 +138,7 @@ describe('buildQueryObject', () => {
|
|||
query = buildQueryObject({
|
||||
datasource: '5__table',
|
||||
granularity_sqla: 'ds',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
order_desc: orderDesc,
|
||||
});
|
||||
expect(query.order_desc).toEqual(orderDesc);
|
||||
|
|
@ -148,7 +149,7 @@ describe('buildQueryObject', () => {
|
|||
query = buildQueryObject({
|
||||
datasource: '5__table',
|
||||
granularity_sqla: 'ds',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
timeseries_limit_metric: metric,
|
||||
});
|
||||
expect(query.series_limit_metric).toEqual(metric);
|
||||
|
|
@ -159,7 +160,7 @@ describe('buildQueryObject', () => {
|
|||
query = buildQueryObject({
|
||||
datasource: '5__table',
|
||||
granularity_sqla: 'ds',
|
||||
viz_type: 'pivot_table_v2',
|
||||
viz_type: VizType.PivotTable,
|
||||
series_limit_metric: metric,
|
||||
});
|
||||
expect(query.series_limit_metric).toEqual(metric);
|
||||
|
|
@ -170,7 +171,7 @@ describe('buildQueryObject', () => {
|
|||
query = buildQueryObject({
|
||||
datasource: '5__table',
|
||||
granularity_sqla: 'ds',
|
||||
viz_type: 'pivot_table_v2',
|
||||
viz_type: VizType.PivotTable,
|
||||
series_limit_metric: metric,
|
||||
});
|
||||
expect(query.series_limit_metric).toEqual(undefined);
|
||||
|
|
@ -180,7 +181,7 @@ describe('buildQueryObject', () => {
|
|||
const baseQuery = {
|
||||
datasource: '5__table',
|
||||
granularity_sqla: 'ds',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
row_limit: null,
|
||||
};
|
||||
|
||||
|
|
@ -267,7 +268,7 @@ describe('buildQueryObject', () => {
|
|||
query = buildQueryObject({
|
||||
datasource: '5__table',
|
||||
granularity_sqla: 'ds',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
annotation_layers: annotationLayers,
|
||||
});
|
||||
expect(query.annotation_layers).toEqual(annotationLayers);
|
||||
|
|
@ -278,7 +279,7 @@ describe('buildQueryObject', () => {
|
|||
buildQueryObject({
|
||||
datasource: '5__table',
|
||||
granularity_sqla: 'ds',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
url_params: { abc: '123' },
|
||||
}).url_params,
|
||||
).toEqual({ abc: '123' });
|
||||
|
|
@ -286,7 +287,7 @@ describe('buildQueryObject', () => {
|
|||
buildQueryObject({
|
||||
datasource: '5__table',
|
||||
granularity_sqla: 'ds',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
// @ts-expect-error
|
||||
url_params: null,
|
||||
}).url_params,
|
||||
|
|
@ -298,7 +299,7 @@ describe('buildQueryObject', () => {
|
|||
query = buildQueryObject({
|
||||
datasource: '5__table',
|
||||
granularity,
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
});
|
||||
expect(query.granularity).toEqual(granularity);
|
||||
});
|
||||
|
|
@ -308,7 +309,7 @@ describe('buildQueryObject', () => {
|
|||
query = buildQueryObject({
|
||||
datasource: '5__table',
|
||||
granularity_sqla: granularity,
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
});
|
||||
expect(query.granularity).toEqual(granularity);
|
||||
});
|
||||
|
|
@ -320,7 +321,7 @@ describe('buildQueryObject', () => {
|
|||
query = buildQueryObject({
|
||||
datasource: '5__table',
|
||||
granularity_sqla: 'ds',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
custom_params: customParams,
|
||||
});
|
||||
expect(query.custom_params).toEqual(customParams);
|
||||
|
|
|
|||
|
|
@ -16,11 +16,13 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { isXAxisSet } from '@superset-ui/core';
|
||||
import { isXAxisSet, VizType } from '@superset-ui/core';
|
||||
|
||||
test('isXAxisSet', () => {
|
||||
expect(isXAxisSet({ datasource: '123', viz_type: 'table' })).not.toBeTruthy();
|
||||
expect(
|
||||
isXAxisSet({ datasource: '123', viz_type: 'table', x_axis: 'axis' }),
|
||||
isXAxisSet({ datasource: '123', viz_type: VizType.Table }),
|
||||
).not.toBeTruthy();
|
||||
expect(
|
||||
isXAxisSet({ datasource: '123', viz_type: VizType.Table, x_axis: 'axis' }),
|
||||
).toBeTruthy();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -16,13 +16,13 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { normalizeOrderBy, QueryObject } from '@superset-ui/core';
|
||||
import { normalizeOrderBy, QueryObject, VizType } from '@superset-ui/core';
|
||||
|
||||
describe('normalizeOrderBy', () => {
|
||||
it('should not change original queryObject when orderby populated', () => {
|
||||
const query: QueryObject = {
|
||||
datasource: '5__table',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
time_range: '1 year ago : 2013',
|
||||
orderby: [['count(*)', true]],
|
||||
};
|
||||
|
|
@ -32,7 +32,7 @@ describe('normalizeOrderBy', () => {
|
|||
it('has series_limit_metric in queryObject', () => {
|
||||
const query: QueryObject = {
|
||||
datasource: '5__table',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
time_range: '1 year ago : 2013',
|
||||
metrics: ['count(*)'],
|
||||
series_limit_metric: {
|
||||
|
|
@ -50,7 +50,7 @@ describe('normalizeOrderBy', () => {
|
|||
expect(expectedQueryObject).not.toHaveProperty('order_desc');
|
||||
expect(expectedQueryObject).toEqual({
|
||||
datasource: '5__table',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
time_range: '1 year ago : 2013',
|
||||
metrics: ['count(*)'],
|
||||
orderby: [
|
||||
|
|
@ -72,7 +72,7 @@ describe('normalizeOrderBy', () => {
|
|||
it('should transform legacy_order_by in queryObject', () => {
|
||||
const query: QueryObject = {
|
||||
datasource: '5__table',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
time_range: '1 year ago : 2013',
|
||||
metrics: ['count(*)'],
|
||||
legacy_order_by: {
|
||||
|
|
@ -90,7 +90,7 @@ describe('normalizeOrderBy', () => {
|
|||
expect(expectedQueryObject).not.toHaveProperty('order_desc');
|
||||
expect(expectedQueryObject).toEqual({
|
||||
datasource: '5__table',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
time_range: '1 year ago : 2013',
|
||||
metrics: ['count(*)'],
|
||||
orderby: [
|
||||
|
|
@ -112,7 +112,7 @@ describe('normalizeOrderBy', () => {
|
|||
it('has metrics in queryObject', () => {
|
||||
const query: QueryObject = {
|
||||
datasource: '5__table',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
time_range: '1 year ago : 2013',
|
||||
metrics: ['count(*)'],
|
||||
order_desc: true,
|
||||
|
|
@ -122,7 +122,7 @@ describe('normalizeOrderBy', () => {
|
|||
expect(expectedQueryObject).not.toHaveProperty('order_desc');
|
||||
expect(expectedQueryObject).toEqual({
|
||||
datasource: '5__table',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
time_range: '1 year ago : 2013',
|
||||
metrics: ['count(*)'],
|
||||
orderby: [['count(*)', false]],
|
||||
|
|
@ -132,7 +132,7 @@ describe('normalizeOrderBy', () => {
|
|||
it('should not change', () => {
|
||||
const query: QueryObject = {
|
||||
datasource: '5__table',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
time_range: '1 year ago : 2013',
|
||||
};
|
||||
expect(normalizeOrderBy(query)).toEqual(query);
|
||||
|
|
@ -141,7 +141,7 @@ describe('normalizeOrderBy', () => {
|
|||
it('remove empty orderby', () => {
|
||||
const query: QueryObject = {
|
||||
datasource: '5__table',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
time_range: '1 year ago : 2013',
|
||||
orderby: [],
|
||||
};
|
||||
|
|
@ -151,7 +151,7 @@ describe('normalizeOrderBy', () => {
|
|||
it('remove orderby with an empty array', () => {
|
||||
const query: QueryObject = {
|
||||
datasource: '5__table',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
time_range: '1 year ago : 2013',
|
||||
orderby: [[]],
|
||||
};
|
||||
|
|
@ -161,7 +161,7 @@ describe('normalizeOrderBy', () => {
|
|||
it('remove orderby with an empty metric', () => {
|
||||
const query: QueryObject = {
|
||||
datasource: '5__table',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
time_range: '1 year ago : 2013',
|
||||
orderby: [['', true]],
|
||||
};
|
||||
|
|
@ -171,7 +171,7 @@ describe('normalizeOrderBy', () => {
|
|||
it('remove orderby with an empty adhoc metric', () => {
|
||||
const query: QueryObject = {
|
||||
datasource: '5__table',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
time_range: '1 year ago : 2013',
|
||||
orderby: [[{}, true]],
|
||||
};
|
||||
|
|
@ -181,7 +181,7 @@ describe('normalizeOrderBy', () => {
|
|||
it('remove orderby with an non-boolean type', () => {
|
||||
const query: QueryObject = {
|
||||
datasource: '5__table',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
time_range: '1 year ago : 2013',
|
||||
// @ts-ignore
|
||||
orderby: [['count(*)', 'true']],
|
||||
|
|
|
|||
|
|
@ -20,12 +20,13 @@ import {
|
|||
normalizeTimeColumn,
|
||||
QueryObject,
|
||||
SqlaFormData,
|
||||
VizType,
|
||||
} from '@superset-ui/core';
|
||||
|
||||
test('should return original QueryObject if x_axis is empty', () => {
|
||||
const formData: SqlaFormData = {
|
||||
datasource: '5__table',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
granularity: 'time_column',
|
||||
time_grain_sqla: 'P1Y',
|
||||
time_range: '1 year ago : 2013',
|
||||
|
|
@ -34,7 +35,7 @@ test('should return original QueryObject if x_axis is empty', () => {
|
|||
};
|
||||
const query: QueryObject = {
|
||||
datasource: '5__table',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
granularity: 'time_column',
|
||||
extras: {
|
||||
time_grain_sqla: 'P1Y',
|
||||
|
|
@ -51,7 +52,7 @@ test('should return original QueryObject if x_axis is empty', () => {
|
|||
test('should support different columns for x-axis and granularity', () => {
|
||||
const formData: SqlaFormData = {
|
||||
datasource: '5__table',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
granularity: 'time_column',
|
||||
time_grain_sqla: 'P1Y',
|
||||
time_range: '1 year ago : 2013',
|
||||
|
|
@ -61,7 +62,7 @@ test('should support different columns for x-axis and granularity', () => {
|
|||
};
|
||||
const query: QueryObject = {
|
||||
datasource: '5__table',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
granularity: 'time_column',
|
||||
extras: {
|
||||
time_grain_sqla: 'P1Y',
|
||||
|
|
@ -76,7 +77,7 @@ test('should support different columns for x-axis and granularity', () => {
|
|||
};
|
||||
expect(normalizeTimeColumn(formData, query)).toEqual({
|
||||
datasource: '5__table',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
granularity: 'time_column',
|
||||
extras: { where: '', having: '', time_grain_sqla: 'P1Y' },
|
||||
time_range: '1 year ago : 2013',
|
||||
|
|
@ -98,7 +99,7 @@ test('should support different columns for x-axis and granularity', () => {
|
|||
test('should support custom SQL in x-axis', () => {
|
||||
const formData: SqlaFormData = {
|
||||
datasource: '5__table',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
granularity: 'time_column',
|
||||
time_grain_sqla: 'P1Y',
|
||||
time_range: '1 year ago : 2013',
|
||||
|
|
@ -112,7 +113,7 @@ test('should support custom SQL in x-axis', () => {
|
|||
};
|
||||
const query: QueryObject = {
|
||||
datasource: '5__table',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
granularity: 'time_column',
|
||||
extras: {
|
||||
time_grain_sqla: 'P1Y',
|
||||
|
|
@ -134,7 +135,7 @@ test('should support custom SQL in x-axis', () => {
|
|||
};
|
||||
expect(normalizeTimeColumn(formData, query)).toEqual({
|
||||
datasource: '5__table',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
granularity: 'time_column',
|
||||
extras: { where: '', having: '', time_grain_sqla: 'P1Y' },
|
||||
time_range: '1 year ago : 2013',
|
||||
|
|
@ -156,7 +157,7 @@ test('should support custom SQL in x-axis', () => {
|
|||
test('fallback and invalid columns value', () => {
|
||||
const formData: SqlaFormData = {
|
||||
datasource: '5__table',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
granularity: 'time_column',
|
||||
time_grain_sqla: 'P1Y',
|
||||
time_range: '1 year ago : 2013',
|
||||
|
|
@ -170,7 +171,7 @@ test('fallback and invalid columns value', () => {
|
|||
};
|
||||
const query: QueryObject = {
|
||||
datasource: '5__table',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
granularity: 'time_column',
|
||||
extras: {
|
||||
time_grain_sqla: 'P1Y',
|
||||
|
|
|
|||
|
|
@ -17,11 +17,11 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { getComparisonFilters } from '@superset-ui/core';
|
||||
import { getComparisonFilters, VizType } from '@superset-ui/core';
|
||||
|
||||
const form_data = {
|
||||
datasource: '22__table',
|
||||
viz_type: 'pop_kpi',
|
||||
viz_type: VizType.BigNumberPeriodOverPeriod,
|
||||
slice_id: 97,
|
||||
url_params: {
|
||||
form_data_key:
|
||||
|
|
|
|||
|
|
@ -17,11 +17,15 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { getComparisonInfo, ComparisonTimeRangeType } from '@superset-ui/core';
|
||||
import {
|
||||
getComparisonInfo,
|
||||
ComparisonTimeRangeType,
|
||||
VizType,
|
||||
} from '@superset-ui/core';
|
||||
|
||||
const form_data = {
|
||||
datasource: '22__table',
|
||||
viz_type: 'pop_kpi',
|
||||
viz_type: VizType.BigNumberPeriodOverPeriod,
|
||||
slice_id: 97,
|
||||
url_params: {
|
||||
form_data_key:
|
||||
|
|
|
|||
|
|
@ -17,12 +17,12 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { SuperChart, VizType } from '@superset-ui/core';
|
||||
import ChordChartPlugin from '@superset-ui/legacy-plugin-chart-chord';
|
||||
import data from './data';
|
||||
import { withResizableChartDemo } from '../../../shared/components/ResizableChartDemo';
|
||||
|
||||
new ChordChartPlugin().configure({ key: 'chord' }).register();
|
||||
new ChordChartPlugin().configure({ key: VizType.Chord }).register();
|
||||
|
||||
export default {
|
||||
title: 'Legacy Chart Plugins/legacy-plugin-chart-chord',
|
||||
|
|
@ -31,7 +31,7 @@ export default {
|
|||
|
||||
export const basic = ({ width, height }) => (
|
||||
<SuperChart
|
||||
chartType="chord"
|
||||
chartType={VizType.Chord}
|
||||
width={width}
|
||||
height={height}
|
||||
queriesData={[{ data }]}
|
||||
|
|
|
|||
|
|
@ -17,12 +17,12 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { SuperChart, VizType } from '@superset-ui/core';
|
||||
import HeatmapChartPlugin from '@superset-ui/legacy-plugin-chart-heatmap';
|
||||
import ResizableChartDemo from '../../../shared/components/ResizableChartDemo';
|
||||
import data from './data';
|
||||
|
||||
new HeatmapChartPlugin().configure({ key: 'heatmap' }).register();
|
||||
new HeatmapChartPlugin().configure({ key: VizType.LegacyHeatmap }).register();
|
||||
|
||||
export default {
|
||||
title: 'Legacy Chart Plugins/legacy-plugin-chart-heatmap',
|
||||
|
|
@ -30,7 +30,7 @@ export default {
|
|||
|
||||
export const basic = () => (
|
||||
<SuperChart
|
||||
chartType="heatmap"
|
||||
chartType={VizType.LegacyHeatmap}
|
||||
width={500}
|
||||
height={500}
|
||||
formData={{
|
||||
|
|
@ -67,7 +67,7 @@ export const resizable = () => (
|
|||
<ResizableChartDemo>
|
||||
{({ width, height }) => (
|
||||
<SuperChart
|
||||
chartType="heatmap"
|
||||
chartType={VizType.LegacyHeatmap}
|
||||
width={width}
|
||||
height={height}
|
||||
formData={{
|
||||
|
|
@ -104,7 +104,7 @@ export const resizable = () => (
|
|||
|
||||
export const withNullData = () => (
|
||||
<SuperChart
|
||||
chartType="heatmap"
|
||||
chartType={VizType.LegacyHeatmap}
|
||||
width={500}
|
||||
height={500}
|
||||
formData={{
|
||||
|
|
|
|||
|
|
@ -18,11 +18,13 @@
|
|||
*/
|
||||
|
||||
/* eslint-disable no-magic-numbers */
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { SuperChart, VizType } from '@superset-ui/core';
|
||||
import HistogramChartPlugin from '@superset-ui/legacy-plugin-chart-histogram';
|
||||
import data from './data';
|
||||
|
||||
new HistogramChartPlugin().configure({ key: 'histogram' }).register();
|
||||
new HistogramChartPlugin()
|
||||
.configure({ key: VizType.LegacyHistogram })
|
||||
.register();
|
||||
|
||||
export default {
|
||||
title: 'Legacy Chart Plugins/legacy-plugin-chart-histogram',
|
||||
|
|
@ -30,7 +32,7 @@ export default {
|
|||
|
||||
export const basic = () => (
|
||||
<SuperChart
|
||||
chartType="histogram"
|
||||
chartType={VizType.LegacyHistogram}
|
||||
width={400}
|
||||
height={400}
|
||||
queriesData={[{ data }]}
|
||||
|
|
|
|||
|
|
@ -17,11 +17,11 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { SuperChart, VizType } from '@superset-ui/core';
|
||||
import HorizonChartPlugin from '@superset-ui/legacy-plugin-chart-horizon';
|
||||
import data from './data';
|
||||
|
||||
new HorizonChartPlugin().configure({ key: 'horizon' }).register();
|
||||
new HorizonChartPlugin().configure({ key: VizType.Horizon }).register();
|
||||
|
||||
export default {
|
||||
title: 'Legacy Chart Plugins/legacy-plugin-chart-horizon',
|
||||
|
|
@ -29,7 +29,7 @@ export default {
|
|||
|
||||
export const basic = () => (
|
||||
<SuperChart
|
||||
chartType="horizon"
|
||||
chartType={VizType.Horizon}
|
||||
width={400}
|
||||
height={400}
|
||||
queriesData={[{ data }]}
|
||||
|
|
|
|||
|
|
@ -17,12 +17,12 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { SuperChart, VizType } from '@superset-ui/core';
|
||||
import PartitionChartPlugin from '@superset-ui/legacy-plugin-chart-partition';
|
||||
import data from './data';
|
||||
import dummyDatasource from '../../../shared/dummyDatasource';
|
||||
|
||||
new PartitionChartPlugin().configure({ key: 'partition' }).register();
|
||||
new PartitionChartPlugin().configure({ key: VizType.Partition }).register();
|
||||
|
||||
export default {
|
||||
title: 'Legacy Chart Plugins/legacy-plugin-chart-partition',
|
||||
|
|
@ -30,7 +30,7 @@ export default {
|
|||
|
||||
export const basic = () => (
|
||||
<SuperChart
|
||||
chartType="partition"
|
||||
chartType={VizType.Partition}
|
||||
width={400}
|
||||
height={400}
|
||||
datasource={dummyDatasource}
|
||||
|
|
|
|||
|
|
@ -18,11 +18,11 @@
|
|||
*/
|
||||
|
||||
/* eslint-disable no-magic-numbers, sort-keys */
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { SuperChart, VizType } from '@superset-ui/core';
|
||||
import RoseChartPlugin from '@superset-ui/legacy-plugin-chart-rose';
|
||||
import data from './data';
|
||||
|
||||
new RoseChartPlugin().configure({ key: 'rose' }).register();
|
||||
new RoseChartPlugin().configure({ key: VizType.Rose }).register();
|
||||
|
||||
export default {
|
||||
title: 'Legacy Chart Plugins/legacy-plugin-chart-rose',
|
||||
|
|
@ -30,7 +30,7 @@ export default {
|
|||
|
||||
export const basic = () => (
|
||||
<SuperChart
|
||||
chartType="rose"
|
||||
chartType={VizType.Rose}
|
||||
width={400}
|
||||
height={400}
|
||||
queriesData={[{ data }]}
|
||||
|
|
|
|||
|
|
@ -18,12 +18,12 @@
|
|||
*/
|
||||
|
||||
/* eslint-disable no-magic-numbers */
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { SuperChart, VizType } from '@superset-ui/core';
|
||||
import SankeyChartPlugin from '@superset-ui/legacy-plugin-chart-sankey';
|
||||
import ResizableChartDemo from '../../../shared/components/ResizableChartDemo';
|
||||
import data from './data';
|
||||
|
||||
new SankeyChartPlugin().configure({ key: 'sankey' }).register();
|
||||
new SankeyChartPlugin().configure({ key: VizType.LegacySankey }).register();
|
||||
|
||||
export default {
|
||||
title: 'Legacy Chart Plugins/legacy-plugin-chart-sankey',
|
||||
|
|
@ -31,7 +31,7 @@ export default {
|
|||
|
||||
export const basic = () => (
|
||||
<SuperChart
|
||||
chartType="sankey"
|
||||
chartType={VizType.LegacySankey}
|
||||
width={400}
|
||||
height={400}
|
||||
queriesData={[{ data }]}
|
||||
|
|
@ -45,7 +45,7 @@ export const resizable = () => (
|
|||
<ResizableChartDemo>
|
||||
{({ width, height }) => (
|
||||
<SuperChart
|
||||
chartType="sankey"
|
||||
chartType={VizType.LegacySankey}
|
||||
width={width}
|
||||
height={height}
|
||||
queriesData={[{ data }]}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { SuperChart, VizType } from '@superset-ui/core';
|
||||
import { BigNumberChartPlugin } from '@superset-ui/plugin-chart-echarts';
|
||||
import testData from './data';
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ const formData = {
|
|||
showTrendLine: true,
|
||||
startYAxisAtZero: true,
|
||||
timeGrainSqla: 'P1Y',
|
||||
vizType: 'big_number',
|
||||
vizType: VizType.BigNumber,
|
||||
yAxisFormat: '.3s',
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { SuperChart, VizType } from '@superset-ui/core';
|
||||
import { BigNumberTotalChartPlugin } from '@superset-ui/plugin-chart-echarts';
|
||||
import data from './data';
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ export const totalBasic = () => (
|
|||
formData={{
|
||||
metric: 'sum__num',
|
||||
subheader: 'total female participants',
|
||||
vizType: 'big_number_total',
|
||||
vizType: VizType.BigNumberTotal,
|
||||
yAxisFormat: '.3s',
|
||||
}}
|
||||
/>
|
||||
|
|
@ -52,7 +52,7 @@ export const totalNoData = () => (
|
|||
formData={{
|
||||
metric: 'sum__num',
|
||||
subheader: 'total female participants',
|
||||
vizType: 'big_number_total',
|
||||
vizType: VizType.BigNumberTotal,
|
||||
yAxisFormat: '.3s',
|
||||
}}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -17,9 +17,10 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { VizType } from '@superset-ui/core';
|
||||
import { AreaChartPlugin } from '@superset-ui/legacy-preset-chart-nvd3';
|
||||
|
||||
new AreaChartPlugin().configure({ key: 'area' }).register();
|
||||
new AreaChartPlugin().configure({ key: VizType.LegacyArea }).register();
|
||||
|
||||
export default {
|
||||
title: 'Legacy Chart Plugins/legacy-preset-chart-nvd3/Area',
|
||||
|
|
|
|||
|
|
@ -17,13 +17,13 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { SuperChart, VizType } from '@superset-ui/core';
|
||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
||||
import data from '../data';
|
||||
|
||||
export const controlsShown = () => (
|
||||
<SuperChart
|
||||
chartType="area"
|
||||
chartType={VizType.LegacyArea}
|
||||
datasource={dummyDatasource}
|
||||
width={400}
|
||||
height={400}
|
||||
|
|
@ -40,7 +40,7 @@ export const controlsShown = () => (
|
|||
showControls: true,
|
||||
showLegend: true,
|
||||
stackedStyle: 'stack',
|
||||
vizType: 'area',
|
||||
vizType: VizType.LegacyArea,
|
||||
xAxisFormat: '%Y',
|
||||
xAxisLabel: '',
|
||||
xAxisShowminmax: false,
|
||||
|
|
|
|||
|
|
@ -17,13 +17,13 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { SuperChart, VizType } from '@superset-ui/core';
|
||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
||||
import data from '../data';
|
||||
|
||||
export const expanded = () => (
|
||||
<SuperChart
|
||||
chartType="area"
|
||||
chartType={VizType.LegacyArea}
|
||||
datasource={dummyDatasource}
|
||||
width={400}
|
||||
height={400}
|
||||
|
|
@ -40,7 +40,7 @@ export const expanded = () => (
|
|||
showControls: false,
|
||||
showLegend: true,
|
||||
stackedStyle: 'expand',
|
||||
vizType: 'area',
|
||||
vizType: VizType.LegacyArea,
|
||||
xAxisFormat: '%Y',
|
||||
xAxisLabel: '',
|
||||
xAxisShowminmax: false,
|
||||
|
|
|
|||
|
|
@ -17,14 +17,14 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { SuperChart, VizType } from '@superset-ui/core';
|
||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
||||
import data from '../data';
|
||||
|
||||
export const stacked = () => (
|
||||
<SuperChart
|
||||
id="stacked-area-chart"
|
||||
chartType="area"
|
||||
chartType={VizType.LegacyArea}
|
||||
datasource={dummyDatasource}
|
||||
width={400}
|
||||
height={400}
|
||||
|
|
@ -41,7 +41,7 @@ export const stacked = () => (
|
|||
showControls: false,
|
||||
showLegend: true,
|
||||
stackedStyle: 'stack',
|
||||
vizType: 'area',
|
||||
vizType: VizType.LegacyArea,
|
||||
xAxisFormat: '%Y',
|
||||
xAxisLabel: '',
|
||||
xAxisShowminmax: false,
|
||||
|
|
|
|||
|
|
@ -17,13 +17,13 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { SuperChart, VizType } from '@superset-ui/core';
|
||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
||||
import data from '../data';
|
||||
|
||||
export const stackedWithYAxisBounds = () => (
|
||||
<SuperChart
|
||||
chartType="area"
|
||||
chartType={VizType.LegacyArea}
|
||||
datasource={dummyDatasource}
|
||||
width={400}
|
||||
height={400}
|
||||
|
|
@ -40,7 +40,7 @@ export const stackedWithYAxisBounds = () => (
|
|||
showControls: false,
|
||||
showLegend: true,
|
||||
stackedStyle: 'stack',
|
||||
vizType: 'area',
|
||||
vizType: VizType.LegacyArea,
|
||||
xAxisFormat: '%Y',
|
||||
xAxisLabel: '',
|
||||
xAxisShowminmax: false,
|
||||
|
|
@ -56,7 +56,7 @@ stackedWithYAxisBounds.storyName = 'Stacked with yAxisBounds';
|
|||
|
||||
export const stackedWithYAxisBoundsMinOnly = () => (
|
||||
<SuperChart
|
||||
chartType="area"
|
||||
chartType={VizType.LegacyArea}
|
||||
datasource={dummyDatasource}
|
||||
width={400}
|
||||
height={400}
|
||||
|
|
@ -73,7 +73,7 @@ export const stackedWithYAxisBoundsMinOnly = () => (
|
|||
showControls: true,
|
||||
showLegend: true,
|
||||
stackedStyle: 'stack',
|
||||
vizType: 'area',
|
||||
vizType: VizType.LegacyArea,
|
||||
xAxisFormat: '%Y',
|
||||
xAxisLabel: '',
|
||||
xAxisShowminmax: false,
|
||||
|
|
|
|||
|
|
@ -17,9 +17,10 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { VizType } from '@superset-ui/core';
|
||||
import { BarChartPlugin } from '@superset-ui/legacy-preset-chart-nvd3';
|
||||
|
||||
new BarChartPlugin().configure({ key: 'bar' }).register();
|
||||
new BarChartPlugin().configure({ key: VizType.LegacyBar }).register();
|
||||
|
||||
export default {
|
||||
title: 'Legacy Chart Plugins/legacy-preset-chart-nvd3/Bar',
|
||||
|
|
|
|||
|
|
@ -17,13 +17,13 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { SuperChart, VizType } from '@superset-ui/core';
|
||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
||||
import data from '../data';
|
||||
|
||||
export const barWithPositiveAndNegativeValues = () => (
|
||||
<SuperChart
|
||||
chartType="bar"
|
||||
chartType={VizType.LegacyBar}
|
||||
width={400}
|
||||
height={400}
|
||||
datasource={dummyDatasource}
|
||||
|
|
@ -51,7 +51,7 @@ export const barWithPositiveAndNegativeValues = () => (
|
|||
showControls: false,
|
||||
showLegend: true,
|
||||
stackedStyle: 'stack',
|
||||
vizType: 'bar',
|
||||
vizType: VizType.LegacyBar,
|
||||
xAxisFormat: '%Y',
|
||||
xAxisLabel: '',
|
||||
xAxisShowminmax: false,
|
||||
|
|
|
|||
|
|
@ -17,13 +17,13 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { SuperChart, VizType } from '@superset-ui/core';
|
||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
||||
import data from '../data';
|
||||
|
||||
export const barWithValues = () => (
|
||||
<SuperChart
|
||||
chartType="bar"
|
||||
chartType={VizType.LegacyBar}
|
||||
width={400}
|
||||
height={400}
|
||||
datasource={dummyDatasource}
|
||||
|
|
@ -41,7 +41,7 @@ export const barWithValues = () => (
|
|||
showControls: false,
|
||||
showLegend: true,
|
||||
stackedStyle: 'stack',
|
||||
vizType: 'bar',
|
||||
vizType: VizType.LegacyBar,
|
||||
xAxisFormat: '%Y',
|
||||
xAxisLabel: '',
|
||||
xAxisShowminmax: false,
|
||||
|
|
|
|||
|
|
@ -17,13 +17,13 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { SuperChart, VizType } from '@superset-ui/core';
|
||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
||||
import data from '../data';
|
||||
|
||||
export const basic = () => (
|
||||
<SuperChart
|
||||
chartType="bar"
|
||||
chartType={VizType.LegacyBar}
|
||||
width={400}
|
||||
height={400}
|
||||
datasource={dummyDatasource}
|
||||
|
|
@ -41,7 +41,7 @@ export const basic = () => (
|
|||
showControls: false,
|
||||
showLegend: true,
|
||||
stackedStyle: 'stack',
|
||||
vizType: 'bar',
|
||||
vizType: VizType.LegacyBar,
|
||||
xAxisFormat: '%Y',
|
||||
xAxisLabel: '',
|
||||
xAxisShowminmax: false,
|
||||
|
|
|
|||
|
|
@ -17,13 +17,13 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { SuperChart, VizType } from '@superset-ui/core';
|
||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
||||
import data from '../data';
|
||||
|
||||
export const stackedBarWithValues = () => (
|
||||
<SuperChart
|
||||
chartType="bar"
|
||||
chartType={VizType.LegacyBar}
|
||||
width={400}
|
||||
height={400}
|
||||
datasource={dummyDatasource}
|
||||
|
|
@ -42,7 +42,7 @@ export const stackedBarWithValues = () => (
|
|||
showControls: false,
|
||||
showLegend: true,
|
||||
stackedStyle: 'stack',
|
||||
vizType: 'bar',
|
||||
vizType: VizType.LegacyBar,
|
||||
xAxisFormat: '%Y',
|
||||
xAxisLabel: '',
|
||||
xAxisShowminmax: false,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { SuperChart, VizType } from '@superset-ui/core';
|
||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
||||
import data from '../data';
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ export const basic = () => (
|
|||
queriesData={[{ data }]}
|
||||
formData={{
|
||||
colorScheme: 'd3Category10',
|
||||
vizType: 'box_plot',
|
||||
vizType: VizType.BoxPlot,
|
||||
whiskerOptions: 'Min/max (no outliers)',
|
||||
}}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -17,9 +17,10 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { VizType } from '@superset-ui/core';
|
||||
import { BubbleChartPlugin } from '@superset-ui/legacy-preset-chart-nvd3';
|
||||
|
||||
new BubbleChartPlugin().configure({ key: 'bubble' }).register();
|
||||
new BubbleChartPlugin().configure({ key: VizType.LegacyBubble }).register();
|
||||
|
||||
export default {
|
||||
title: 'Legacy Chart Plugins/legacy-preset-chart-nvd3/Bubble',
|
||||
|
|
|
|||
|
|
@ -17,13 +17,13 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { SuperChart, VizType } from '@superset-ui/core';
|
||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
||||
import data from '../data';
|
||||
|
||||
export const basic = () => (
|
||||
<SuperChart
|
||||
chartType="bubble"
|
||||
chartType={VizType.LegacyBubble}
|
||||
width={400}
|
||||
height={400}
|
||||
datasource={dummyDatasource}
|
||||
|
|
@ -38,7 +38,7 @@ export const basic = () => (
|
|||
series: 'region',
|
||||
showLegend: true,
|
||||
size: 'sum__SP_POP_TOTL',
|
||||
vizType: 'bubble',
|
||||
vizType: VizType.LegacyBubble,
|
||||
x: 'sum__SP_RUR_TOTL_ZS',
|
||||
xAxisFormat: '.3s',
|
||||
xAxisLabel: 'x-axis label',
|
||||
|
|
|
|||
|
|
@ -17,9 +17,10 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { VizType } from '@superset-ui/core';
|
||||
import { BulletChartPlugin } from '@superset-ui/legacy-preset-chart-nvd3';
|
||||
|
||||
new BulletChartPlugin().configure({ key: 'bullet' }).register();
|
||||
new BulletChartPlugin().configure({ key: VizType.Bullet }).register();
|
||||
|
||||
export default {
|
||||
title: 'Legacy Chart Plugins/legacy-preset-chart-nvd3/Bullet',
|
||||
|
|
|
|||
|
|
@ -17,13 +17,13 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { SuperChart, VizType } from '@superset-ui/core';
|
||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
||||
import data from '../data';
|
||||
|
||||
export const basic = () => (
|
||||
<SuperChart
|
||||
chartType="bullet"
|
||||
chartType={VizType.Bullet}
|
||||
width={400}
|
||||
height={400}
|
||||
datasource={dummyDatasource}
|
||||
|
|
@ -35,7 +35,7 @@ export const basic = () => (
|
|||
markers: '',
|
||||
rangeLabels: '',
|
||||
ranges: '',
|
||||
vizType: 'bullet',
|
||||
vizType: VizType.Bullet,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -17,9 +17,10 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { VizType } from '@superset-ui/core';
|
||||
import { CompareChartPlugin } from '@superset-ui/legacy-preset-chart-nvd3';
|
||||
|
||||
new CompareChartPlugin().configure({ key: 'compare' }).register();
|
||||
new CompareChartPlugin().configure({ key: VizType.Compare }).register();
|
||||
|
||||
export default {
|
||||
title: 'Legacy Chart Plugins/legacy-preset-chart-nvd3/Compare',
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { SuperChart, VizType } from '@superset-ui/core';
|
||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
||||
import data from '../data';
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ export const basic = () => (
|
|||
colorScheme: 'd3Category10',
|
||||
contribution: false,
|
||||
leftMargin: 'auto',
|
||||
vizType: 'compare',
|
||||
vizType: VizType.Compare,
|
||||
xAxisFormat: 'smart_date',
|
||||
xAxisLabel: '',
|
||||
xAxisShowminmax: false,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { SuperChart, VizType } from '@superset-ui/core';
|
||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
||||
|
||||
export const timeFormat = () => (
|
||||
|
|
@ -208,7 +208,7 @@ export const timeFormat = () => (
|
|||
]}
|
||||
formData={{
|
||||
datasource: '24771__table',
|
||||
vizType: 'compare',
|
||||
vizType: VizType.Compare,
|
||||
urlParams: {},
|
||||
timeRangeEndpoints: ['inclusive', 'exclusive'],
|
||||
granularitySqla: '__time',
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { SuperChart, VizType } from '@superset-ui/core';
|
||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
||||
import data from '../data';
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ export const basic = () => (
|
|||
showBarValue: false,
|
||||
showControls: false,
|
||||
showLegend: true,
|
||||
vizType: 'dist_bar',
|
||||
vizType: VizType.DistBar,
|
||||
xAxisLabel: 'ddd',
|
||||
xTicksLayout: 'auto',
|
||||
yAxisFormat: '.3s',
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { SuperChart, seedRandom } from '@superset-ui/core';
|
||||
import { SuperChart, VizType, seedRandom } from '@superset-ui/core';
|
||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
||||
|
||||
const data: {
|
||||
|
|
@ -51,7 +51,7 @@ export const manyBars = () => (
|
|||
colorScheme: 'd3Category10',
|
||||
showBarValue: false,
|
||||
showLegend: true,
|
||||
vizType: 'dist_bar',
|
||||
vizType: VizType.DistBar,
|
||||
xTicksLayout: 'auto',
|
||||
}}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -17,9 +17,10 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { VizType } from '@superset-ui/core';
|
||||
import { LineChartPlugin } from '@superset-ui/legacy-preset-chart-nvd3';
|
||||
|
||||
new LineChartPlugin().configure({ key: 'line' }).register();
|
||||
new LineChartPlugin().configure({ key: VizType.LegacyLine }).register();
|
||||
|
||||
export default {
|
||||
title: 'Legacy Chart Plugins/legacy-preset-chart-nvd3/Line',
|
||||
|
|
|
|||
|
|
@ -17,13 +17,13 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { SuperChart, VizType } from '@superset-ui/core';
|
||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
||||
import data from '../data';
|
||||
|
||||
export const basic = () => (
|
||||
<SuperChart
|
||||
chartType="line"
|
||||
chartType={VizType.LegacyLine}
|
||||
width={400}
|
||||
height={400}
|
||||
datasource={dummyDatasource}
|
||||
|
|
@ -37,7 +37,7 @@ export const basic = () => (
|
|||
showBrush: 'auto',
|
||||
showLegend: true,
|
||||
showMarkers: false,
|
||||
vizType: 'line',
|
||||
vizType: VizType.LegacyLine,
|
||||
xAxisFormat: 'smart_date',
|
||||
xAxisLabel: '',
|
||||
xAxisShowminmax: false,
|
||||
|
|
|
|||
|
|
@ -17,20 +17,20 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { SuperChart, VizType } from '@superset-ui/core';
|
||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
||||
import data from '../data';
|
||||
|
||||
export const logScale = () => (
|
||||
<SuperChart
|
||||
chartType="line"
|
||||
chartType={VizType.LegacyLine}
|
||||
width={400}
|
||||
height={400}
|
||||
datasource={dummyDatasource}
|
||||
queriesData={[{ data }]}
|
||||
formData={{
|
||||
richTooltip: true,
|
||||
vizType: 'line',
|
||||
vizType: VizType.LegacyLine,
|
||||
yAxisBounds: [1, 60000],
|
||||
yAxisFormat: ',d',
|
||||
yLogScale: true,
|
||||
|
|
|
|||
|
|
@ -17,13 +17,13 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { SuperChart, VizType } from '@superset-ui/core';
|
||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
||||
import data from '../data';
|
||||
|
||||
export const markers = () => (
|
||||
<SuperChart
|
||||
chartType="line"
|
||||
chartType={VizType.LegacyLine}
|
||||
width={400}
|
||||
height={400}
|
||||
datasource={dummyDatasource}
|
||||
|
|
@ -37,7 +37,7 @@ export const markers = () => (
|
|||
showBrush: 'auto',
|
||||
showLegend: true,
|
||||
showMarkers: true,
|
||||
vizType: 'line',
|
||||
vizType: VizType.LegacyLine,
|
||||
xAxisFormat: 'smart_date',
|
||||
xAxisLabel: '',
|
||||
xAxisShowminmax: false,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { SuperChart, VizType } from '@superset-ui/core';
|
||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
||||
import data from '../data';
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ export const yAxisBounds = () => (
|
|||
<h2>yAxisBounds</h2>
|
||||
<pre>yAxisBounds=undefined</pre>
|
||||
<SuperChart
|
||||
chartType="line"
|
||||
chartType={VizType.LegacyLine}
|
||||
width={400}
|
||||
height={200}
|
||||
datasource={dummyDatasource}
|
||||
|
|
@ -34,12 +34,12 @@ export const yAxisBounds = () => (
|
|||
formData={{
|
||||
richTooltip: true,
|
||||
showLegend: false,
|
||||
vizType: 'line',
|
||||
vizType: VizType.LegacyLine,
|
||||
}}
|
||||
/>
|
||||
<pre>yAxisBounds=[0, 60000]</pre>
|
||||
<SuperChart
|
||||
chartType="line"
|
||||
chartType={VizType.LegacyLine}
|
||||
width={400}
|
||||
height={200}
|
||||
datasource={dummyDatasource}
|
||||
|
|
@ -47,13 +47,13 @@ export const yAxisBounds = () => (
|
|||
formData={{
|
||||
richTooltip: true,
|
||||
showLegend: false,
|
||||
vizType: 'line',
|
||||
vizType: VizType.LegacyLine,
|
||||
yAxisBounds: [0, 60000],
|
||||
}}
|
||||
/>
|
||||
<pre>yAxisBounds=[null, 60000]</pre>
|
||||
<SuperChart
|
||||
chartType="line"
|
||||
chartType={VizType.LegacyLine}
|
||||
width={400}
|
||||
height={200}
|
||||
datasource={dummyDatasource}
|
||||
|
|
@ -61,13 +61,13 @@ export const yAxisBounds = () => (
|
|||
formData={{
|
||||
richTooltip: true,
|
||||
showLegend: false,
|
||||
vizType: 'line',
|
||||
vizType: VizType.LegacyLine,
|
||||
yAxisBounds: [null, 60000],
|
||||
}}
|
||||
/>
|
||||
<pre>yAxisBounds=[40000, null]</pre>
|
||||
<SuperChart
|
||||
chartType="line"
|
||||
chartType={VizType.LegacyLine}
|
||||
width={400}
|
||||
height={200}
|
||||
datasource={dummyDatasource}
|
||||
|
|
@ -75,13 +75,13 @@ export const yAxisBounds = () => (
|
|||
formData={{
|
||||
richTooltip: true,
|
||||
showLegend: false,
|
||||
vizType: 'line',
|
||||
vizType: VizType.LegacyLine,
|
||||
yAxisBounds: [40000, null],
|
||||
}}
|
||||
/>
|
||||
<pre>yAxisBounds=[40000, null] with Legend</pre>
|
||||
<SuperChart
|
||||
chartType="line"
|
||||
chartType={VizType.LegacyLine}
|
||||
width={400}
|
||||
height={200}
|
||||
datasource={dummyDatasource}
|
||||
|
|
@ -89,7 +89,7 @@ export const yAxisBounds = () => (
|
|||
formData={{
|
||||
richTooltip: true,
|
||||
showLegend: true,
|
||||
vizType: 'line',
|
||||
vizType: VizType.LegacyLine,
|
||||
yAxisBounds: [40000, null],
|
||||
}}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -17,9 +17,10 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { VizType } from '@superset-ui/core';
|
||||
import { PieChartPlugin } from '@superset-ui/legacy-preset-chart-nvd3';
|
||||
|
||||
new PieChartPlugin().configure({ key: 'pie' }).register();
|
||||
new PieChartPlugin().configure({ key: VizType.Pie }).register();
|
||||
|
||||
export default {
|
||||
title: 'Legacy Chart Plugins/legacy-preset-chart-nvd3/Pie',
|
||||
|
|
|
|||
|
|
@ -17,13 +17,13 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { SuperChart, VizType } from '@superset-ui/core';
|
||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
||||
import data from '../data';
|
||||
|
||||
export const basic = () => (
|
||||
<SuperChart
|
||||
chartType="pie"
|
||||
chartType={VizType.Pie}
|
||||
width={400}
|
||||
height={400}
|
||||
datasource={dummyDatasource}
|
||||
|
|
@ -36,7 +36,7 @@ export const basic = () => (
|
|||
pieLabelType: 'key',
|
||||
showLabels: true,
|
||||
showLegend: true,
|
||||
vizType: 'pie',
|
||||
vizType: VizType.Pie,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -17,12 +17,12 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { SuperChart, VizType } from '@superset-ui/core';
|
||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
||||
|
||||
export const noData = () => (
|
||||
<SuperChart
|
||||
chartType="pie"
|
||||
chartType={VizType.Pie}
|
||||
width={400}
|
||||
height={400}
|
||||
datasource={dummyDatasource}
|
||||
|
|
@ -35,7 +35,7 @@ export const noData = () => (
|
|||
pieLabelType: 'key',
|
||||
showLabels: true,
|
||||
showLegend: true,
|
||||
vizType: 'pie',
|
||||
vizType: VizType.Pie,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,11 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { SuperChart, getChartTransformPropsRegistry } from '@superset-ui/core';
|
||||
import {
|
||||
SuperChart,
|
||||
getChartTransformPropsRegistry,
|
||||
VizType,
|
||||
} from '@superset-ui/core';
|
||||
import {
|
||||
EchartsAreaChartPlugin,
|
||||
TimeseriesTransformProps,
|
||||
|
|
@ -25,10 +29,10 @@ import {
|
|||
import data from './data';
|
||||
import { withResizableChartDemo } from '../../../../shared/components/ResizableChartDemo';
|
||||
|
||||
new EchartsAreaChartPlugin().configure({ key: 'echarts_area' }).register();
|
||||
new EchartsAreaChartPlugin().configure({ key: VizType.Area }).register();
|
||||
|
||||
getChartTransformPropsRegistry().registerValue(
|
||||
'echarts_area',
|
||||
VizType.Area,
|
||||
TimeseriesTransformProps,
|
||||
);
|
||||
|
||||
|
|
@ -169,7 +173,7 @@ export const AreaSeries = (
|
|||
.filter(row => forecastEnabled || !!row.Boston);
|
||||
return (
|
||||
<SuperChart
|
||||
chartType="echarts_area"
|
||||
chartType={VizType.Area}
|
||||
width={width}
|
||||
height={height}
|
||||
queriesData={[{ data: queryData }]}
|
||||
|
|
|
|||
|
|
@ -20,14 +20,18 @@ import {
|
|||
EchartsBubbleChartPlugin,
|
||||
BubbleTransformProps,
|
||||
} from '@superset-ui/plugin-chart-echarts';
|
||||
import { SuperChart, getChartTransformPropsRegistry } from '@superset-ui/core';
|
||||
import {
|
||||
SuperChart,
|
||||
VizType,
|
||||
getChartTransformPropsRegistry,
|
||||
} from '@superset-ui/core';
|
||||
import { simpleBubbleData } from './data';
|
||||
import { withResizableChartDemo } from '../../../../shared/components/ResizableChartDemo';
|
||||
|
||||
new EchartsBubbleChartPlugin().configure({ key: 'bubble_v2' }).register();
|
||||
new EchartsBubbleChartPlugin().configure({ key: VizType.Bubble }).register();
|
||||
|
||||
getChartTransformPropsRegistry().registerValue(
|
||||
'bubble_v2',
|
||||
VizType.Bubble,
|
||||
BubbleTransformProps,
|
||||
);
|
||||
|
||||
|
|
@ -104,7 +108,7 @@ export const BubbleChart = (
|
|||
{ width, height }: { width: number; height: number },
|
||||
) => (
|
||||
<SuperChart
|
||||
chartType="bubble_v2"
|
||||
chartType={VizType.Bubble}
|
||||
width={width}
|
||||
height={height}
|
||||
queriesData={[{ data: simpleBubbleData }]}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,11 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { SuperChart, getChartTransformPropsRegistry } from '@superset-ui/core';
|
||||
import {
|
||||
SuperChart,
|
||||
VizType,
|
||||
getChartTransformPropsRegistry,
|
||||
} from '@superset-ui/core';
|
||||
import {
|
||||
EchartsFunnelChartPlugin,
|
||||
FunnelTransformProps,
|
||||
|
|
@ -25,10 +29,10 @@ import {
|
|||
import { dataSource } from './constants';
|
||||
import { withResizableChartDemo } from '../../../../shared/components/ResizableChartDemo';
|
||||
|
||||
new EchartsFunnelChartPlugin().configure({ key: 'echarts-funnel' }).register();
|
||||
new EchartsFunnelChartPlugin().configure({ key: VizType.Funnel }).register();
|
||||
|
||||
getChartTransformPropsRegistry().registerValue(
|
||||
'echarts-funnel',
|
||||
VizType.Funnel,
|
||||
FunnelTransformProps,
|
||||
);
|
||||
|
||||
|
|
@ -88,7 +92,7 @@ export const Funnel = (
|
|||
{ width, height }: { width: number; height: number },
|
||||
) => (
|
||||
<SuperChart
|
||||
chartType="echarts-funnel"
|
||||
chartType={VizType.Funnel}
|
||||
width={width}
|
||||
height={height}
|
||||
queriesData={[{ data: dataSource }]}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,11 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { SuperChart, getChartTransformPropsRegistry } from '@superset-ui/core';
|
||||
import {
|
||||
SuperChart,
|
||||
VizType,
|
||||
getChartTransformPropsRegistry,
|
||||
} from '@superset-ui/core';
|
||||
import {
|
||||
EchartsPieChartPlugin,
|
||||
PieTransformProps,
|
||||
|
|
@ -25,12 +29,9 @@ import {
|
|||
import { weekday, population, sales } from './data';
|
||||
import { withResizableChartDemo } from '../../../../shared/components/ResizableChartDemo';
|
||||
|
||||
new EchartsPieChartPlugin().configure({ key: 'echarts-pie' }).register();
|
||||
new EchartsPieChartPlugin().configure({ key: VizType.Pie }).register();
|
||||
|
||||
getChartTransformPropsRegistry().registerValue(
|
||||
'echarts-pie',
|
||||
PieTransformProps,
|
||||
);
|
||||
getChartTransformPropsRegistry().registerValue(VizType.Pie, PieTransformProps);
|
||||
|
||||
export default {
|
||||
title: 'Chart Plugins/plugin-chart-echarts/Pie',
|
||||
|
|
@ -60,7 +61,7 @@ export const WeekdayPie = (
|
|||
{ width, height }: { width: number; height: number },
|
||||
) => (
|
||||
<SuperChart
|
||||
chartType="echarts-pie"
|
||||
chartType={VizType.Pie}
|
||||
width={width}
|
||||
height={height}
|
||||
queriesData={[{ data: weekday }]}
|
||||
|
|
@ -138,7 +139,7 @@ export const PopulationPie = (
|
|||
{ width, height }: { width: number; height: number },
|
||||
) => (
|
||||
<SuperChart
|
||||
chartType="echarts-pie"
|
||||
chartType={VizType.Pie}
|
||||
width={width}
|
||||
height={height}
|
||||
queriesData={[{ data: population }]}
|
||||
|
|
@ -218,7 +219,7 @@ export const SalesPie = (
|
|||
{ width, height }: { width: number; height: number },
|
||||
) => (
|
||||
<SuperChart
|
||||
chartType="echarts-pie"
|
||||
chartType={VizType.Pie}
|
||||
width={width}
|
||||
height={height}
|
||||
queriesData={[{ data: sales }]}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,11 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { SuperChart, getChartTransformPropsRegistry } from '@superset-ui/core';
|
||||
import {
|
||||
SuperChart,
|
||||
VizType,
|
||||
getChartTransformPropsRegistry,
|
||||
} from '@superset-ui/core';
|
||||
import {
|
||||
EchartsRadarChartPlugin,
|
||||
RadarTransformProps,
|
||||
|
|
@ -25,10 +29,10 @@ import {
|
|||
import { withResizableChartDemo } from '../../../../shared/components/ResizableChartDemo';
|
||||
import { basic } from './data';
|
||||
|
||||
new EchartsRadarChartPlugin().configure({ key: 'echarts-radar' }).register();
|
||||
new EchartsRadarChartPlugin().configure({ key: VizType.Radar }).register();
|
||||
|
||||
getChartTransformPropsRegistry().registerValue(
|
||||
'echarts-radar',
|
||||
VizType.Radar,
|
||||
RadarTransformProps,
|
||||
);
|
||||
|
||||
|
|
@ -39,7 +43,7 @@ export default {
|
|||
|
||||
export const Radar = ({ width, height }) => (
|
||||
<SuperChart
|
||||
chartType="echarts-radar"
|
||||
chartType={VizType.Radar}
|
||||
width={width}
|
||||
height={height}
|
||||
queriesData={[{ data: basic }]}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,11 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { SuperChart, getChartTransformPropsRegistry } from '@superset-ui/core';
|
||||
import {
|
||||
SuperChart,
|
||||
VizType,
|
||||
getChartTransformPropsRegistry,
|
||||
} from '@superset-ui/core';
|
||||
import {
|
||||
EchartsWaterfallChartPlugin,
|
||||
WaterfallTransformProps,
|
||||
|
|
@ -25,11 +29,11 @@ import data from './data';
|
|||
import { withResizableChartDemo } from '../../../../shared/components/ResizableChartDemo';
|
||||
|
||||
new EchartsWaterfallChartPlugin()
|
||||
.configure({ key: 'echarts-waterfall' })
|
||||
.configure({ key: VizType.Waterfall })
|
||||
.register();
|
||||
|
||||
getChartTransformPropsRegistry().registerValue(
|
||||
'echarts-waterfall',
|
||||
VizType.Waterfall,
|
||||
WaterfallTransformProps,
|
||||
);
|
||||
|
||||
|
|
@ -40,7 +44,7 @@ export default {
|
|||
|
||||
export const Waterfall = ({ width, height }) => (
|
||||
<SuperChart
|
||||
chartType="echarts-waterfall"
|
||||
chartType={VizType.Waterfall}
|
||||
width={width}
|
||||
height={height}
|
||||
queriesData={[{ data }]}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { SuperChart, VizType } from '@superset-ui/core';
|
||||
import { PivotTableChartPlugin } from '@superset-ui/plugin-chart-pivot-table';
|
||||
import { basicFormData, basicData } from './testData';
|
||||
import { withResizableChartDemo } from '../../../shared/components/ResizableChartDemo';
|
||||
|
|
@ -27,11 +27,11 @@ export default {
|
|||
decorators: [withResizableChartDemo],
|
||||
};
|
||||
|
||||
new PivotTableChartPlugin().configure({ key: 'pivot_table_v2' }).register();
|
||||
new PivotTableChartPlugin().configure({ key: VizType.PivotTable }).register();
|
||||
|
||||
export const Basic = ({ width, height }) => (
|
||||
<SuperChart
|
||||
chartType="pivot_table_v2"
|
||||
chartType={VizType.PivotTable}
|
||||
datasource={{
|
||||
columnFormats: {},
|
||||
}}
|
||||
|
|
@ -50,7 +50,7 @@ Basic.parameters = {
|
|||
|
||||
export const MaximumAggregation = ({ width, height }) => (
|
||||
<SuperChart
|
||||
chartType="pivot_table_v2"
|
||||
chartType={VizType.PivotTable}
|
||||
datasource={{
|
||||
columnFormats: {},
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -16,9 +16,11 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { VizType } from '@superset-ui/core';
|
||||
|
||||
export const basicFormData = {
|
||||
datasource: '1__table',
|
||||
viz_type: 'pivot_table_v2',
|
||||
viz_type: VizType.PivotTable,
|
||||
granularity_sqla: 'ts',
|
||||
groupbyColumns: ['location'],
|
||||
groupbyRows: ['program_language'],
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
import memoizeOne from 'memoize-one';
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { SuperChart, VizType } from '@superset-ui/core';
|
||||
import TableChartPlugin, {
|
||||
TableChartProps,
|
||||
} from '@superset-ui/plugin-chart-table';
|
||||
|
|
@ -75,7 +75,7 @@ export default {
|
|||
},
|
||||
};
|
||||
|
||||
new TableChartPlugin().configure({ key: 'table' }).register();
|
||||
new TableChartPlugin().configure({ key: VizType.Table }).register();
|
||||
|
||||
function expandArray<T>(input: T[], targetSize: number) {
|
||||
if (!input || input.length === 0) {
|
||||
|
|
@ -138,7 +138,7 @@ function loadData(
|
|||
|
||||
export const Basic = ({ width, height }) => (
|
||||
<SuperChart
|
||||
chartType="table"
|
||||
chartType={VizType.Table}
|
||||
datasource={{
|
||||
columnFormats: {},
|
||||
}}
|
||||
|
|
@ -186,7 +186,7 @@ export const BigTable = (
|
|||
});
|
||||
return (
|
||||
<SuperChart
|
||||
chartType="table"
|
||||
chartType={VizType.Table}
|
||||
{...chartProps}
|
||||
width={width}
|
||||
height={height}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ export const birthNames = birthNamesJson as TableChartProps;
|
|||
|
||||
export const basicFormData: TableChartFormData = {
|
||||
datasource: '1__table',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
align_pn: false,
|
||||
color_pn: false,
|
||||
include_search: true,
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import {
|
|||
NumberFormats,
|
||||
SMART_DATE_VERBOSE_ID,
|
||||
t,
|
||||
VizType,
|
||||
} from '@superset-ui/core';
|
||||
|
||||
import 'nvd3-fork/build/nv.d3.css';
|
||||
|
|
@ -125,7 +126,13 @@ const BREAKPOINTS = {
|
|||
small: 340,
|
||||
};
|
||||
|
||||
const TIMESERIES_VIZ_TYPES = ['line', 'area', 'compare', 'bar', 'time_pivot'];
|
||||
const TIMESERIES_VIZ_TYPES = [
|
||||
VizType.LegacyLine,
|
||||
VizType.LegacyArea,
|
||||
VizType.Compare,
|
||||
VizType.LegacyBar,
|
||||
VizType.TimePivot,
|
||||
];
|
||||
|
||||
const CHART_ID_PREFIX = 'chart-id-';
|
||||
|
||||
|
|
@ -165,7 +172,6 @@ const propTypes = {
|
|||
}),
|
||||
]),
|
||||
),
|
||||
// bullet
|
||||
bulletDataType,
|
||||
]),
|
||||
width: PropTypes.number,
|
||||
|
|
@ -182,16 +188,16 @@ const propTypes = {
|
|||
showMarkers: PropTypes.bool,
|
||||
useRichTooltip: PropTypes.bool,
|
||||
vizType: PropTypes.oneOf([
|
||||
'area',
|
||||
'bar',
|
||||
'box_plot',
|
||||
VizType.LegacyArea,
|
||||
VizType.LegacyBar,
|
||||
VizType.BoxPlot,
|
||||
'bubble',
|
||||
'bullet',
|
||||
'compare',
|
||||
VizType.Bullet,
|
||||
VizType.Compare,
|
||||
'column',
|
||||
'dist_bar',
|
||||
'line',
|
||||
'time_pivot',
|
||||
VizType.DistBar,
|
||||
VizType.LegacyLine,
|
||||
VizType.TimePivot,
|
||||
'pie',
|
||||
]),
|
||||
xAxisFormat: PropTypes.string,
|
||||
|
|
@ -341,13 +347,14 @@ function nvd3Vis(element, props) {
|
|||
if (svg.empty()) {
|
||||
svg = d3Element.append('svg');
|
||||
}
|
||||
const height = vizType === 'bullet' ? Math.min(maxHeight, 50) : maxHeight;
|
||||
const height =
|
||||
vizType === VizType.Bullet ? Math.min(maxHeight, 50) : maxHeight;
|
||||
const isTimeSeries = isVizTypes(TIMESERIES_VIZ_TYPES);
|
||||
|
||||
// Handling xAxis ticks settings
|
||||
const staggerLabels = xTicksLayout === 'staggered';
|
||||
const xLabelRotation =
|
||||
(xTicksLayout === 'auto' && isVizTypes(['column', 'dist_bar'])) ||
|
||||
(xTicksLayout === 'auto' && isVizTypes(['column', VizType.DistBar])) ||
|
||||
xTicksLayout === '45°'
|
||||
? 45
|
||||
: 0;
|
||||
|
|
@ -367,7 +374,7 @@ function nvd3Vis(element, props) {
|
|||
const numberFormatter = getNumberFormatter(numberFormat);
|
||||
|
||||
switch (vizType) {
|
||||
case 'line':
|
||||
case VizType.LegacyLine:
|
||||
if (canShowBrush) {
|
||||
chart = nv.models.lineWithFocusChart();
|
||||
if (staggerLabels) {
|
||||
|
|
@ -384,13 +391,13 @@ function nvd3Vis(element, props) {
|
|||
chart.clipEdge(false);
|
||||
break;
|
||||
|
||||
case 'time_pivot':
|
||||
case VizType.TimePivot:
|
||||
chart = nv.models.lineChart();
|
||||
chart.xScale(d3.time.scale.utc());
|
||||
chart.interpolate(lineInterpolation);
|
||||
break;
|
||||
|
||||
case 'bar':
|
||||
case VizType.LegacyBar:
|
||||
chart = nv.models
|
||||
.multiBarChart()
|
||||
.showControls(showControls)
|
||||
|
|
@ -404,7 +411,7 @@ function nvd3Vis(element, props) {
|
|||
chart.stacked(isBarStacked);
|
||||
break;
|
||||
|
||||
case 'dist_bar':
|
||||
case VizType.DistBar:
|
||||
chart = nv.models
|
||||
.multiBarChart()
|
||||
.showControls(showControls)
|
||||
|
|
@ -429,7 +436,7 @@ function nvd3Vis(element, props) {
|
|||
chart.width(width);
|
||||
break;
|
||||
|
||||
case 'pie':
|
||||
case VizType.Pie:
|
||||
chart = nv.models.pieChart();
|
||||
colorKey = 'x';
|
||||
chart.valueFormat(numberFormatter);
|
||||
|
|
@ -478,14 +485,14 @@ function nvd3Vis(element, props) {
|
|||
chart = nv.models.multiBarChart().reduceXTicks(false);
|
||||
break;
|
||||
|
||||
case 'compare':
|
||||
case VizType.Compare:
|
||||
chart = nv.models.cumulativeLineChart();
|
||||
chart.xScale(d3.time.scale.utc());
|
||||
chart.useInteractiveGuideline(true);
|
||||
chart.xAxis.showMaxMin(false);
|
||||
break;
|
||||
|
||||
case 'bubble':
|
||||
case VizType.LegacyBubble:
|
||||
chart = nv.models.scatterChart();
|
||||
chart.showDistX(false);
|
||||
chart.showDistY(false);
|
||||
|
|
@ -508,21 +515,21 @@ function nvd3Vis(element, props) {
|
|||
]);
|
||||
break;
|
||||
|
||||
case 'area':
|
||||
case VizType.LegacyArea:
|
||||
chart = nv.models.stackedAreaChart();
|
||||
chart.showControls(showControls);
|
||||
chart.style(areaStackedStyle);
|
||||
chart.xScale(d3.time.scale.utc());
|
||||
break;
|
||||
|
||||
case 'box_plot':
|
||||
case VizType.BoxPlot:
|
||||
colorKey = 'label';
|
||||
chart = nv.models.boxPlotChart();
|
||||
chart.x(d => d.label);
|
||||
chart.maxBoxWidth(75); // prevent boxes from being incredibly wide
|
||||
break;
|
||||
|
||||
case 'bullet':
|
||||
case VizType.Bullet:
|
||||
chart = nv.models.bulletChart();
|
||||
data.rangeLabels = rangeLabels;
|
||||
data.ranges = ranges;
|
||||
|
|
@ -572,7 +579,7 @@ function nvd3Vis(element, props) {
|
|||
}
|
||||
|
||||
if ('showLegend' in chart && typeof showLegend !== 'undefined') {
|
||||
if (width < BREAKPOINTS.small && vizType !== 'pie') {
|
||||
if (width < BREAKPOINTS.small && vizType !== VizType.Pie) {
|
||||
chart.showLegend(false);
|
||||
} else {
|
||||
chart.showLegend(showLegend);
|
||||
|
|
@ -598,7 +605,7 @@ function nvd3Vis(element, props) {
|
|||
chart.x2Axis.tickFormat(xAxisFormatter);
|
||||
}
|
||||
if (chart.xAxis && chart.xAxis.tickFormat) {
|
||||
const isXAxisString = isVizTypes(['dist_bar', 'box_plot']);
|
||||
const isXAxisString = isVizTypes([VizType.DistBar, VizType.BoxPlot]);
|
||||
if (isXAxisString) {
|
||||
chart.xAxis.tickFormat(d =>
|
||||
d.length > MAX_NO_CHARACTERS_IN_LABEL
|
||||
|
|
@ -641,7 +648,7 @@ function nvd3Vis(element, props) {
|
|||
setAxisShowMaxMin(chart.yAxis, yAxisShowMinMax);
|
||||
setAxisShowMaxMin(chart.y2Axis, yAxis2ShowMinMax || yAxisShowMinMax);
|
||||
|
||||
if (vizType === 'time_pivot') {
|
||||
if (vizType === VizType.TimePivot) {
|
||||
if (baseColor) {
|
||||
const { r, g, b } = baseColor;
|
||||
chart.color(d => {
|
||||
|
|
@ -655,16 +662,24 @@ function nvd3Vis(element, props) {
|
|||
chart.interactiveLayer.tooltip.contentGenerator(d =>
|
||||
generateTimePivotTooltip(d, xAxisFormatter, yAxisFormatter),
|
||||
);
|
||||
} else if (vizType !== 'bullet') {
|
||||
} else if (vizType !== VizType.Bullet) {
|
||||
const colorFn = getScale(colorScheme);
|
||||
chart.color(
|
||||
d => d.color || colorFn(cleanColorInput(d[colorKey]), sliceId),
|
||||
);
|
||||
}
|
||||
|
||||
if (isVizTypes(['line', 'area', 'bar', 'dist_bar']) && useRichTooltip) {
|
||||
if (
|
||||
isVizTypes([
|
||||
VizType.LegacyLine,
|
||||
VizType.LegacyArea,
|
||||
VizType.LegacyBar,
|
||||
VizType.DistBar,
|
||||
]) &&
|
||||
useRichTooltip
|
||||
) {
|
||||
chart.useInteractiveGuideline(true);
|
||||
if (vizType === 'line' || vizType === 'bar') {
|
||||
if (vizType === VizType.LegacyLine || vizType === VizType.LegacyBar) {
|
||||
chart.interactiveLayer.tooltip.contentGenerator(d =>
|
||||
generateRichLineTooltipContent(
|
||||
d,
|
||||
|
|
@ -672,7 +687,7 @@ function nvd3Vis(element, props) {
|
|||
yAxisFormatter,
|
||||
),
|
||||
);
|
||||
} else if (vizType === 'dist_bar') {
|
||||
} else if (vizType === VizType.DistBar) {
|
||||
chart.interactiveLayer.tooltip.contentGenerator(d =>
|
||||
generateCompareTooltipContent(d, yAxisFormatter),
|
||||
);
|
||||
|
|
@ -689,7 +704,7 @@ function nvd3Vis(element, props) {
|
|||
}
|
||||
}
|
||||
|
||||
if (isVizTypes(['compare'])) {
|
||||
if (isVizTypes([VizType.Compare])) {
|
||||
chart.interactiveLayer.tooltip.contentGenerator(d =>
|
||||
generateCompareTooltipContent(d, yAxisFormatter),
|
||||
);
|
||||
|
|
@ -732,7 +747,7 @@ function nvd3Vis(element, props) {
|
|||
|
||||
if (
|
||||
(hasCustomMin || hasCustomMax) &&
|
||||
vizType === 'area' &&
|
||||
vizType === VizType.LegacyArea &&
|
||||
chart.style() === 'expand'
|
||||
) {
|
||||
// Because there are custom bounds, we need to override them back to 0%-100% since this
|
||||
|
|
@ -740,7 +755,7 @@ function nvd3Vis(element, props) {
|
|||
chart.yDomain([0, 1]);
|
||||
} else if (
|
||||
(hasCustomMin || hasCustomMax) &&
|
||||
vizType === 'area' &&
|
||||
vizType === VizType.LegacyArea &&
|
||||
chart.style() === 'stream'
|
||||
) {
|
||||
// Because there are custom bounds, we need to override them back to the domain of the
|
||||
|
|
@ -757,8 +772,9 @@ function nvd3Vis(element, props) {
|
|||
// These viz types can be stacked
|
||||
// They correspond to the nvd3 stackedAreaChart and multiBarChart
|
||||
if (
|
||||
vizType === 'area' ||
|
||||
(isVizTypes(['bar', 'dist_bar']) && chart.stacked())
|
||||
vizType === VizType.LegacyArea ||
|
||||
(isVizTypes([VizType.LegacyBar, VizType.DistBar]) &&
|
||||
chart.stacked())
|
||||
) {
|
||||
// This is a stacked area chart or a stacked bar chart
|
||||
[trueMin, trueMax] = computeStackedYDomain(data);
|
||||
|
|
@ -939,7 +955,7 @@ function nvd3Vis(element, props) {
|
|||
let xMax;
|
||||
let xMin;
|
||||
let xScale;
|
||||
if (vizType === 'bar') {
|
||||
if (vizType === VizType.LegacyBar) {
|
||||
xMin = d3.min(data[0].values, d => d.x);
|
||||
xMax = d3.max(data[0].values, d => d.x);
|
||||
xScale = d3.scale
|
||||
|
|
@ -963,7 +979,7 @@ function nvd3Vis(element, props) {
|
|||
|
||||
if (formulas.length > 0) {
|
||||
const xValues = [];
|
||||
if (vizType === 'bar') {
|
||||
if (vizType === VizType.LegacyBar) {
|
||||
// For bar-charts we want one data point evaluated for every
|
||||
// data point that will be displayed.
|
||||
const distinct = data.reduce((xVals, d) => {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { Preset } from '@superset-ui/core';
|
||||
import { Preset, VizType } from '@superset-ui/core';
|
||||
import AreaChartPlugin from './Area';
|
||||
import BarChartPlugin from './Bar';
|
||||
import BoxPlotChartPlugin from './BoxPlot';
|
||||
|
|
@ -33,16 +33,16 @@ export default class NVD3ChartPreset extends Preset {
|
|||
super({
|
||||
name: 'NVD3 charts',
|
||||
plugins: [
|
||||
new AreaChartPlugin().configure({ key: 'area' }),
|
||||
new BarChartPlugin().configure({ key: 'bar' }),
|
||||
new BoxPlotChartPlugin().configure({ key: 'box_plot' }),
|
||||
new BubbleChartPlugin().configure({ key: 'bubble' }),
|
||||
new BulletChartPlugin().configure({ key: 'bullet' }),
|
||||
new CompareChartPlugin().configure({ key: 'compare' }),
|
||||
new DistBarChartPlugin().configure({ key: 'dist_bar' }),
|
||||
new LineChartPlugin().configure({ key: 'line' }),
|
||||
new PieChartPlugin().configure({ key: 'pie' }),
|
||||
new TimePivotChartPlugin().configure({ key: 'time_pivot' }),
|
||||
new AreaChartPlugin().configure({ key: VizType.LegacyArea }),
|
||||
new BarChartPlugin().configure({ key: VizType.LegacyBar }),
|
||||
new BoxPlotChartPlugin().configure({ key: VizType.BoxPlot }),
|
||||
new BubbleChartPlugin().configure({ key: VizType.LegacyBubble }),
|
||||
new BulletChartPlugin().configure({ key: VizType.Bullet }),
|
||||
new CompareChartPlugin().configure({ key: VizType.Compare }),
|
||||
new DistBarChartPlugin().configure({ key: VizType.DistBar }),
|
||||
new LineChartPlugin().configure({ key: VizType.LegacyLine }),
|
||||
new PieChartPlugin().configure({ key: VizType.Pie }),
|
||||
new TimePivotChartPlugin().configure({ key: VizType.TimePivot }),
|
||||
],
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { VizType } from '@superset-ui/core';
|
||||
import isTruthy from './utils/isTruthy';
|
||||
import {
|
||||
tokenizeToNumericArray,
|
||||
|
|
@ -118,15 +119,20 @@ export default function transformProps(chartProps) {
|
|||
}))
|
||||
: rawData;
|
||||
|
||||
if (vizType === 'pie') {
|
||||
if (vizType === VizType.Pie) {
|
||||
numberFormat = numberFormat || grabD3Format(datasource, metric);
|
||||
} else if (
|
||||
['line', 'dist_bar', 'bar', 'area'].includes(chartProps.formData.vizType)
|
||||
[
|
||||
VizType.LegacyLine,
|
||||
VizType.DistBar,
|
||||
VizType.LegacyBar,
|
||||
VizType.LegacyArea,
|
||||
].includes(chartProps.formData.vizType)
|
||||
) {
|
||||
yAxisFormat =
|
||||
yAxisFormat ||
|
||||
grabD3Format(datasource, metrics.length > 0 ? metrics[0] : undefined);
|
||||
} else if (vizType === 'bullet') {
|
||||
} else if (vizType === VizType.Bullet) {
|
||||
ranges = tokenizeToNumericArray(ranges) || [0, data.measures * 1.1];
|
||||
rangeLabels = tokenizeToStringArray(rangeLabels);
|
||||
markerLabels = tokenizeToStringArray(markerLabels);
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ import {
|
|||
} from '@superset-ui/plugin-chart-echarts';
|
||||
|
||||
new EchartsTimeseriesChartPlugin().configure({ key: 'echarts-ts' }).register();
|
||||
new EchartsPieChartPlugin().configure({ key: 'echarts-pie' }).register();
|
||||
new EchartsPieChartPlugin().configure({ key: 'pie' }).register();
|
||||
```
|
||||
|
||||
Then use it via `SuperChart`. See
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import {
|
|||
NumberFormats,
|
||||
tooltipHtml,
|
||||
ValueFormatter,
|
||||
VizType,
|
||||
} from '@superset-ui/core';
|
||||
import type { CallbackDataParams } from 'echarts/types/src/util/types';
|
||||
import type { EChartsCoreOption } from 'echarts/core';
|
||||
|
|
@ -231,7 +232,7 @@ export default function transformProps(
|
|||
|
||||
const series: FunnelSeriesOption[] = [
|
||||
{
|
||||
type: 'funnel',
|
||||
type: VizType.Funnel,
|
||||
...getChartPadding(showLegend, legendOrientation, legendMargin),
|
||||
animation: true,
|
||||
minSize: '0%',
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { t } from '@superset-ui/core';
|
||||
import { t, VizType } from '@superset-ui/core';
|
||||
import {
|
||||
ControlPanelsContainerProps,
|
||||
ControlSetItem,
|
||||
|
|
@ -220,7 +220,7 @@ const tooltipTotalControl: ControlSetItem = {
|
|||
description: t('Whether to display the total value in the tooltip'),
|
||||
visibility: ({ controls, form_data }: ControlPanelsContainerProps) =>
|
||||
Boolean(controls?.rich_tooltip?.value) &&
|
||||
form_data.viz_type !== 'mixed_timeseries',
|
||||
form_data.viz_type !== VizType.MixedTimeseries,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -235,7 +235,7 @@ const tooltipPercentageControl: ControlSetItem = {
|
|||
visibility: ({ controls, form_data }: ControlPanelsContainerProps) =>
|
||||
Boolean(controls?.rich_tooltip?.value) &&
|
||||
!controls?.contributionMode?.value &&
|
||||
form_data.viz_type !== 'mixed_timeseries',
|
||||
form_data.viz_type !== VizType.MixedTimeseries,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import {
|
|||
DatasourceType,
|
||||
supersetTheme,
|
||||
TimeGranularity,
|
||||
VizType,
|
||||
} from '@superset-ui/core';
|
||||
import transformProps from '../../src/BigNumber/BigNumberWithTrendline/transformProps';
|
||||
import {
|
||||
|
|
@ -40,7 +41,7 @@ const formData = {
|
|||
timeGrainSqla: TimeGranularity.QUARTER,
|
||||
granularitySqla: 'ds',
|
||||
compareSuffix: 'over last quarter',
|
||||
viz_type: 'big_number',
|
||||
viz_type: VizType.BigNumber,
|
||||
yAxisFormat: '.3s',
|
||||
datasource: 'test_datasource',
|
||||
};
|
||||
|
|
@ -59,7 +60,7 @@ const rawFormData: BigNumberWithTrendlineFormData = {
|
|||
time_grain_sqla: TimeGranularity.QUARTER,
|
||||
granularity_sqla: 'ds',
|
||||
compare_suffix: 'over last quarter',
|
||||
viz_type: 'big_number',
|
||||
viz_type: VizType.BigNumber,
|
||||
y_axis_format: '.3s',
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import {
|
|||
ChartProps,
|
||||
SqlaFormData,
|
||||
supersetTheme,
|
||||
VizType,
|
||||
} from '@superset-ui/core';
|
||||
import transformProps, {
|
||||
getIntervalBoundsAndColors,
|
||||
|
|
@ -30,7 +31,7 @@ import { EchartsGaugeChartProps } from '../../src/Gauge/types';
|
|||
describe('Echarts Gauge transformProps', () => {
|
||||
const baseFormData: SqlaFormData = {
|
||||
datasource: '26__table',
|
||||
viz_type: 'gauge_chart',
|
||||
viz_type: VizType.Gauge,
|
||||
metric: 'count',
|
||||
adhocFilters: [],
|
||||
rowLimit: 10,
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { ChartProps, supersetTheme } from '@superset-ui/core';
|
||||
import { ChartProps, supersetTheme, VizType } from '@superset-ui/core';
|
||||
import {
|
||||
LegendOrientation,
|
||||
LegendType,
|
||||
|
|
@ -76,7 +76,7 @@ const formData: EchartsMixedTimeseriesFormData = {
|
|||
groupbyB: ['gender'],
|
||||
seriesType: EchartsTimeseriesSeriesType.Line,
|
||||
seriesTypeB: EchartsTimeseriesSeriesType.Bar,
|
||||
viz_type: 'mixed_timeseries',
|
||||
viz_type: VizType.MixedTimeseries,
|
||||
forecastEnabled: false,
|
||||
forecastPeriods: [],
|
||||
forecastInterval: 0,
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { SqlaFormData } from '@superset-ui/core';
|
||||
import { SqlaFormData, VizType } from '@superset-ui/core';
|
||||
import buildQuery from '../../src/Timeseries/buildQuery';
|
||||
|
||||
describe('Timeseries buildQuery', () => {
|
||||
|
|
@ -64,7 +64,7 @@ describe('Timeseries buildQuery', () => {
|
|||
describe('queryObject conversion', () => {
|
||||
const formData: SqlaFormData = {
|
||||
datasource: '5__table',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
granularity_sqla: 'time_column',
|
||||
time_grain_sqla: 'P1Y',
|
||||
time_range: '1 year ago : 2013',
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { SqlaFormData } from '@superset-ui/core';
|
||||
import { SqlaFormData, VizType } from '@superset-ui/core';
|
||||
import buildQuery from '../../src/Waterfall/buildQuery';
|
||||
|
||||
describe('Waterfall buildQuery', () => {
|
||||
|
|
@ -26,7 +26,7 @@ describe('Waterfall buildQuery', () => {
|
|||
metric: 'foo',
|
||||
x_axis: 'bar',
|
||||
groupby: ['baz'],
|
||||
viz_type: 'waterfall',
|
||||
viz_type: VizType.Waterfall,
|
||||
};
|
||||
|
||||
it('should build query fields from form data', () => {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { VizType } from '@superset-ui/core';
|
||||
import {
|
||||
EchartsBoxPlotChartPlugin,
|
||||
EchartsPieChartPlugin,
|
||||
|
|
@ -65,58 +66,58 @@ test('@superset-ui/plugin-chart-echarts exists', () => {
|
|||
test('@superset-ui/plugin-chart-echarts-parsemethod-validation', () => {
|
||||
const plugins: EchartsChartPlugin[] = [
|
||||
new EchartsBoxPlotChartPlugin().configure({
|
||||
key: 'box_plot',
|
||||
key: VizType.BoxPlot,
|
||||
}),
|
||||
new EchartsPieChartPlugin().configure({
|
||||
key: 'pie',
|
||||
key: VizType.Pie,
|
||||
}),
|
||||
new EchartsTimeseriesChartPlugin().configure({
|
||||
key: 'echarts_timeseries',
|
||||
key: VizType.Timeseries,
|
||||
}),
|
||||
new EchartsGraphChartPlugin().configure({
|
||||
key: 'graph_chart',
|
||||
key: VizType.Graph,
|
||||
}),
|
||||
new EchartsFunnelChartPlugin().configure({
|
||||
key: 'funnel',
|
||||
key: VizType.Funnel,
|
||||
}),
|
||||
new EchartsTreemapChartPlugin().configure({
|
||||
key: 'treemap_v2',
|
||||
key: VizType.Treemap,
|
||||
}),
|
||||
new EchartsAreaChartPlugin().configure({
|
||||
key: 'echarts_area',
|
||||
key: VizType.Area,
|
||||
}),
|
||||
new EchartsTimeseriesBarChartPlugin().configure({
|
||||
key: 'echarts_timeseries_bar',
|
||||
key: VizType.Bar,
|
||||
}),
|
||||
new EchartsTimeseriesLineChartPlugin().configure({
|
||||
key: 'echarts_timeseries_line',
|
||||
key: VizType.Line,
|
||||
}),
|
||||
new EchartsTimeseriesScatterChartPlugin().configure({
|
||||
key: 'echarts_timeseries_scatter',
|
||||
key: VizType.Scatter,
|
||||
}),
|
||||
new EchartsTimeseriesSmoothLineChartPlugin().configure({
|
||||
key: 'echarts_timeseries_smooth',
|
||||
key: VizType.SmoothLine,
|
||||
}),
|
||||
new EchartsTimeseriesStepChartPlugin().configure({
|
||||
key: 'echarts_timeseries_step',
|
||||
key: VizType.Step,
|
||||
}),
|
||||
new EchartsMixedTimeseriesChartPlugin().configure({
|
||||
key: 'mixed_timeseries',
|
||||
key: VizType.MixedTimeseries,
|
||||
}),
|
||||
new EchartsGaugeChartPlugin().configure({
|
||||
key: 'gauge_chart',
|
||||
key: VizType.Gauge,
|
||||
}),
|
||||
new EchartsRadarChartPlugin().configure({
|
||||
key: 'radar',
|
||||
key: VizType.Radar,
|
||||
}),
|
||||
new EchartsTreeChartPlugin().configure({
|
||||
key: 'tree',
|
||||
}),
|
||||
new BigNumberChartPlugin().configure({
|
||||
key: 'big_number',
|
||||
key: VizType.BigNumber,
|
||||
}),
|
||||
new BigNumberTotalChartPlugin().configure({
|
||||
key: 'big_number_total',
|
||||
key: VizType.BigNumberTotal,
|
||||
}),
|
||||
new EchartsSunburstChartPlugin().configure({
|
||||
key: 'sunburst',
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { VizType } from '@superset-ui/core';
|
||||
import {
|
||||
retainFormDataSuffix,
|
||||
removeFormDataSuffix,
|
||||
|
|
@ -23,7 +24,7 @@ import {
|
|||
|
||||
const formData = {
|
||||
datasource: 'dummy',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
metrics: ['a', 'b'],
|
||||
columns: ['foo', 'bar'],
|
||||
limit: 100,
|
||||
|
|
@ -35,7 +36,7 @@ const formData = {
|
|||
test('should keep controls with suffix', () => {
|
||||
expect(retainFormDataSuffix(formData, '_b')).toEqual({
|
||||
datasource: 'dummy',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
metrics: ['c', 'd'],
|
||||
columns: ['hello', 'world'],
|
||||
limit: 200,
|
||||
|
|
@ -47,7 +48,7 @@ test('should keep controls with suffix', () => {
|
|||
test('should remove controls with suffix', () => {
|
||||
expect(removeFormDataSuffix(formData, '_b')).toEqual({
|
||||
datasource: 'dummy',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
metrics: ['a', 'b'],
|
||||
columns: ['foo', 'bar'],
|
||||
limit: 100,
|
||||
|
|
|
|||
|
|
@ -16,7 +16,12 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { ChartProps, QueryFormData, supersetTheme } from '@superset-ui/core';
|
||||
import {
|
||||
ChartProps,
|
||||
QueryFormData,
|
||||
supersetTheme,
|
||||
VizType,
|
||||
} from '@superset-ui/core';
|
||||
import { HandlebarsQueryFormData } from '../../src/types';
|
||||
import transformProps from '../../src/plugin/transformProps';
|
||||
|
||||
|
|
@ -29,7 +34,7 @@ describe('Handlebars transformProps', () => {
|
|||
groupby: ['name'],
|
||||
width: 500,
|
||||
height: 500,
|
||||
viz_type: 'handlebars',
|
||||
viz_type: VizType.Handlebars,
|
||||
};
|
||||
const data = [{ name: 'Hulk', sum__num: 1, __timestamp: 599616000000 }];
|
||||
const chartProps = new ChartProps<QueryFormData>({
|
||||
|
|
|
|||
|
|
@ -16,12 +16,12 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { QueryMode, TimeGranularity } from '@superset-ui/core';
|
||||
import { QueryMode, TimeGranularity, VizType } from '@superset-ui/core';
|
||||
import buildQuery from '../src/buildQuery';
|
||||
import { TableChartFormData } from '../src/types';
|
||||
|
||||
const basicFormData: TableChartFormData = {
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
datasource: '11__table',
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -24,12 +24,13 @@ import {
|
|||
QueryMode,
|
||||
supersetTheme,
|
||||
ComparisonType,
|
||||
VizType,
|
||||
} from '@superset-ui/core';
|
||||
import { TableChartProps, TableChartFormData } from '../src/types';
|
||||
|
||||
const basicFormData: TableChartFormData = {
|
||||
datasource: '1__abc',
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
align_pn: false,
|
||||
color_pn: false,
|
||||
show_cell_bars: true,
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { VizType } from '@superset-ui/core';
|
||||
import { WordCloudFormData } from '../src';
|
||||
import buildQuery from '../src/plugin/buildQuery';
|
||||
|
||||
|
|
@ -25,7 +26,7 @@ describe('WordCloud buildQuery', () => {
|
|||
datasource: '5__table',
|
||||
granularity_sqla: 'ds',
|
||||
series: 'foo',
|
||||
viz_type: 'word_cloud',
|
||||
viz_type: VizType.WordCloud,
|
||||
};
|
||||
|
||||
it('should build columns from series in form data', () => {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { VizType } from '@superset-ui/core';
|
||||
import { datasourceId } from './mockDatasource';
|
||||
|
||||
export const sliceId = 18;
|
||||
|
|
@ -35,7 +36,7 @@ export default {
|
|||
form_data: {
|
||||
adhoc_filters: [],
|
||||
datasource: datasourceId,
|
||||
viz_type: 'pie',
|
||||
viz_type: VizType.Pie,
|
||||
slice_id: sliceId,
|
||||
slice_name: 'Genders',
|
||||
granularity_sqla: undefined,
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { JsonObject } from '@superset-ui/core';
|
||||
import { JsonObject, VizType } from '@superset-ui/core';
|
||||
|
||||
export const getExploreFormData = (overrides: JsonObject = {}) => ({
|
||||
adhoc_filters: [
|
||||
|
|
@ -82,6 +82,6 @@ export const getExploreFormData = (overrides: JsonObject = {}) => ({
|
|||
},
|
||||
slice_id: 46,
|
||||
time_range: '100 years ago : now',
|
||||
viz_type: 'pie',
|
||||
viz_type: VizType.Pie,
|
||||
...overrides,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
import { datasourceId } from 'spec/fixtures/mockDatasource';
|
||||
import { DatasourceType } from '@superset-ui/core';
|
||||
import { DatasourceType, VizType } from '@superset-ui/core';
|
||||
import { sliceId } from './mockChartQueries';
|
||||
|
||||
export const filterId = 127;
|
||||
|
|
@ -31,7 +31,7 @@ export const sliceEntitiesForChart = {
|
|||
slice_name: 'Genders',
|
||||
form_data: {
|
||||
slice_id: sliceId,
|
||||
viz_type: 'pie',
|
||||
viz_type: VizType.Pie,
|
||||
row_limit: 50000,
|
||||
metric: 'sum__num',
|
||||
since: '100 years ago',
|
||||
|
|
@ -46,7 +46,7 @@ export const sliceEntitiesForChart = {
|
|||
compare_suffix: 'o10Y',
|
||||
datasource: datasourceId,
|
||||
},
|
||||
viz_type: 'pie',
|
||||
viz_type: VizType.Pie,
|
||||
datasource: datasourceId,
|
||||
description: '',
|
||||
description_markdown: '',
|
||||
|
|
@ -98,7 +98,7 @@ export const sliceEntitiesForDashboard = {
|
|||
slice_url: '/explore/?form_data=%7B%22slice_id%22%3A%20128%7D',
|
||||
slice_name: "World's Population",
|
||||
form_data: {},
|
||||
viz_type: 'big_number',
|
||||
viz_type: VizType.BigNumber,
|
||||
datasource: '2__table',
|
||||
description: '',
|
||||
description_markdown: '',
|
||||
|
|
@ -118,7 +118,7 @@ export const sliceEntitiesForDashboard = {
|
|||
slice_url: '/explore/?form_data=%7B%22slice_id%22%3A%20129%7D',
|
||||
slice_name: 'Most Populated Countries',
|
||||
form_data: {},
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
datasource: '2__table',
|
||||
description: '',
|
||||
description_markdown: 'dd',
|
||||
|
|
@ -139,7 +139,7 @@ export const sliceEntitiesForDashboard = {
|
|||
slice_url: '/explore/?form_data=%7B%22slice_id%22%3A%20130%7D',
|
||||
slice_name: 'Growth Rate',
|
||||
form_data: {},
|
||||
viz_type: 'line',
|
||||
viz_type: VizType.LegacyLine,
|
||||
datasource: '2__table',
|
||||
description: '',
|
||||
description_markdown: '',
|
||||
|
|
@ -160,7 +160,7 @@ export const sliceEntitiesForDashboard = {
|
|||
slice_url: '/explore/?form_data=%7B%22slice_id%22%3A%20131%7D',
|
||||
slice_name: '% Rural',
|
||||
form_data: {},
|
||||
viz_type: 'world_map',
|
||||
viz_type: VizType.WorldMap,
|
||||
datasource: '2__table',
|
||||
description: '',
|
||||
description_markdown: '',
|
||||
|
|
@ -181,7 +181,7 @@ export const sliceEntitiesForDashboard = {
|
|||
slice_url: '/explore/?form_data=%7B%22slice_id%22%3A%20132%7D',
|
||||
slice_name: 'Life Expectancy VS Rural %',
|
||||
form_data: {},
|
||||
viz_type: 'bubble',
|
||||
viz_type: VizType.LegacyBubble,
|
||||
datasource: '2__table',
|
||||
description: '',
|
||||
description_markdown: '',
|
||||
|
|
@ -202,7 +202,7 @@ export const sliceEntitiesForDashboard = {
|
|||
slice_url: '/explore/?form_data=%7B%22slice_id%22%3A%20133%7D',
|
||||
slice_name: 'Rural Breakdown',
|
||||
form_data: {},
|
||||
viz_type: 'sunburst_v2',
|
||||
viz_type: VizType.Sunburst,
|
||||
datasource: '2__table',
|
||||
description: '',
|
||||
description_markdown: '',
|
||||
|
|
@ -223,7 +223,7 @@ export const sliceEntitiesForDashboard = {
|
|||
slice_url: '/explore/?form_data=%7B%22slice_id%22%3A%20134%7D',
|
||||
slice_name: "World's Pop Growth",
|
||||
form_data: {},
|
||||
viz_type: 'area',
|
||||
viz_type: VizType.LegacyArea,
|
||||
datasource: '2__table',
|
||||
description: '',
|
||||
description_markdown: '',
|
||||
|
|
@ -244,7 +244,7 @@ export const sliceEntitiesForDashboard = {
|
|||
slice_url: '/explore/?form_data=%7B%22slice_id%22%3A%20135%7D',
|
||||
slice_name: 'Box plot',
|
||||
form_data: {},
|
||||
viz_type: 'box_plot',
|
||||
viz_type: VizType.BoxPlot,
|
||||
datasource: '2__table',
|
||||
description: '',
|
||||
description_markdown: '',
|
||||
|
|
@ -265,7 +265,7 @@ export const sliceEntitiesForDashboard = {
|
|||
slice_url: '/explore/?form_data=%7B%22slice_id%22%3A%20136%7D',
|
||||
slice_name: 'Treemap',
|
||||
form_data: {},
|
||||
viz_type: 'treemap_v2',
|
||||
viz_type: VizType.Treemap,
|
||||
datasource: '2__table',
|
||||
description: '',
|
||||
description_markdown: '',
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
import { useSelector, useDispatch } from 'react-redux';
|
||||
import { t, JsonObject } from '@superset-ui/core';
|
||||
import { t, JsonObject, VizType } from '@superset-ui/core';
|
||||
import {
|
||||
createCtasDatasource,
|
||||
addInfoToast,
|
||||
|
|
@ -60,7 +60,7 @@ const ExploreCtasResultsButton = ({
|
|||
datasource: `${data.table_id}__table`,
|
||||
metrics: ['count'],
|
||||
groupby: [],
|
||||
viz_type: 'table',
|
||||
viz_type: VizType.Table,
|
||||
since: '100 years ago',
|
||||
all_columns: [],
|
||||
row_limit: 1000,
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import {
|
|||
JsonObject,
|
||||
QueryResponse,
|
||||
QueryFormData,
|
||||
VizType,
|
||||
} from '@superset-ui/core';
|
||||
import { useSelector, useDispatch } from 'react-redux';
|
||||
import moment from 'moment';
|
||||
|
|
@ -159,7 +160,7 @@ export const SaveDatasetModal = ({
|
|||
formData = {},
|
||||
}: SaveDatasetModalProps) => {
|
||||
const defaultVizType = useSelector<SqlLabRootState, string>(
|
||||
state => state.common?.conf?.DEFAULT_VIZ_TYPE || 'table',
|
||||
state => state.common?.conf?.DEFAULT_VIZ_TYPE || VizType.Table,
|
||||
);
|
||||
|
||||
const getDefaultDatasetName = () =>
|
||||
|
|
@ -217,7 +218,7 @@ export const SaveDatasetModal = ({
|
|||
postFormData(datasetToOverwrite.datasetid, 'table', {
|
||||
...formDataWithDefaults,
|
||||
datasource: `${datasetToOverwrite.datasetid}__table`,
|
||||
...(defaultVizType === 'table' && {
|
||||
...(defaultVizType === VizType.Table && {
|
||||
all_columns: datasource?.columns?.map(column => column.column_name),
|
||||
}),
|
||||
}),
|
||||
|
|
@ -304,7 +305,7 @@ export const SaveDatasetModal = ({
|
|||
postFormData(data.id, 'table', {
|
||||
...formDataWithDefaults,
|
||||
datasource: `${data.id}__table`,
|
||||
...(defaultVizType === 'table' && {
|
||||
...(defaultVizType === VizType.Table && {
|
||||
all_columns: selectedColumns.map(column => column.column_name),
|
||||
}),
|
||||
}),
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue