diff --git a/.loki/reference/chrome_laptop_static_viz_ComboChart_Bar_Correct_Width_When_Two_Y_Axes.png b/.loki/reference/chrome_laptop_static_viz_ComboChart_Bar_Correct_Width_When_Two_Y_Axes.png new file mode 100644 index 0000000000000000000000000000000000000000..02cad6a9b35c0b781ad114af1856be437267c610 Binary files /dev/null and b/.loki/reference/chrome_laptop_static_viz_ComboChart_Bar_Correct_Width_When_Two_Y_Axes.png differ diff --git a/.loki/reference/chrome_laptop_static_viz_ComboChart_Combined_Bar_Time_Series_Different_Granularity_With_Breakout.png b/.loki/reference/chrome_laptop_static_viz_ComboChart_Combined_Bar_Time_Series_Different_Granularity_With_Breakout.png index b14b8f75ce44aa876c7b0165a85093d023ad4b56..650527aca08d993a1135971fc522ed2a8f26c2a2 100644 Binary files a/.loki/reference/chrome_laptop_static_viz_ComboChart_Combined_Bar_Time_Series_Different_Granularity_With_Breakout.png and b/.loki/reference/chrome_laptop_static_viz_ComboChart_Combined_Bar_Time_Series_Different_Granularity_With_Breakout.png differ diff --git a/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Auto_Y_Axis_Exclude_Zero_With_Goal.png b/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Auto_Y_Axis_Exclude_Zero_With_Goal.png index d7cf26ae4c2f5eb7b9e67667902258981fed1d7e..817205b9109ce76ba9c9de0065001f7ec59d5f57 100644 Binary files a/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Auto_Y_Axis_Exclude_Zero_With_Goal.png and b/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Auto_Y_Axis_Exclude_Zero_With_Goal.png differ diff --git a/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Bubble_Size.png b/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Bubble_Size.png index 3b6c9a55aef71a974e8ecc5b48cd518103e08225..72c12fd24e819567a9c069f5ffcb7e0476b5f2be 100644 Binary files a/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Bubble_Size.png and b/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Bubble_Size.png differ diff --git a/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Custom_Y_Axis_Range.png b/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Custom_Y_Axis_Range.png index b6171cbca9421f10ceb70de20b33418cedc2a6f0..fec9a41274f0c141e3453b6f67e74b932ab7baf9 100644 Binary files a/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Custom_Y_Axis_Range.png and b/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Custom_Y_Axis_Range.png differ diff --git a/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Default.png b/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Default.png index a1dd32200b21564b1e4c368d04ddc7195fdd2f52..47a3e1cf90211839a726eb2d0bbeef921036255a 100644 Binary files a/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Default.png and b/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Default.png differ diff --git a/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Goal_Line.png b/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Goal_Line.png index 0004430a8f9e10743b70f339948383a0bf268139..74ff856b52fca4e7c2a05760060aecedef5de120 100644 Binary files a/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Goal_Line.png and b/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Goal_Line.png differ diff --git a/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Histogram_X_Scale.png b/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Histogram_X_Scale.png index c0143dc5d8c8909b90dc464ab9c61b482dac9883..28c0c2eea028fd7612592f3dccf52da3b18d542c 100644 Binary files a/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Histogram_X_Scale.png and b/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Histogram_X_Scale.png differ diff --git a/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Log_X_Scale.png b/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Log_X_Scale.png index 276e32158b1af1c062f2bc8273182b9a0161298d..d89d7561e24698ad70ab5c2c3299c7cd04593383 100644 Binary files a/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Log_X_Scale.png and b/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Log_X_Scale.png differ diff --git a/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Log_X_Scale_At_One.png b/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Log_X_Scale_At_One.png index bcd2eea965b1039fbe39a051381eea4c23d31b08..925ff52be6efe85c224b6efc8ad44b1babea1498 100644 Binary files a/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Log_X_Scale_At_One.png and b/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Log_X_Scale_At_One.png differ diff --git a/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Multi_Dimension_Breakout.png b/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Multi_Dimension_Breakout.png index f13497bb6a0be2dc9055f3f9edd37f6f05981aba..1dfc079918bec92322cd667b62a5abfec3095779 100644 Binary files a/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Multi_Dimension_Breakout.png and b/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Multi_Dimension_Breakout.png differ diff --git a/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Multi_Dimension_Breakout_Bubble_Size.png b/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Multi_Dimension_Breakout_Bubble_Size.png index fc6c2da5149dda6eaa94855dea2b90a1aa073e33..1f302631555245a282420a79946d3672b6f2ca75 100644 Binary files a/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Multi_Dimension_Breakout_Bubble_Size.png and b/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Multi_Dimension_Breakout_Bubble_Size.png differ diff --git a/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Multi_Metric_Series.png b/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Multi_Metric_Series.png index b0df2c704a8d223355d4265dce793363245458e4..e3497dec04108437ecbb21a54dee584479786283 100644 Binary files a/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Multi_Metric_Series.png and b/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Multi_Metric_Series.png differ diff --git a/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Ordinal_X_Scale.png b/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Ordinal_X_Scale.png index 619c43d0ff7db38afc0529a12bd3060f8f2f0dd0..ebbadd64d2243e959d75b8cf3c1ef7ad6367319d 100644 Binary files a/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Ordinal_X_Scale.png and b/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Ordinal_X_Scale.png differ diff --git a/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Power_X_Scale.png b/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Power_X_Scale.png index 11a9cd2c90e9f55bd354888e519294c9e1fb656a..7a5db44ff5e9686b7a5d284830a13a14cf10e3b3 100644 Binary files a/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Power_X_Scale.png and b/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Power_X_Scale.png differ diff --git a/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Power_X_Scale_Multi_Series.png b/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Power_X_Scale_Multi_Series.png index bb632f931ca851f2cbc52e8c831aaa6e4840fe6e..378c1b8f1f691a01c95ec746a1d7f2e0a8cfca9b 100644 Binary files a/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Power_X_Scale_Multi_Series.png and b/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Power_X_Scale_Multi_Series.png differ diff --git a/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Timeseries_X_Scale.png b/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Timeseries_X_Scale.png index 92a43880ef02625c0933bc40eec5f0dc0f617f1f..ed4f2f0d115168f6b0a0b67a26ed030d428f0a84 100644 Binary files a/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Timeseries_X_Scale.png and b/.loki/reference/chrome_laptop_static_viz_ScatterPlot_Timeseries_X_Scale.png differ diff --git a/frontend/src/metabase/static-viz/components/ComboChart/ComboChart.stories.tsx b/frontend/src/metabase/static-viz/components/ComboChart/ComboChart.stories.tsx index 012f463021ed7013b5493525cd398cea05e81a40..3bcb2ab71701b43fe3f6aa7e9ffb135bf31e22e7 100644 --- a/frontend/src/metabase/static-viz/components/ComboChart/ComboChart.stories.tsx +++ b/frontend/src/metabase/static-viz/components/ComboChart/ComboChart.stories.tsx @@ -675,6 +675,13 @@ TwoBarsTwoAreasOneLineLog.args = { renderingContext, }; +export const BarCorrectWidthWhenTwoYAxes = Template.bind({}); +BarCorrectWidthWhenTwoYAxes.args = { + rawSeries: data.barCorrectWidthWhenTwoYAxes as any, + dashcardSettings: {}, + renderingContext, +}; + export const Default = Template.bind({}); Default.args = { rawSeries: data.messedUpAxis as any, diff --git a/frontend/src/metabase/static-viz/components/ComboChart/stories-data/bar-correct-width-when-two-y-axes.json b/frontend/src/metabase/static-viz/components/ComboChart/stories-data/bar-correct-width-when-two-y-axes.json new file mode 100644 index 0000000000000000000000000000000000000000..ed5a2203e0bf54189f34fe7154cd98dc3b908e10 --- /dev/null +++ b/frontend/src/metabase/static-viz/components/ComboChart/stories-data/bar-correct-width-when-two-y-axes.json @@ -0,0 +1,493 @@ +[ + { + "card": { + "displayIsLocked": true, + "cache_invalidated_at": null, + "archived": false, + "view_count": 1, + "collection_position": null, + "table_id": 5, + "result_metadata": [ + { + "description": "The date and time an order was submitted.", + "semantic_type": "type/CreationTimestamp", + "coercion_strategy": null, + "unit": "year", + "name": "CREATED_AT", + "settings": null, + "fk_target_field_id": null, + "field_ref": [ + "field", + 41, + { + "base-type": "type/DateTime", + "temporal-unit": "year" + } + ], + "effective_type": "type/DateTime", + "id": 41, + "visibility_type": "normal", + "display_name": "Created At", + "fingerprint": { + "global": { + "distinct-count": 10001, + "nil%": 0 + }, + "type": { + "type/DateTime": { + "earliest": "2022-04-30T18:56:13.352Z", + "latest": "2026-04-19T14:07:15.657Z" + } + } + }, + "base_type": "type/DateTime" + }, + { + "display_name": "Count", + "semantic_type": "type/Quantity", + "field_ref": ["aggregation", 0], + "name": "count", + "base_type": "type/BigInteger", + "effective_type": "type/BigInteger", + "fingerprint": { + "global": { + "distinct-count": 5, + "nil%": 0 + }, + "type": { + "type/Number": { + "min": 744, + "q1": 1681.5, + "q3": 6020, + "max": 6578, + "sd": 2473.8528654711863, + "avg": 3752 + } + } + } + }, + { + "display_name": "Average of Total", + "semantic_type": "type/Currency", + "settings": { + "currency": "BTC" + }, + "field_ref": ["aggregation", 1], + "name": "avg", + "base_type": "type/Float", + "effective_type": "type/Float", + "fingerprint": { + "global": { + "distinct-count": 5, + "nil%": 0 + }, + "type": { + "type/Number": { + "min": 56.662458664541255, + "q1": 56.80883246662991, + "q3": 87.87344168472816, + "max": 88.31329491327396, + "sd": 17.016541966969204, + "avg": 75.39730024997462 + } + } + } + }, + { + "display_name": "Average of Subtotal", + "semantic_type": null, + "settings": null, + "field_ref": ["aggregation", 2], + "name": "avg_2", + "base_type": "type/Float", + "effective_type": "type/Float", + "fingerprint": { + "global": { + "distinct-count": 5, + "nil%": 0 + }, + "type": { + "type/Number": { + "min": 54.43766905499354, + "q1": 54.60614932759098, + "q3": 84.22781188984489, + "max": 84.68656836914737, + "sd": 16.222923412873346, + "avg": 72.3170922047589 + } + } + } + } + ], + "initially_published_at": null, + "can_write": true, + "trashed_from_collection_id": null, + "database_id": 1, + "enable_embedding": false, + "collection_id": null, + "query_type": "query", + "last_query_start": null, + "dashboard_count": 0, + "last_used_at": null, + "type": "question", + "average_query_time": null, + "creator_id": 1, + "moderation_reviews": [], + "updated_at": "2024-05-23T23:47:11.437273Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "database": 1, + "type": "query", + "query": { + "source-table": 5, + "aggregation": [ + ["count"], + [ + "avg", + [ + "field", + 42, + { + "base-type": "type/Float" + } + ] + ], + [ + "avg", + [ + "field", + 44, + { + "base-type": "type/Float" + } + ] + ] + ], + "breakout": [ + [ + "field", + 41, + { + "base-type": "type/DateTime", + "temporal-unit": "year" + } + ] + ] + } + }, + "parameter_mappings": [], + "display": "combo", + "entity_id": "0YDHRDHqrGiAzFtsJEbuy", + "collection_preview": true, + "visualization_settings": { + "graph.show_goal": false, + "graph.show_trendline": false, + "graph.show_values": true, + "graph.series_order_dimension": null, + "graph.label_value_frequency": "fit", + "graph.metrics": ["count", "avg", "avg_2"], + "graph.series_order": null, + "series_settings": { + "Doohickey": { + "display": "line" + }, + "count": { + "display": "bar" + } + }, + "graph.dimensions": ["CREATED_AT"], + "stackable.stack_type": null + }, + "collection": { + "metabase.models.collection.root/is-root?": true, + "authority_level": null, + "name": "Our analytics", + "is_personal": false, + "id": "root", + "can_write": true + }, + "metabase_version": "v0.1.3-SNAPSHOT (5a3ae84)", + "parameters": [], + "created_at": "2024-05-23T23:47:11.437273Z", + "parameter_usage_count": 0, + "public_uuid": null, + "original_card_id": 322 + }, + "data": { + "rows": [ + [ + "2022-01-01T00:00:00-03:00", + 744, + 56.662458664541255, + 54.43766905499354 + ], + [ + "2023-01-01T00:00:00-03:00", + 3610, + 56.85762373399279, + 54.662309418456786 + ], + [ + "2024-01-01T00:00:00-03:00", + 5834, + 87.42629999618556, + 83.72402111778601 + ], + [ + "2025-01-01T00:00:00-03:00", + 6578, + 87.72682394187956, + 84.07489306341073 + ], + [ + "2026-01-01T00:00:00-03:00", + 1994, + 88.31329491327396, + 84.68656836914737 + ] + ], + "cols": [ + { + "description": "The date and time an order was submitted.", + "semantic_type": "type/CreationTimestamp", + "table_id": 5, + "coercion_strategy": null, + "unit": "year", + "name": "CREATED_AT", + "settings": null, + "source": "breakout", + "fk_target_field_id": null, + "field_ref": [ + "field", + 41, + { + "base-type": "type/DateTime", + "temporal-unit": "year" + } + ], + "effective_type": "type/DateTime", + "nfc_path": null, + "parent_id": null, + "id": 41, + "position": 7, + "visibility_type": "normal", + "display_name": "Created At", + "fingerprint": { + "global": { + "distinct-count": 10001, + "nil%": 0 + }, + "type": { + "type/DateTime": { + "earliest": "2022-04-30T18:56:13.352Z", + "latest": "2026-04-19T14:07:15.657Z" + } + } + }, + "base_type": "type/DateTime" + }, + { + "base_type": "type/BigInteger", + "name": "count", + "display_name": "Count", + "semantic_type": "type/Quantity", + "source": "aggregation", + "field_ref": ["aggregation", 0], + "aggregation_index": 0, + "effective_type": "type/BigInteger" + }, + { + "semantic_type": "type/Currency", + "name": "avg", + "settings": { + "currency": "BTC" + }, + "source": "aggregation", + "field_ref": ["aggregation", 1], + "effective_type": "type/Float", + "aggregation_index": 1, + "display_name": "Average of Total", + "base_type": "type/Float" + }, + { + "semantic_type": null, + "name": "avg_2", + "settings": null, + "source": "aggregation", + "field_ref": ["aggregation", 2], + "effective_type": "type/Float", + "aggregation_index": 2, + "display_name": "Average of Subtotal", + "base_type": "type/Float" + } + ], + "native_form": { + "query": "SELECT DATE_TRUNC('year', \"PUBLIC\".\"ORDERS\".\"CREATED_AT\") AS \"CREATED_AT\", COUNT(*) AS \"count\", AVG(\"PUBLIC\".\"ORDERS\".\"TOTAL\") AS \"avg\", AVG(\"PUBLIC\".\"ORDERS\".\"SUBTOTAL\") AS \"avg_2\" FROM \"PUBLIC\".\"ORDERS\" GROUP BY DATE_TRUNC('year', \"PUBLIC\".\"ORDERS\".\"CREATED_AT\") ORDER BY DATE_TRUNC('year', \"PUBLIC\".\"ORDERS\".\"CREATED_AT\") ASC", + "params": null + }, + "format-rows?": true, + "results_timezone": "America/Montevideo", + "requested_timezone": "Canada/Eastern", + "results_metadata": { + "columns": [ + { + "description": "The date and time an order was submitted.", + "semantic_type": "type/CreationTimestamp", + "coercion_strategy": null, + "unit": "year", + "name": "CREATED_AT", + "settings": null, + "fk_target_field_id": null, + "field_ref": [ + "field", + 41, + { + "base-type": "type/DateTime", + "temporal-unit": "year" + } + ], + "effective_type": "type/DateTime", + "id": 41, + "visibility_type": "normal", + "display_name": "Created At", + "fingerprint": { + "global": { + "distinct-count": 10001, + "nil%": 0 + }, + "type": { + "type/DateTime": { + "earliest": "2022-04-30T18:56:13.352Z", + "latest": "2026-04-19T14:07:15.657Z" + } + } + }, + "base_type": "type/DateTime" + }, + { + "display_name": "Count", + "semantic_type": "type/Quantity", + "field_ref": ["aggregation", 0], + "name": "count", + "base_type": "type/BigInteger", + "effective_type": "type/BigInteger", + "fingerprint": { + "global": { + "distinct-count": 5, + "nil%": 0 + }, + "type": { + "type/Number": { + "min": 744, + "q1": 1681.5, + "q3": 6020, + "max": 6578, + "sd": 2473.8528654711863, + "avg": 3752 + } + } + } + }, + { + "display_name": "Average of Total", + "semantic_type": "type/Currency", + "settings": { + "currency": "BTC" + }, + "field_ref": ["aggregation", 1], + "name": "avg", + "base_type": "type/Float", + "effective_type": "type/Float", + "fingerprint": { + "global": { + "distinct-count": 5, + "nil%": 0 + }, + "type": { + "type/Number": { + "min": 56.662458664541255, + "q1": 56.80883246662991, + "q3": 87.87344168472816, + "max": 88.31329491327396, + "sd": 17.016541966969204, + "avg": 75.39730024997462 + } + } + } + }, + { + "display_name": "Average of Subtotal", + "semantic_type": null, + "settings": null, + "field_ref": ["aggregation", 2], + "name": "avg_2", + "base_type": "type/Float", + "effective_type": "type/Float", + "fingerprint": { + "global": { + "distinct-count": 5, + "nil%": 0 + }, + "type": { + "type/Number": { + "min": 54.43766905499354, + "q1": 54.60614932759098, + "q3": 84.22781188984489, + "max": 84.68656836914737, + "sd": 16.222923412873346, + "avg": 72.3170922047589 + } + } + } + } + ] + }, + "insights": [ + { + "previous-value": 6578, + "unit": "year", + "offset": -25762.729004320387, + "last-change": -0.6968683490422621, + "col": "count", + "slope": 1.496422622443016, + "last-value": 1994, + "best-fit": [ + "+", + -296040.2275868308, + ["*", 30315.040225593806, ["log", "x"]] + ] + }, + { + "previous-value": 87.72682394187956, + "unit": "year", + "offset": -433.0119131122143, + "last-change": 0.006685195531334312, + "col": "avg", + "slope": 0.025776792604881173, + "last-value": 88.31329491327396, + "best-fit": [ + "+", + -4964.223593557467, + ["*", 509.60730819235795, ["log", "x"]] + ] + }, + { + "previous-value": 84.07489306341073, + "unit": "year", + "offset": -413.09096131129013, + "last-change": 0.007275362280571722, + "col": "avg_2", + "slope": 0.024610613646194022, + "last-value": 84.68656836914737, + "best-fit": [ + "+", + -4739.199068747425, + ["*", 486.54131943134985, ["log", "x"]] + ] + } + ] + } + } +] diff --git a/frontend/src/metabase/static-viz/components/ComboChart/stories-data/index.ts b/frontend/src/metabase/static-viz/components/ComboChart/stories-data/index.ts index 27fedd67850c1e3a96797d424545893a225e906a..b23edd348cd666587e01f55bb5cad6da91402fd9 100644 --- a/frontend/src/metabase/static-viz/components/ComboChart/stories-data/index.ts +++ b/frontend/src/metabase/static-viz/components/ComboChart/stories-data/index.ts @@ -11,6 +11,7 @@ import autoYSplit from "./auto-y-split.json"; import barAutoFormattingCompact from "./bar-auto-formatting-compact.json"; import barAutoFormattingFull from "./bar-auto-formatting-full.json"; import barBreakoutWithLineSeriesStackedRightAxisOnly from "./bar-breakout-with-line-series-stacked-right-axis-only.json"; +import barCorrectWidthWhenTwoYAxes from "./bar-correct-width-when-two-y-axes.json"; import barFormattingFull from "./bar-formatting-full.json"; import barFullyNullDimension37902 from "./bar-fully-null-dimension-37902.json"; import barHistogramMultiSeriesBinned from "./bar-histogram-multi-series-binned.json"; @@ -103,6 +104,7 @@ export const data = { lineCustomYAxisRangeEqualsExtents, lineFullyNullDimension37902, areaFullyNullDimension37902, + barCorrectWidthWhenTwoYAxes, barLinearXScale, barHistogramXScale, barHistogramMultiSeries, diff --git a/frontend/src/metabase/visualizations/echarts/cartesian/option/series.ts b/frontend/src/metabase/visualizations/echarts/cartesian/option/series.ts index 6f152d47708d4fb4ff8a6d92560ad4049e850fab..dbe5d08d1c04a734d6b5baa6c324813a38a512cc 100644 --- a/frontend/src/metabase/visualizations/echarts/cartesian/option/series.ts +++ b/frontend/src/metabase/visualizations/echarts/cartesian/option/series.ts @@ -127,7 +127,6 @@ export const computeContinuousScaleBarWidth = ( xAxisModel: TimeSeriesXAxisModel | NumericXAxisModel, boundaryWidth: number, barSeriesCount: number, - yAxisWithBarSeriesCount: number, stackedOrSingleSeries: boolean, ) => { let barWidth = @@ -138,8 +137,6 @@ export const computeContinuousScaleBarWidth = ( barWidth /= barSeriesCount; } - barWidth /= yAxisWithBarSeriesCount; - return barWidth; }; @@ -147,7 +144,6 @@ export const computeBarWidth = ( xAxisModel: XAxisModel, boundaryWidth: number, barSeriesCount: number, - yAxisWithBarSeriesCount: number, isStacked: boolean, ) => { const stackedOrSingleSeries = isStacked || barSeriesCount === 1; @@ -159,7 +155,6 @@ export const computeBarWidth = ( xAxisModel, boundaryWidth, barSeriesCount, - yAxisWithBarSeriesCount, stackedOrSingleSeries, ); } @@ -186,7 +181,6 @@ const buildEChartsBarSeries = ( settings: ComputedVisualizationSettings, yAxisIndex: number, barSeriesCount: number, - yAxisWithBarSeriesCount: number, hasMultipleSeries: boolean, labelFormatter: LabelFormatter | undefined, renderingContext: RenderingContext, @@ -214,7 +208,6 @@ const buildEChartsBarSeries = ( xAxisModel, chartMeasurements.boundaryWidth, barSeriesCount, - yAxisWithBarSeriesCount, !!stackName, ), encode: { @@ -538,25 +531,6 @@ export const buildEChartsSeries = ( {} as Record<DataKey, number>, ); - const barSeriesCountByYAxisIndex = chartModel.seriesModels.reduce( - (acc, seriesModel) => { - const isBar = - seriesSettingsByDataKey[seriesModel.dataKey].display === "bar"; - - if (isBar) { - const yAxisIndex = seriesYAxisIndexByDataKey[seriesModel.dataKey]; - acc[yAxisIndex] = (acc[yAxisIndex] ?? 0) + 1; - } - - return acc; - }, - {} as Record<number, number>, - ); - - const yAxisWithBarSeriesCount = Object.keys( - barSeriesCountByYAxisIndex, - ).length; - const barSeriesCount = Object.values(seriesSettingsByDataKey).filter( seriesSettings => seriesSettings.display === "bar", ).length; @@ -608,7 +582,6 @@ export const buildEChartsSeries = ( settings, yAxisIndex, barSeriesCount, - yAxisWithBarSeriesCount, hasMultipleSeries, chartModel?.seriesLabelsFormatters?.[seriesModel.dataKey], renderingContext, diff --git a/frontend/src/metabase/visualizations/echarts/cartesian/waterfall/option/index.ts b/frontend/src/metabase/visualizations/echarts/cartesian/waterfall/option/index.ts index 590dab3d91b6cc241c074f4d307e8717da8aeb2f..d2478f6a984f9398db4cefbe11fbc6095bfe1b87 100644 --- a/frontend/src/metabase/visualizations/echarts/cartesian/waterfall/option/index.ts +++ b/frontend/src/metabase/visualizations/echarts/cartesian/waterfall/option/index.ts @@ -88,7 +88,6 @@ const computeWaterfallBarWidth = ( chartModel.xAxisModel, boundaryWidth, 1, - 1, true, ); };