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: Reordering echart props to fix confidence interval in Mixed Charts #30716

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

geotab-data-platform
Copy link

fix(echarts): confidence interval does not display correctly for mixed time series charts with negative values

SUMMARY

The root cause of this problem lies within the order of the arguments sent to the echarts library. When working with time-series data, Echarts enforces specific constraints on how the x-axis bounds are configured. These constraints include:
In other words, the Echarts Library accepts input in this specific format and will malfunction otherwise. Superset does not create the Echarts modal with the options in this order.

  • The xaxis.type option must be explicitly set to 'time'.
  • The upper and lower bound values must be equal to the lower bound.
  • The upper bound must be defined before the lower bound in the options object.

Currently, the code in Superset that generates the Echarts configuration does not adhere to this required format, leading to the observed malfunction. This pull request rectifies this issue by reordering the upper and lower bound arguments before they are passed to the Echarts library.

What is currently being sent

What should actually be sent

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

create a mixed chart on the explore menu using confidence intervals where the names__yhat_lower bound is negative at least once.

Verify that confidence Intervals behave as Intended.

names__yhat: trend/point estimate
names__yhat_lower: lower confidence level
names__yhat_upper: upper confidence level

ADDITIONAL INFORMATION

Fixes #30554

  • 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

@dosubot dosubot bot added the viz:charts:echarts Related to Echarts label Oct 25, 2024
@geotab-data-platform geotab-data-platform changed the title Reordered echart props so confidence interval works Reordering echart props to fix confidence interval in Mixed Charts Oct 25, 2024
@michael-s-molina michael-s-molina changed the title Reordering echart props to fix confidence interval in Mixed Charts fix: Reordering echart props to fix confidence interval in Mixed Charts Oct 25, 2024
@villebro
Copy link
Member

villebro commented Oct 25, 2024

@geotab-data-platform I don't see this PR changing enforcing or updating the xaxis.type = 'time' issue, despite it being changed in the "after" example. Is this not changed here?

@vedantprajapati17
Copy link

xaxis type defaults to "value" if not reordered and there are negative bound values. When its ordered properly, it uses "time".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Confidence Interval Does not work properly for Mixed Charts
3 participants