[v11.0.x] Migrations: Graph (old) percent stacked (#86945)

Migrations: Graph (old) percent stacked (#84335)

(cherry picked from commit d1b67847a2)

Co-authored-by: Leon Sorokin <leeoniya@gmail.com>
This commit is contained in:
grafana-delivery-bot[bot]
2024-04-25 19:10:20 +01:00
committed by GitHub
co-authored by Leon Sorokin
parent 80f3aded4e
commit e151121cc2
@@ -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);