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: Temporal X Axis values are not properly displayed if the time column has a custom label defined #20819

Conversation

diegomedina248
Copy link
Contributor

@diegomedina248 diegomedina248 commented Jul 22, 2022

SUMMARY

Defining a label to the time column on the dataset level breaks the axis values displayed on the chart, in case the GENERIC_CHART_AXES feature flag enabled.

The issue is that, by changing the label, we're failing to calculate the proper type of the x axis column, since the dataType mapping is done with the original axis value.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before:

old.mov

After:

new.mov

TESTING INSTRUCTIONS

  1. Create a Bar Chart v2 using the Vehicle Sales dataset.
  2. Set Month as the granularity.
  3. Set order_date as the X Axis.
  4. Set sum(price_each) as the metric.
  5. Click on CREATE CHART.
  6. Note that the months are properly displayed on the X Axis.
  7. Click on the three ellipses next to the dataset name > Edit dataset.
  8. Navigate to the COLUMNS tab.
  9. Expand the order_date column.
  10. Set date as a label for this column.
  11. Click on SAVE.
  12. Click on OK.

Ensure Months are still properly displayed on the X Axis.

ADDITIONAL INFORMATION

Fixes #20074

  • 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 Jul 22, 2022

Codecov Report

Merging #20819 (045352c) into master (af1bddf) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master   #20819   +/-   ##
=======================================
  Coverage   66.30%   66.30%           
=======================================
  Files        1758     1758           
  Lines       66802    66802           
  Branches     7056     7057    +1     
=======================================
  Hits        44294    44294           
  Misses      20710    20710           
  Partials     1798     1798           
Flag Coverage Δ
javascript 51.98% <100.00%> (ø)

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

Impacted Files Coverage Δ
...gin-chart-echarts/src/Timeseries/transformProps.ts 55.95% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us.

Copy link
Member

@zhaoyongjie zhaoyongjie left a comment

Choose a reason for hiding this comment

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

There is an unrelated issue on the axis that I cannot get a label as the response column. other lgtm. Thanks for the fix!

image

@zhaoyongjie zhaoyongjie merged commit 51869f3 into apache:master Jul 22, 2022
@eschutho eschutho added the v2.0.1 label Sep 2, 2022
eschutho pushed a commit that referenced this pull request Sep 20, 2022
…has a custom label defined (#20819)

(cherry picked from commit 51869f3)
@emgoryaynova
Copy link

Hi! I still have this issue in 2.0.0

@unnyns-307
Copy link

Hi, I still found the problem in 2.0.0 as well.
I found the problem is that the date time column was still set as Default Datetime column for the dataset.
and when it is used to plot on X-axis, it will be applied with datetrunc function on SQL generate from the chart and got NULL result which impact unable to display on X-axis.
image

My work around now is to unable this Default Datetime setting from the column, then it can be plotted on X-axis.

I think we need to add more code to disable this setting when enable GENERIC_CHART_AXIS flag.

@zhaoyongjie
Copy link
Member

@unnyns-307 I think this case had been resolved in the Master branch. I tried to reproduce the issue and used a virtual dataset without date column, the default datetime radio can't be selected.

image

@unnyns-307
Copy link

unnyns-307 commented Oct 5, 2022

Hi @zhaoyongjie, thanks for replying. I think this issue can reproduce by having the datetime column in dataset and then change the type column as string by changing from SQL code of dataset and sync column again then it shows as a string type.

I found how to change the Default Datetime setting, we need to access at the USE LEGACY DATASOURCE EDITOR
and remove the column name in Main Datetime Column
image

image

However, this is what I found in Superset V.2.0.0 that the datetime column which is convert to string cannot be plot on x-axis of line chart/generic chart, need to explore on newer version again.
Thanks for letting me know that the issue has been resolved. Will try to check it out! Thanks :)

Fahrenheit35 pushed a commit to Fahrenheit35/superset that referenced this pull request Nov 11, 2022
…has a custom label defined (apache#20819)

(cherry picked from commit 51869f3)
@mistercrunch mistercrunch added 🍒 2.0.1 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 and removed 🚢 2.1.3 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 size/XS v2.0 v2.0.1 🍒 2.0.1 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[GENERIC_CHART_AXES] When timestamp values with dataset labels, timestamp format is not working #bug
7 participants