Skip to content

Commit

Permalink
fix: explore chart color and range add changes fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
omerfbolat committed Apr 4, 2024
1 parent ef794cc commit e5d645c
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 4 deletions.
7 changes: 7 additions & 0 deletions superset-frontend/src/pages/DvtChart/dvtChartData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ interface ValuesProps {
number?: boolean;
}

interface RangeConfigProps {
min: number;
max: number;
step: number;
}

interface FormsProps {
status:
| 'input'
Expand All @@ -42,6 +48,7 @@ interface FormsProps {
options?: OptionsData[];
number?: boolean;
values?: ValuesProps[];
rangeConfig?: RangeConfigProps;
}

interface CollapsesProps {
Expand Down
21 changes: 17 additions & 4 deletions superset-frontend/src/pages/DvtChart/dvtChartDataCustomize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ interface ValuesProps {
number?: boolean;
}

interface RangeConfigProps {
min: number;
max: number;
step: number;
}

interface FormsProps {
status:
| 'input'
Expand All @@ -42,6 +48,7 @@ interface FormsProps {
options?: OptionsData[];
number?: boolean;
values?: ValuesProps[];
rangeConfig?: RangeConfigProps;
}

interface CollapsesProps {
Expand Down Expand Up @@ -464,15 +471,21 @@ const DvtChartCustomize: DvtChartCustomizeProps[] = [
collapse_popper_error: t('This section contains validation errors'),
collapse_active: 'query',
forms: [
formDimensions,
formMetric,
formFilters,
formRowLimit,
{
label: t('SORT BY METRIC'),
name: 'sort_by_metric',
status: 'checkbox',
},
{
label: t('OUTER RADIUS'),
name: 'outerRadius',
status: 'range',
rangeConfig: {
min: 10,
max: 100,
step: 1,
},
},
],
},
],
Expand Down
25 changes: 25 additions & 0 deletions superset-frontend/src/pages/DvtChart/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import DvtButtonTabs, {
import DvtSelect from 'src/components/DvtSelect';
import DvtInputSelect from 'src/components/DvtInputSelect';
import DvtInputDrop from 'src/components/DvtInputDrop';
import DvtColorSelect from 'src/components/DvtColorSelect';
import DvtRange from 'src/components/DvtRange';
import DvtSpinner from 'src/components/DvtSpinner';
import ChartContainer from 'src/components/Chart/ChartContainer';
import moment from 'moment';
Expand Down Expand Up @@ -1635,6 +1637,29 @@ const DvtChart = () => {
))}
</CreateChartCenterCollapseInGapFlexRow>
)}
{fItem.status === 'color' && (
<DvtColorSelect
label={fItem.label}
popoverLabel={fItem.popper}
value={values[fItem.name]}
setValue={v =>
setValues({ ...values, [fItem.name]: v })
}
/>
)}
{fItem.status === 'range' && (
<DvtRange
label={fItem.label}
popoverLabel={fItem.popper}
value={values[fItem.name]}
setValue={v =>
setValues({ ...values, [fItem.name]: v })
}
min={fItem.rangeConfig?.min || 0}
max={fItem.rangeConfig?.max || 0}
step={fItem.rangeConfig?.step || 0}
/>
)}
</div>
))}
</CreateChartCenterCollapseInGap>
Expand Down

0 comments on commit e5d645c

Please sign in to comment.