diff --git a/.loki/reference/chrome_laptop_embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Parameter_List_With_Value.png b/.loki/reference/chrome_laptop_embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Parameter_List_With_Value.png index f5901f6cab61d51be0a0c5ccb9c0885349421643..0c48db3e75839833e588f0d16c5bd0c9886e49f7 100644 Binary files a/.loki/reference/chrome_laptop_embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Parameter_List_With_Value.png and b/.loki/reference/chrome_laptop_embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Parameter_List_With_Value.png differ diff --git a/e2e/test/scenarios/visualizations-charts/visualizations-charts-reproductions.cy.spec.ts b/e2e/test/scenarios/visualizations-charts/visualizations-charts-reproductions.cy.spec.ts index 9ec545eb3c63b5f2148ee2e0c94a0701a4772a81..0de850985f56a2d187615eac892264daab05efcc 100644 --- a/e2e/test/scenarios/visualizations-charts/visualizations-charts-reproductions.cy.spec.ts +++ b/e2e/test/scenarios/visualizations-charts/visualizations-charts-reproductions.cy.spec.ts @@ -2,7 +2,9 @@ import { SAMPLE_DB_ID } from "e2e/support/cypress_data"; import { SAMPLE_DATABASE } from "e2e/support/cypress_sample_database"; import { type StructuredQuestionDetails, + chartPathWithFillColor, createQuestion, + echartsContainer, getDraggableElements, modal, moveDnDKitElement, @@ -12,7 +14,7 @@ import { visitQuestionAdhoc, } from "e2e/support/helpers"; -const { PRODUCTS, PRODUCTS_ID } = SAMPLE_DATABASE; +const { PRODUCTS, PRODUCTS_ID, ORDERS, ORDERS_ID } = SAMPLE_DATABASE; describe("issue 43075", () => { const questionDetails: StructuredQuestionDetails = { @@ -101,3 +103,51 @@ describe("issue 45255", () => { cy.findByTestId("funnel-chart").findByText("(empty)"); }); }); + +describe("issue 49874", () => { + beforeEach(() => { + restore(); + cy.signInAsAdmin(); + }); + + it("when two axis should show only one related to the hovered series", () => { + const question = { + dataset_query: { + type: "query", + query: { + "source-table": ORDERS_ID, + aggregation: [ + ["sum", ["field", ORDERS.QUANTITY, null]], + ["sum", ["field", ORDERS.TOTAL, null]], + ], + breakout: [ + ["field", ORDERS.CREATED_AT, { "temporal-unit": "month" }], + ], + }, + database: 1, + }, + display: "bar", + }; + + visitQuestionAdhoc(question); + + echartsContainer().within(() => { + cy.findByText("Sum of Quantity").should("be.visible"); + cy.findByText("Sum of Total").should("be.visible"); + }); + + chartPathWithFillColor("#88BF4D").first().realHover(); + + echartsContainer().within(() => { + cy.findByText("Sum of Quantity").should("be.visible"); + cy.findByText("Sum of Total").should("not.exist"); + }); + + chartPathWithFillColor("#98D9D9").first().realHover(); + + echartsContainer().within(() => { + cy.findByText("Sum of Quantity").should("not.exist"); + cy.findByText("Sum of Total").should("be.visible"); + }); + }); +}); diff --git a/frontend/src/metabase/visualizations/visualizations/CartesianChart/use-chart-events.ts b/frontend/src/metabase/visualizations/visualizations/CartesianChart/use-chart-events.ts index 8851e613ffccf39f6f7b526f356ff5628f9882cc..eedf83894912735c9e1442491b5df02f72e9de7c 100644 --- a/frontend/src/metabase/visualizations/visualizations/CartesianChart/use-chart-events.ts +++ b/frontend/src/metabase/visualizations/visualizations/CartesianChart/use-chart-events.ts @@ -94,8 +94,8 @@ export const useChartEvents = ( const hiddenYAxisIndex = chartModel.leftAxisModel?.seriesKeys.includes( hoveredSeriesDataKey, ) - ? 0 - : 1; + ? 1 + : 0; yAxisShowOption[hiddenYAxisIndex].show = false; }