You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "rlei-odes (via GitHub)" <gi...@apache.org> on 2026/08/22 18:23:27 UTC

[PR] feat(plugin-chart-echarts): allow decal patterns in custom ECharts options [superset]

rlei-odes opened a new pull request, #43427:
URL: https://github.com/apache/superset/pull/43427

   ### SUMMARY
   
   `itemStyle.decal` is the ECharts property for a patterned fill — hatching,
   cross-hatching, dots — rather than a solid colour. It is the only member of
   `itemStyle` missing from `itemStyleSchema` in `eChartOptionsSchema.ts`, so it is
   stripped during validation while `color`, `borderColor`, `borderWidth`,
   `borderType`, `borderRadius`, the shadow properties and `opacity` all pass.
   
   That gap looks accidental. A decal is the same kind of value as its siblings — a
   static data structure, which is what the safe parser exists to permit — and it
   introduces no new type of input: `symbol` reuses the `symbolTypeSchema` string
   already accepted for series symbols and legend icons. The schema mirrors
   ECharts' `DecalObject` in full rather than a subset, in the same way
   `lineStyleSchema` does, so there is no arbitrary line to defend later.
   
   **What this does not do.** It does not make patterned fills usable. A decal is a
   per-series property, and per-series options cannot be reached through this
   control at all today: `mergeCustomEChartOptions` replaces arrays rather than
   merging them, so supplying `series` discards the computed series, and the
   replacement cannot carry its own data because `data` is deliberately not in
   `seriesSchema`. Closing the allowlist gap is one half of making a decal
   reachable; the merge behaviour is the other, and that is a larger question than
   this PR.
   
   So this is a small consistency fix rather than a feature. I am opening it
   because it is a one-property gap that costs nothing, and because I am working
   toward the other half — per-series visual treatments where the fill pattern
   carries meaning independently of colour, which is a common convention in
   business reporting. Background and the wider discussion:
   https://github.com/apache/superset/discussions/43426
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   Not applicable — this widens what the options schema accepts and adds no
   control. Nothing renders differently unless a chart opts in through the
   existing *ECharts Options* control, which the testing instructions cover.
   
   ### TESTING INSTRUCTIONS
   
   Unit tests: `npm run test -- plugins/plugin-chart-echarts/src/utils/safeEChartOptionsParser`
   
   The unit tests are the verification here, because **a decal cannot currently be
   exercised end to end through the control**, for reasons unrelated to this
   change:
   
   - a decal is a per-series property, so reaching one means supplying `series`;
   - `mergeCustomEChartOptions` replaces arrays rather than merging them, so
     supplying `series` discards the computed series;
   - and the replacement cannot carry its own data, because `data` is not in
     `seriesSchema` — by design, since data comes from the query.
   
   So the option is accepted and merged, and nothing in Superset sets one yet.
   That is what makes this a prerequisite rather than a feature, and I would rather
   say so than dress up a demo.
   
   What is worth checking for regressions:
   
   1. Load an existing chart that already uses *Customize → ECharts Options*, with
      top-level keys such as `xAxis` / `yAxis`, and confirm it renders as before.
      Those merge as objects and are unaffected.
   2. Confirm validation still rejects a malformed decal —
      `{ series: { itemStyle: { decal: { rotation: 'sideways' } } } }` raises a
      validation error rather than being silently dropped — and that unknown keys
      inside a decal are still stripped. Both are covered by the new unit tests.
   
   ### ADDITIONAL INFORMATION
   
   - [x] Has associated issue: https://github.com/apache/superset/discussions/43426
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [x] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
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-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(plugin-chart-echarts): allow decal patterns in custom ECharts options [superset]

Posted by "rlei-odes (via GitHub)" <gi...@apache.org>.
rlei-odes commented on PR #43427:
URL: https://github.com/apache/superset/pull/43427#issuecomment-5382342309

   Thanks for the flag — I checked this against ECharts and I believe the current schema is correct, so I'd like to leave it as is.
   
   ECharts types the option as a per-element union rather than a uniform one:
   
   ```ts
   // echarts/types/dist/shared.d.ts
   declare type DecalDashArrayX = number | (number | number[])[];
   ```
   
   which is what `z.union([z.number(), z.array(z.union([z.number(), z.array(z.number())]))])` models.
   
   Mixed nesting is intentional rather than malformed. From `normalizeDashArrayX` in `echarts/lib/util/decal.js`:
   
   ```js
   /**
    * [20, 5] should be normalized into [[20, 5]],
    * while [20, [5, 10]] should be normalized into [[20, 20], [5, 10]]
    */
   ```
   
   The loop below it branches per element — a number becomes a `[n, n]` row, an array becomes that row's dash pattern — so `[1, [2, 3]]` describes two rows with different patterns.
   
   Narrowing to `number | number[] | number[][]` would reject that and make the allowlist stricter than ECharts itself, which runs against the intent of this PR. The schema mirrors `DecalObject` exactly, in the same way `lineStyleSchema` mirrors its own type.
   


-- 
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-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(plugin-chart-echarts): allow decal patterns in custom ECharts options [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #43427:
URL: https://github.com/apache/superset/pull/43427#issuecomment-5381915750

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).


