Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(plugin-chart-echarts): make to allow the custome of x & y axis title margin i… #18947

Merged
merged 8 commits into from
Mar 10, 2022

Conversation

prosdev0107
Copy link
Contributor

@prosdev0107 prosdev0107 commented Feb 25, 2022

SUMMARY

[chart viz][Time-series bar chart v2] chart will shrink when input customize X AXIS TITLE MARGIN

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before
Screenshot at Feb 25 08-51-11
After
Screenshot at Feb 25 08-49-54
This issue happens because that the custom margin value of x & y axis title is string value.
And so I fixed the issue by converting them from string to number value.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@codecov
Copy link

codecov bot commented Feb 25, 2022

Codecov Report

Merging #18947 (0cd5870) into master (3298551) will decrease coverage by 0.00%.
The diff coverage is 66.25%.

❗ Current head 0cd5870 differs from pull request most recent head 3d5a303. Consider uploading reports for the commit 3d5a303 to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #18947      +/-   ##
==========================================
- Coverage   66.52%   66.51%   -0.01%     
==========================================
  Files        1641     1645       +4     
  Lines       63475    63494      +19     
  Branches     6443     6459      +16     
==========================================
+ Hits        42226    42234       +8     
- Misses      19584    19590       +6     
- Partials     1665     1670       +5     
Flag Coverage Δ
javascript 51.26% <64.93%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...d/packages/superset-ui-chart-controls/src/types.ts 100.00% <ø> (ø)
...s/legacy-preset-chart-nvd3/src/Bar/controlPanel.ts 16.66% <0.00%> (-83.34%) ⬇️
...gins/legacy-preset-chart-nvd3/src/NVD3Controls.tsx 100.00% <ø> (+4.16%) ⬆️
...src/BigNumber/BigNumberWithTrendline/buildQuery.ts 9.09% <ø> (ø)
...plugin-chart-echarts/src/BoxPlot/transformProps.ts 54.23% <ø> (ø)
...hart-echarts/src/MixedTimeseries/transformProps.ts 0.00% <ø> (ø)
...ns/plugin-chart-echarts/src/Radar/controlPanel.tsx 30.00% <0.00%> (-3.34%) ⬇️
...gin-chart-echarts/src/Timeseries/transformProps.ts 58.06% <ø> (ø)
...ugin-chart-pivot-table/src/plugin/controlPanel.tsx 12.50% <ø> (ø)
...ntend/plugins/plugin-chart-table/src/buildQuery.ts 55.93% <ø> (ø)
... and 69 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3298551...3d5a303. Read the comment docs.

Copy link
Member

@kgabryje kgabryje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Chart.jsx shouldn't be aware of such plugin specific controls. I'd suggest parsing those values in plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts (and wherever else they're used, I think Echarts Boxplot and MixedTimeseries).
You could create a helper function in plugins/plugin-chart-echarts/src/utils that would return a parsed number or 0 if NaN

@rusackas
Copy link
Member

rusackas commented Mar 3, 2022

@kgabryje This LGTM, but thought you might want to check the latest revisions since you'd requested changes.

@@ -0,0 +1,5 @@
export const convertNumber = (value: string | number) => {
/* eslint radix: ["error", "as-needed"] */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 more nit - maybe we could just pass radix 10 instead of ignoring the error?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering the same. I think there's some chance of it parsing some implicit octal radix, but I haven't stopped to try to break it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved with radix 10

@kgabryje
Copy link
Member

kgabryje commented Mar 3, 2022

Sorry for late response, added 2 more comments 🙂

@kgabryje kgabryje changed the title fix(chartviz): make to allow the custome of x & y axis title margin i… fix(plugin-chart-echarts): make to allow the custome of x & y axis title margin i… Mar 4, 2022
@pull-request-size pull-request-size bot added size/M and removed size/S labels Mar 4, 2022
@rusackas
Copy link
Member

rusackas commented Mar 7, 2022

@kgabryje if you can re-review, that'd be awesome :)

Copy link
Member

@rusackas rusackas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs the apache boilerplate license text like the rest of the files. Can't merge the PR without it.

@@ -0,0 +1,4 @@
export const convertInteger = (value: string | number) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. You need to add a license to make this PR pass the CI (just copy paste the comment from top of any js file)
  2. Can we we use more descriptive file names? Maybe the same as the function name

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prosdev0107 checking in on these last little tweaks... otherwise, I think this one is looking good!

Copy link
Member

@kgabryje kgabryje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@kgabryje kgabryje dismissed rusackas’s stale review March 10, 2022 11:58

Problems were solved

@kgabryje kgabryje merged commit c79ee56 into apache:master Mar 10, 2022
villebro pushed a commit that referenced this pull request Apr 3, 2022
…tle margin i… (#18947)

* fix(chartviz): make to allow the custome of x & y axis title margin in  chart

* fix(chartviz): add eslint radix error in chart.js

* fix(chartviz): change the transformProps in chart plugin & creat helper.

* fix(chartviz): lint fix & chart.js back

* fix(plugin-chart-echarts): make to allow the custom margin of X & y axis in BoxPlot & Mixedtimeseries charts

* fix(plugin-chart-echarts): make to change changeNumber to changeInteger

* fix(plugin-chart-echarts): make to add license & change file name

(cherry picked from commit c79ee56)
@mistercrunch mistercrunch added 🍒 1.5.2 🍒 1.5.3 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.0.0 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels lts-v1 size/M 🍒 1.5.0 🍒 1.5.1 🍒 1.5.2 🍒 1.5.3 🚢 2.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants