mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
Fixed bugs with viz in exploreV2 (#1609)
* Fixed bugs with viz in exploreV2 Done: - fix typo in pie viz - add metrics/groupby to dist_bar viz - fix typo in heatmap viz - add big_number_total to viz - fixed problem with fetching columns for datasource - add sqlaTimeSeries to viz - change row_limit and limit from number to strings so that we don't need to parse integers in bootstrap data * Fix python tests * Added order_bars checkbox for dist_bar viz
This commit is contained in:
@@ -41,9 +41,11 @@ class ControlPanelsContainer extends React.Component {
|
||||
|
||||
sectionsToRender() {
|
||||
const viz = visTypes[this.props.form_data.viz_type];
|
||||
const timeSection = this.props.datasource_type === 'table' ?
|
||||
commonControlPanelSections.sqlaTimeSeries : commonControlPanelSections.druidTimeSeries;
|
||||
const { datasourceAndVizType, sqlClause } = commonControlPanelSections;
|
||||
const sectionsToRender = [datasourceAndVizType].concat(viz.controlPanelSections, sqlClause);
|
||||
|
||||
const sectionsToRender = [datasourceAndVizType].concat(
|
||||
viz.controlPanelSections, timeSection, sqlClause);
|
||||
return sectionsToRender;
|
||||
}
|
||||
|
||||
|
||||
@@ -114,9 +114,12 @@ export const visTypes = {
|
||||
label: 'Chart Options',
|
||||
description: 'tooltip text here',
|
||||
fieldSetRows: [
|
||||
['metrics'],
|
||||
['groupby'],
|
||||
['columns'],
|
||||
['row_limit'],
|
||||
['show_legend', 'show_bar_value', 'bar_stacked'],
|
||||
['show_legend', 'show_bar_value'],
|
||||
['bar_stacked', 'order_bars'],
|
||||
['y_axis_format', 'bottom_margin'],
|
||||
['x_axis_label', 'y_axis_label'],
|
||||
['reduce_x_ticks', 'contribution'],
|
||||
@@ -140,7 +143,7 @@ export const visTypes = {
|
||||
controlPanelSections: [
|
||||
{
|
||||
label: null,
|
||||
fields: [
|
||||
fieldSetRows: [
|
||||
['metrics', 'groupby'],
|
||||
['limit'],
|
||||
['pie_label_type'],
|
||||
@@ -409,6 +412,24 @@ export const visTypes = {
|
||||
},
|
||||
},
|
||||
|
||||
big_number_total: {
|
||||
controlPanelSections: [
|
||||
{
|
||||
label: null,
|
||||
fieldSetRows: [
|
||||
['metric'],
|
||||
['subheader'],
|
||||
['y_axis_format'],
|
||||
],
|
||||
},
|
||||
],
|
||||
fieldOverrides: {
|
||||
y_axis_format: {
|
||||
label: 'Number format',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
histogram: {
|
||||
label: 'Histogram',
|
||||
controlPanelSections: [
|
||||
@@ -811,7 +832,7 @@ export const fields = {
|
||||
'defines how the browser scales up the image',
|
||||
},
|
||||
|
||||
x_scale_interval: {
|
||||
xscale_interval: {
|
||||
type: 'SelectField',
|
||||
label: 'XScale Interval',
|
||||
choices: formatSelectOptionsForRange(1, 50),
|
||||
@@ -820,7 +841,7 @@ export const fields = {
|
||||
'displaying the X scale',
|
||||
},
|
||||
|
||||
y_scale_interval: {
|
||||
yscale_interval: {
|
||||
type: 'SelectField',
|
||||
label: 'YScale Interval',
|
||||
choices: formatSelectOptionsForRange(1, 50),
|
||||
@@ -850,6 +871,13 @@ export const fields = {
|
||||
description: 'Show the value on top of the bar',
|
||||
},
|
||||
|
||||
order_bars: {
|
||||
type: 'CheckboxField',
|
||||
label: 'Sort Bars',
|
||||
default: false,
|
||||
description: 'Sort bars by x labels.',
|
||||
},
|
||||
|
||||
show_controls: {
|
||||
type: 'CheckboxField',
|
||||
label: 'Extra Controls',
|
||||
@@ -1036,7 +1064,8 @@ export const fields = {
|
||||
'expression',
|
||||
},
|
||||
|
||||
time_grain: {
|
||||
time_grain_sqla: {
|
||||
type: 'SelectField',
|
||||
label: 'Time Grain',
|
||||
choices: [],
|
||||
default: 'Time Column',
|
||||
@@ -1281,8 +1310,8 @@ export const fields = {
|
||||
series_height: {
|
||||
type: 'FreeFormSelectField',
|
||||
label: 'Series Height',
|
||||
default: 25,
|
||||
choices: formatSelectOptions([10, 25, 40, 50, 75, 100, 150, 200]),
|
||||
default: '25',
|
||||
choices: formatSelectOptions(['10', '25', '40', '50', '75', '100', '150', '200']),
|
||||
description: 'Pixel height of each series',
|
||||
},
|
||||
|
||||
|
||||
@@ -132,14 +132,14 @@ export function formatSelectOptionsForRange(start, end) {
|
||||
// returns [[1,1], [2,2], [3,3], [4,4], [5,5]]
|
||||
const options = [];
|
||||
for (let i = start; i <= end; i++) {
|
||||
options.push([i, i]);
|
||||
options.push([i.toString(), i.toString()]);
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
export function formatSelectOptions(options) {
|
||||
return options.map((opt) =>
|
||||
[opt, opt]
|
||||
[opt.toString(), opt.toString()]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user