-
Notifications
You must be signed in to change notification settings - Fork 68
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 for charts with side-by-side
grouping (Bar/Area plots)
#1883
base: xdmod11.0
Are you sure you want to change the base?
Conversation
side-by-side
grouping (Bar/Area plots)
…ame realm and multiple data sources from different realms in the same plot
…ad of using traces names (which are editable by users)
Comment to explain some of the proposed changes: Note: The term
|
@@ -894,7 +894,7 @@ public function configure( | |||
// for each of the dataseries on this yAxisObject: | |||
foreach($yAxisObject->series as $data_description_index => $yAxisDataObjectAndDescription) | |||
{ | |||
$legendRank += 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note there is no trendline series for aggregate charts therefore this was supposed to increment by 1.
@@ -848,7 +845,7 @@ function ($drillTarget) { | |||
&& $chartSortedByValue | |||
&& $usageGroupBy !== 'none' | |||
) { | |||
$rank = $meDataSeries['legendrank']+1; | |||
$rank = $meDataSeries['legendrank'] / 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've had problems in the past using floats because their representation changes between php and js versions.
Is $rank
supposed to be an int? is it guaranteed to be an int?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to take another look at this. It doesn't seem to be guaranteed to be an int at the moment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$rank
here is guaranteed to be an int
after taking a closer look. This is only run when the series is a part of a timeseries
plot and it is based off a variable we control, $legendRank
.
During my investigation I noticed I was incrementing the $legendRank
off by one. However, it was not noticeable because any series with a "tied" $legendRank
would be broken by the fact that one of the traces came later in the data array passed with the plot. Therefore, I reverted the refactor to the Aggregate chart $legendRank
I did last week and I put the timeseries $legendRank
to increment by 3 (because we have the primary trace and two possible supplemental traces).
… notice on the plot because the next series (and its supplements plots) are placed later in the data array so I believe Plotly was placing them later in the legend for the same reason
@@ -97,10 +97,9 @@ XDMoD.utils.createChart = function (chartOptions, extraHandlers) { | |||
// for comparison idea | |||
baseChartOptions.data.sort((trace1, trace2) => { | |||
if (baseChartOptions.layout.barmode !== 'group') { | |||
return Math.sign(trace2.zIndex - trace1.zIndex) || Math.sign(trace2.traceorder - trace1.traceorder); | |||
return Math.sign(trace2.traceorder - trace1.traceorder); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change this if to explicitly check for a column bar chart (rather than not == group which will match scatter plots and pie charts too).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be addressed.
For the trendline code that contained the ternaries, it seems that having the valid check was unnecessary. Nothing breaks when the log scale and std error bars are enabled with the trendline series. I need to start working on a few refactor PRs for Plotly because I saw a few cases where we can refactor barmode
(only need for bar charts shouldn't be default on every chart) and allowing log scale with error bars (haven't found any reason why it shouldn't be allowed, I can look back on the git blame and try to find a reason)
Risk: MEDIUM
Notes on Risk: These changes affect Area/Bar plots due to both of these making use of the stacking feature. Minor changes to trace ordering which affects every plot. The change on trace ordering should be lower risk because the
zIndex
is not being used due tolayering
being currently disabled.Severity: MEDIUM/HIGH
Notes on Severity: Depending on the units of the data and if the data sources are from the same realm or not the plot has misplaced traces, due to wrongful stacking (instead of side-by-side). See attached plots.
Description
Side by side bar charts were broken when comparing time-series data from two different realms.
Before Fix:
After Fix:
Found an additional bug with legend ordering w/ trendline and error bars enabled:
Before:
After:
Motivation and Context
Fixes time-series grouped (side by side) bar charts.
Tests performed
Tested on dev and tested grouped bar charts with data from the same realm to check for regressions
Checklist: