Skip to content
Snippets Groups Projects
Unverified Commit 43918ecc authored by metabase-bot[bot]'s avatar metabase-bot[bot] Committed by GitHub
Browse files

remove own series settings limit (#28872) (#28900)

parent b4efbc9f
No related branches found
No related tags found
No related merge requests found
......@@ -224,4 +224,39 @@ describe("scenarios > visualizations > bar chart", () => {
getDraggableElements().eq(3).should("have.text", "Gadget");
});
});
it("supports up to 100 series (metabase#28796)", () => {
visitQuestionAdhoc({
display: "bar",
dataset_query: {
database: SAMPLE_DB_ID,
type: "query",
query: {
"source-table": ORDERS_ID,
aggregation: [["count"]],
filter: ["and", ["<", ["field", ORDERS.ID, null], 101]],
breakout: [
["field", ORDERS.CREATED_AT, { "temporal-unit": "year" }],
["field", ORDERS.ID],
],
},
},
visualization_settings: {
"graph.dimensions": ["CREATED_AT", "SUBTOTAL"],
"graph.metrics": ["count"],
},
});
cy.findByTestId("viz-settings-button").click();
cy.get("[data-testid^=draggable-item]").should("have.length", 100);
cy.findByText("ID is less than 101").click();
cy.findByDisplayValue("101").type("{backspace}2");
cy.findByText("Update filter").click();
cy.findByText(
"This chart type doesn't support more than 100 series of data.",
);
cy.get("[data-testid^=draggable-item]").should("have.length", 0);
});
});
......@@ -5,6 +5,7 @@ import {
getFriendlyName,
getDefaultDimensionsAndMetrics,
preserveExistingColumnsOrder,
MAX_SERIES,
} from "metabase/visualizations/lib/utils";
import {
......@@ -105,7 +106,8 @@ export const GRAPH_DATA_SETTINGS = {
title: t`X-axis`,
widget: "fields",
getMarginBottom: (series, vizSettings) =>
vizSettings["graph.dimensions"]?.length === 2 && series.length <= 20
vizSettings["graph.dimensions"]?.length === 2 &&
series.length <= MAX_SERIES
? "0.5rem"
: "1rem",
isValid: (series, vizSettings) =>
......@@ -220,7 +222,9 @@ export const GRAPH_DATA_SETTINGS = {
}));
},
getHidden: (series, settings) => {
return settings["graph.dimensions"]?.length < 2 || series.length > 20;
return (
settings["graph.dimensions"]?.length < 2 || series.length > MAX_SERIES
);
},
dashboard: false,
readDependencies: ["series_settings.colors", "series_settings"],
......
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