Skip to content
Snippets Groups Projects
Unverified Commit 1e808e6c authored by Aleksandr Lesnenko's avatar Aleksandr Lesnenko Committed by GitHub
Browse files

fix legend order (#45446)

parent 4dcd413f
No related branches found
No related tags found
No related merge requests found
......@@ -42,6 +42,7 @@ import {
getDefaultDimensions,
getDefaultShowStackValues,
STACKABLE_SERIES_DISPLAY_TYPES,
getSeriesOrderDimensionSetting,
getDefaultMetrics,
isShowStackValuesValid,
} from "metabase/visualizations/shared/settings/cartesian-chart";
......@@ -114,7 +115,7 @@ export const GRAPH_DATA_SETTINGS = {
useRawSeries: true,
},
"graph.series_order_dimension": {
getValue: (_series, settings) => settings["graph.dimensions"][1],
getValue: (_series, settings) => getSeriesOrderDimensionSetting(settings),
// This read dependency is set so that "graph.series_order" is computed *before* this value, ensuring that
// that it uses the stored value if one exists. This is needed to check if the dimension has actually changed
readDependencies: ["graph.series_order"],
......
......@@ -110,6 +110,10 @@ export const getDefaultStackingValue = (
return shouldStack ? "stacked" : null;
};
export const getSeriesOrderDimensionSetting = (
settings: ComputedVisualizationSettings,
) => settings["graph.dimensions"]?.[1];
export const getSeriesOrderVisibilitySettings = (
settings: ComputedVisualizationSettings,
seriesKeys: string[],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment