anantaoutlook commented on code in PR #33146: URL: https://github.com/apache/superset/pull/33146#discussion_r2078863562
########## superset-frontend/plugins/plugin-chart-echarts/src/Waterfall/controlPanel.tsx: ########## @@ -133,6 +220,53 @@ const config: ControlPanelConfig = { description: t('The way the ticks are laid out on the X-axis'), }, }, + { + name: 'x_ticks_wrap_length', + config: { + type: 'TextControl', + label: t('X Tick Wrap Length'), + description: t( + 'Maximum line length for wrapped text (when Flat layout is selected)', + ), + default: '20', + renderTrigger: true, + visibility: ({ controls }) => + controls.x_ticks_layout.value === 'flat', + }, + }, + ], + [ + { + name: 'sort_x_axis', + config: { + type: 'SelectControl', + label: t('Sort X Axis'), Review Comment: Fixed now ########## superset-frontend/plugins/plugin-chart-echarts/src/Waterfall/EchartsWaterfall.tsx: ########## @@ -16,16 +16,137 @@ * specific language governing permissions and limitations * under the License. */ +import { EChartsCoreOption } from 'echarts/core'; +import { useTheme } from '@superset-ui/core'; +import React, { useRef } from 'react'; import Echart from '../components/Echart'; import { WaterfallChartTransformedProps } from './types'; import { EventHandlers } from '../types'; export default function EchartsWaterfall( props: WaterfallChartTransformedProps, ) { - const { height, width, echartOptions, refs, onLegendStateChanged } = props; + const { + height, + width, + echartOptions, + setDataMask, + onContextMenu, + refs, + onLegendStateChanged, + formData: { + sortXAxis, + orientation, + showTotal, + useFirstValueAsSubtotal, + totalColor, + boldLabels, + }, + emitCrossFilters, + } = props; + + const theme = useTheme(); + const chartRef = useRef<any>(null); const eventHandlers: EventHandlers = { + click: params => { + if (!setDataMask || !emitCrossFilters) return; + + const { name: value } = params; + const xAxisColumn = props.formData.xAxis; + + // Don't filter on Total column + if (value === 'Total') return; + + const isCurrentValue = props.filterState?.value === value; + + if (isCurrentValue) { + // Clear the filter and visual state + setDataMask({ + extraFormData: {}, + filterState: { + value: null, + }, + }); + + if (chartRef.current) { + const series = echartOptions.series as any[]; + const updatedSeries = series.map(s => ({ + ...s, + itemStyle: { + ...s.itemStyle, + opacity: 1, + }, + })); + + if (orientation === 'vertical') { + chartRef.current.getEchartInstance().setOption({ Review Comment: Fixed now ########## superset-frontend/plugins/plugin-chart-echarts/src/Waterfall/controlPanel.tsx: ########## @@ -39,6 +40,48 @@ const config: ControlPanelConfig = { ['metric'], ['adhoc_filters'], ['row_limit'], + [ + { + name: 'seriesOrderByColumn', + config: { + type: 'SelectControl', + label: t('Order Series By Column'), + description: t( + 'Column to use for ordering the waterfall series with columns not in the chart', + ), + mapStateToProps: state => ({ + choices: [ + ...(state.datasource?.columns || []).map(col => [ + col.column_name, + col.column_name, + ]), + ], + default: state.form_data?.x_axis || '', + }), + clearable: false, + renderTrigger: true, Review Comment: Fixed now -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org