rusackas commented on code in PR #43070:
URL: https://github.com/apache/superset/pull/43070#discussion_r4028163955


##########
superset-frontend/src/core/dashboard/resolveBindings.ts:
##########
@@ -32,7 +43,10 @@ interface BindMarker {
     source: 'metric' | 'dimension' | 'theme' | 'records';
     /** `metric`/`dimension` — the row field to pull one column's values from. 
*/
     alias?: string;
-    /** `theme` — the theme token to substitute. */
+    /**
+     * `theme` — the chart theme field to substitute, as a dotted path:
+     * `accent`, `text.mutedColor`, `axis.gridColor`.
+     */
     token?: string;
     /**

Review Comment:
   This landed in 7c236dc94e9, the legacy lookup is `hasOwnProperty`-gated now 
so `constructor`/`toString` fall through to the error instead of resolving.



##########
superset-frontend/plugins/plugin-chart-echarts/src/utils/echartsTheme.ts:
##########
@@ -0,0 +1,84 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import type { SupersetTheme } from '@apache-superset/core/theme';
+
+/**
+ * Derives the ECharts styling implied by the active theme's tokens — text,
+ * legend, tooltip, axis-pointer, and (when the chart declares them) axis
+ * colors.
+ *
+ * Lives here rather than inside `Echart.tsx` because that component isn't the
+ * only renderer: the Dashboard v2 building blocks draw AI-authored options on
+ * a bare `echarts.init` canvas, bypassing `SuperChart`/`ChartPlugin` entirely,
+ * and without this they render ECharts' stock near-black text regardless of
+ * the theme.
+ *
+ * Returns only what the theme implies — merge it *under* the chart's own
+ * options (see `mergeEchartsThemeOverrides`) so anything the chart sets
+ * explicitly still wins.
+ */
+export function getEchartsTheme(theme: SupersetTheme, options?: any) {
+  const echartsTheme = {
+    textStyle: {
+      color: theme.colorText,
+      fontFamily: theme.fontFamily,
+    },
+    title: {
+      textStyle: { color: theme.colorText },
+    },
+    legend: {
+      textStyle: { color: theme.colorTextSecondary },
+      pageTextStyle: {
+        color: theme.colorTextSecondary,
+      },
+      pageIconColor: theme.colorTextSecondary,
+      pageIconInactiveColor: theme.colorTextDisabled,
+      inactiveColor: theme.colorTextDisabled,
+    },
+    tooltip: {
+      backgroundColor: theme.colorBgContainer,
+      textStyle: { color: theme.colorText },
+    },
+    axisPointer: {
+      lineStyle: { color: theme.colorPrimary },
+      label: { color: theme.colorText },
+    },
+  } as any;
+
+  // Only styled when the chart actually declares an axis — an axis block on a
+  // pie or gauge option would otherwise draw a cartesian grid that isn't 
there.
+  const axisTheme = {
+    axisLine: { lineStyle: { color: theme.colorSplit } },
+    axisLabel: { color: theme.colorTextSecondary },
+    splitLine: { lineStyle: { color: theme.colorSplit } },
+    minorSplitLine: {
+      lineStyle: { color: theme.colorBorderSecondary },
+    },
+  };
+  if (options?.xAxis) {
+    echartsTheme.xAxis = axisTheme;
+  }
+  if (options?.yAxis) {
+    echartsTheme.yAxis = axisTheme;
+  }

Review Comment:
   Same commit (7c236dc94e9) fixed this one too, the axis default now matches 
the authored shape, array gets one default per axis instead of a single object 
overwriting the array.



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