michael-s-molina commented on code in PR #33146:
URL: https://github.com/apache/superset/pull/33146#discussion_r2072017527


##########
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:
   `transformProps` is responsible for generating the `echartOptions` that is 
received as a parameter.



-- 
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

Reply via email to