-- 
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-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(plugin-chart-echarts): allow decal patterns in custom ECharts options [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #43427:
URL: https://github.com/apache/superset/pull/43427#issuecomment-5381940010

   <!-- Bito Reply -->
   The issue is correct. The current `dashArrayX` schema definition allows mixed types within the array because it uses `z.union([z.number(), z.array(z.number())])` for each element, which permits heterogeneous arrays like `[1, [2, 3]]`. To enforce uniformity, you should define the schema as a union of the three allowed types (`number`, `number[]`, or `number[][]`) rather than an array of unions.
   
   To resolve this, update the `dashArrayX` schema in `superset-frontend/plugins/plugin-chart-echarts/src/utils/eChartOptionsSchema.ts` as follows:
   
   ```typescript
     dashArrayX: z
       .union([z.number(), z.array(z.number()), z.array(z.array(z.number()))])
       .optional(),
   ```
   
   This change ensures that `dashArrayX` must be either a single number, a flat array of numbers, or a nested array of numbers, rejecting mixed-type arrays. Would you like me to check the rest of the comments on this PR and implement fixes for them as well?
   
   **superset-frontend/plugins/plugin-chart-echarts/src/utils/eChartOptionsSchema.ts**
   ```
   dashArrayX: z
       .union([z.number(), z.array(z.number()), z.array(z.array(z.number()))])
       .optional(),
   ```


-- 
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-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(plugin-chart-echarts): allow decal patterns in custom ECharts options [superset]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #43427:
URL: https://github.com/apache/superset/pull/43427#issuecomment-5381961063

   ## [Codecov](https://app.codecov.io/gh/apache/superset/pull/43427?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 78.85%. Comparing base ([`f2610e9`](https://app.codecov.io/gh/apache/superset/commit/f2610e9dca01cb35e831bb89c3fcd5ef17111482?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`4c8856a`](https://app.codecov.io/gh/apache/superset/commit/4c8856afee87d9ad1a95e3204ef2436bc1f0794c?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@           Coverage Diff           @@
   ##           master   #43427   +/-   ##
   =======================================
     Coverage   78.85%   78.85%           
   =======================================
     Files        2876     2876           
     Lines      164581   164582    +1     
     Branches    38011    38011           
   =======================================
   + Hits       129786   129787    +1     
     Misses      32348    32348           
     Partials     2447     2447           
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/superset/pull/43427/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [javascript](https://app.codecov.io/gh/apache/superset/pull/43427/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `74.21% <100.00%> (+<0.01%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/superset/pull/43427?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
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-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(plugin-chart-echarts): allow decal patterns in custom ECharts options [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #43427:
URL: https://github.com/apache/superset/pull/43427#discussion_r3836716679


##########
superset-frontend/plugins/plugin-chart-echarts/src/utils/eChartOptionsSchema.ts:
##########
@@ -114,6 +114,23 @@ export const textStyleSchema = z.object({
 // Style Schemas
 // =============================================================================
 
+/** Repeating tile pattern painted over a fill, e.g. hatching */
+export const decalSchema = z.object({
+  symbol: z.union([symbolTypeSchema, z.array(symbolTypeSchema)]).optional(),
+  symbolSize: z.number().optional(),
+  symbolKeepAspect: z.boolean().optional(),
+  color: colorSchema.optional(),
+  backgroundColor: colorSchema.optional(),
+  dashArrayX: z
+    .union([z.number(), z.array(z.union([z.number(), z.array(z.number())]))])
+    .optional(),

Review Comment:
   **Suggestion:** The `dashArrayX` schema accepts heterogeneous arrays such as `[1, [2, 3]]` because each outer element independently allows either a number or a number array. ECharts expects this option to be one uniform representation—`number`, `number[]`, or `number[][]`—so malformed mixed values pass validation and are forwarded to the renderer. Model the union at the array level to reject mixed nesting. [type error]
   
   <details>
   <summary><b>Severity Level:</b> Minor 🧹</summary>
   
   ```mdx
   - ⚠️ Custom ECharts decal validation accepts malformed mixed arrays.
   - ⚠️ Timeseries custom options can forward invalid decal geometry.
   - ⚠️ ECharts may ignore or mishandle the affected pattern.
   ```
   </details>
   
   [![Use CodeAnt Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/plugins/plugin-chart-echarts/src/utils/eChartOptionsSchema.ts
   **Line:** 124:126
   **Comment:**
   	*Type Error: The `dashArrayX` schema accepts heterogeneous arrays such as `[1, [2, 3]]` because each outer element independently allows either a number or a number array. ECharts expects this option to be one uniform representation—`number`, `number[]`, or `number[][]`—so malformed mixed values pass validation and are forwarded to the renderer. Model the union at the array level to reject mixed nesting.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43427&comment_hash=651f8bc62761b980f0d4b3cb372c1317dd574ce5bc7384d10e853e0734b71165&reaction=like'>👍</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43427&comment_hash=651f8bc62761b980f0d4b3cb372c1317dd574ce5bc7384d10e853e0734b71165&reaction=dislike'>👎</a>



-- 
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-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(plugin-chart-echarts): allow decal patterns in custom ECharts options [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas merged PR #43427:
URL: https://github.com/apache/superset/pull/43427


-- 
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-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org