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


##########
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:
   @anantaoutlook All the logic to modify the series should be implemented 
inside `transformProps`. You'll need to modify that code to handle different 
configuration options when generating the series.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to