Skip to content

Commit

Permalink
Migrations: Graph (old) percent stacked (#84335)
Browse files Browse the repository at this point in the history
  • Loading branch information
leeoniya committed Apr 25, 2024
1 parent 3397e8b commit d1b6784
Showing 1 changed file with 14 additions and 1 deletion.
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;
}
}
}
}

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

0 comments on commit d1b6784

Please sign in to comment.