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

Migrations: Graph (old) percent stacked #84335

Merged
merged 5 commits into from Apr 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 14 additions & 1 deletion public/app/plugins/panel/timeseries/migrations.ts
Expand Up @@ -339,9 +339,22 @@ export function graphToTimeseriesOptions(angular: any): {

if (angular.stack) {
graph.stacking = {
mode: StackingMode.Normal,
mode: angular.percentage ? StackingMode.Percent : StackingMode.Normal,
group: defaultGraphConfig.stacking!.group,
};

if (angular.percentage) {
if (angular.yaxis) {
delete y1.min;
delete y1.max;

// TimeSeries currently uses 0-1 for percent, so allowing zero leaves only top and bottom ticks.
// removing it feels better. probably should fix in TimeSeries, but let's kick it down the road
if (y1.decimals === 0) {
delete y1.decimals;
}
Comment on lines +351 to +355
Copy link
Contributor Author

Choose a reason for hiding this comment

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

likely controversial, but this is much simpler than fixing TimeSeries decimals setting in percent stacked mode to understand that 0 decimals is specifically in the 0-100 and not 0-1 range. i think generally this will do the correct thing. let's see what feedback we get before dedicating more time to this than needed.

}
}
}

y1.custom = omitBy(graph, isNil);
Expand Down