Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Cartesian charts UI improvements (#82789)

Anderson012f1fb635c5
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Dark_Theme_Default.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Dark_Theme_Default.png
index 1d98c175df8..7162b2a2ff2 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Dark_Theme_Default.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Dark_Theme_Default.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Dark_Theme_No_Background_Default.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Dark_Theme_No_Background_Default.png
index 2e8d273d263..033679920e9 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Dark_Theme_No_Background_Default.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Dark_Theme_No_Background_Default.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Dark_Theme_No_Background_Scroll.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Dark_Theme_No_Background_Scroll.png
index 83138fd78d3..b7c8af7bd43 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Dark_Theme_No_Background_Scroll.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Dark_Theme_No_Background_Scroll.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Dark_Theme_Scroll.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Dark_Theme_Scroll.png
index 2c129ae88c8..0b064a64c2b 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Dark_Theme_Scroll.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Dark_Theme_Scroll.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Light_Theme_Default.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Light_Theme_Default.png
index af135d0ed1b..f3d745f02f0 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Light_Theme_Default.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Light_Theme_Default.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Light_Theme_No_Background_Default.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Light_Theme_No_Background_Default.png
index a4fa85937be..44b2abaaef4 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Light_Theme_No_Background_Default.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Light_Theme_No_Background_Default.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Light_Theme_No_Background_Scroll.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Light_Theme_No_Background_Scroll.png
index fc283dfd478..2b4fdf15bfe 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Light_Theme_No_Background_Scroll.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Light_Theme_No_Background_Scroll.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Light_Theme_Scroll.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Light_Theme_Scroll.png
index 6e522c0b4f9..7b2837aa468 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Light_Theme_Scroll.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Light_Theme_Scroll.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Transparent_Theme_Default.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Transparent_Theme_Default.png
index 7c1e7b5f06f..0e63062352d 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Transparent_Theme_Default.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Transparent_Theme_Default.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Transparent_Theme_No_Background_Default.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Transparent_Theme_No_Background_Default.png
index ccf2d951af8..740dd18e22e 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Transparent_Theme_No_Background_Default.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Transparent_Theme_No_Background_Default.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Transparent_Theme_No_Background_Scroll.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Transparent_Theme_No_Background_Scroll.png
index dbfbaed96ea..7a9a2450523 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Transparent_Theme_No_Background_Scroll.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Transparent_Theme_No_Background_Scroll.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Transparent_Theme_Scroll.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Transparent_Theme_Scroll.png
index b01ecf218b8..a88aa4476a6 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Transparent_Theme_Scroll.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_Transparent_Theme_Scroll.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Full_Width_Chart_Many_Filters.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Full_Width_Chart_Many_Filters.png
index d31943d7e66..adf810dc82c 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Full_Width_Chart_Many_Filters.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Full_Width_Chart_Many_Filters.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Full_Width_Chart_One_Filter.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Full_Width_Chart_One_Filter.png
index c5c6a28b63a..9b68db25b47 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Full_Width_Chart_One_Filter.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Full_Width_Chart_One_Filter.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Full_Width_Heading_Many_Filters.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Full_Width_Heading_Many_Filters.png
index ff3f97bf853..58ecb337d61 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Full_Width_Heading_Many_Filters.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Full_Width_Heading_Many_Filters.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Full_Width_Heading_One_Filter.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Full_Width_Heading_One_Filter.png
index b11bba55faf..57091798ac7 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Full_Width_Heading_One_Filter.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Full_Width_Heading_One_Filter.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Medium_Chart_Many_Filters.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Medium_Chart_Many_Filters.png
index 93e93539f12..e93cfd276f1 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Medium_Chart_Many_Filters.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Medium_Chart_Many_Filters.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Medium_Chart_One_Filter.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Medium_Chart_One_Filter.png
index 1e4a590ca10..d5796511fc1 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Medium_Chart_One_Filter.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Medium_Chart_One_Filter.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Narrow_Chart_Many_Filters.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Narrow_Chart_Many_Filters.png
index 98e858ea420..100e2e04941 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Narrow_Chart_Many_Filters.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Narrow_Chart_Many_Filters.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Narrow_Chart_Many_Filters_Expanded.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Narrow_Chart_Many_Filters_Expanded.png
index 56fbdd6dda4..db3af85dfc7 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Narrow_Chart_Many_Filters_Expanded.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Narrow_Chart_Many_Filters_Expanded.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Narrow_Chart_One_Filter.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Narrow_Chart_One_Filter.png
index e1d5626ad16..857b41f5e0b 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Narrow_Chart_One_Filter.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Narrow_Chart_One_Filter.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Narrow_Chart_One_Filter_Long_Card_Name.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Narrow_Chart_One_Filter_Long_Card_Name.png
index 1f2aedfcb10..4cdecae8701 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Narrow_Chart_One_Filter_Long_Card_Name.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Narrow_Chart_One_Filter_Long_Card_Name.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Narrow_Heading_Many_Filters.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Narrow_Heading_Many_Filters.png
index 2c157313c0b..dcee4d85399 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Narrow_Heading_Many_Filters.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Narrow_Heading_Many_Filters.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Narrow_Heading_Many_Filters_Expanded.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Narrow_Heading_Many_Filters_Expanded.png
index 931d6d2ea2c..d9766e794c9 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Narrow_Heading_Many_Filters_Expanded.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Narrow_Heading_Many_Filters_Expanded.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Narrow_Heading_One_Filter.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Narrow_Heading_One_Filter.png
index 079338bf586..e6cdeadf59c 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Narrow_Heading_One_Filter.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Narrow_Heading_One_Filter.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Narrow_Heading_One_Filter_Long_Text.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Narrow_Heading_One_Filter_Long_Text.png
index 07bfc028473..9c1e560c6f5 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Narrow_Heading_One_Filter_Long_Text.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_card_filters_Narrow_Heading_One_Filter_Long_Text.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Date_Filter_All_Options.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Date_Filter_All_Options.png
index 7995a3dd51c..134b0058598 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Date_Filter_All_Options.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Date_Filter_All_Options.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Date_Filter_Month_Year.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Date_Filter_Month_Year.png
index e5c74733439..fc6858112f8 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Date_Filter_Month_Year.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Date_Filter_Month_Year.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Date_Filter_Quarter_Year.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Date_Filter_Quarter_Year.png
index 30c4627a666..7343be0045c 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Date_Filter_Quarter_Year.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Date_Filter_Quarter_Year.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Date_Filter_Quarter_Year_Dropdown.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Date_Filter_Quarter_Year_Dropdown.png
index 9f5d1c2bc14..4c93cd580b1 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Date_Filter_Quarter_Year_Dropdown.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Date_Filter_Quarter_Year_Dropdown.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Date_Filter_Relative.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Date_Filter_Relative.png
index ce6f33a6271..904f70d231b 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Date_Filter_Relative.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Date_Filter_Relative.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Date_Filter_Single.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Date_Filter_Single.png
index aab403b9c1b..939de18e205 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Date_Filter_Single.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Date_Filter_Single.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Number.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Number.png
index b162dc0a4a4..165b662261b 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Number.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Number.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Parameter_List.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Parameter_List.png
index 4ef493eef04..1b08a0c5ff5 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Parameter_List.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Parameter_List.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Parameter_List_Single_With_Value.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Parameter_List_Single_With_Value.png
index d12a891eff8..406a481f00c 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Parameter_List_Single_With_Value.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Parameter_List_Single_With_Value.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Parameter_List_With_Value.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Parameter_List_With_Value.png
index 9eab2da442c..3f5ce7d8a02 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Parameter_List_With_Value.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Parameter_List_With_Value.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Parameter_Search.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Parameter_Search.png
index 4ef493eef04..1b08a0c5ff5 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Parameter_Search.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Parameter_Search.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Parameter_Search_With_Value.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Parameter_Search_With_Value.png
index 49a35b01164..cf0d8f192e4 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Parameter_Search_With_Value.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Parameter_Search_With_Value.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Text.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Text.png
index 2854e744735..8d88f2e4c5f 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Text.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Text.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Text_With_Value.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Text_With_Value.png
index f69dfe96bdd..7352eceaa9a 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Text_With_Value.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Text_With_Value.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Unit_Of_Time.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Unit_Of_Time.png
index aae2928cf7e..1f56f6215d9 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Unit_Of_Time.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Dark_Theme_Unit_Of_Time.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Date_Filter_All_Options.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Date_Filter_All_Options.png
index 3abd46ea74b..6a7d2ebee00 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Date_Filter_All_Options.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Date_Filter_All_Options.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Date_Filter_Month_Year.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Date_Filter_Month_Year.png
index 3334c23ceff..7d5d780d7c8 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Date_Filter_Month_Year.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Date_Filter_Month_Year.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Date_Filter_Quarter_Year.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Date_Filter_Quarter_Year.png
index d71d957bca2..56ada1d3306 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Date_Filter_Quarter_Year.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Date_Filter_Quarter_Year.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Date_Filter_Quarter_Year_Dropdown.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Date_Filter_Quarter_Year_Dropdown.png
index 8272feaf628..cbcc024db69 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Date_Filter_Quarter_Year_Dropdown.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Date_Filter_Quarter_Year_Dropdown.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Date_Filter_Relative.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Date_Filter_Relative.png
index a2716a3f19e..d3b3d222d34 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Date_Filter_Relative.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Date_Filter_Relative.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Date_Filter_Single.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Date_Filter_Single.png
index abf3ca2ff03..2cf354874c3 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Date_Filter_Single.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Date_Filter_Single.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Number.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Number.png
index accee309b28..e939bc63d79 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Number.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Number.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Parameter_List.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Parameter_List.png
index f2e98a940f5..7768db9b323 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Parameter_List.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Parameter_List.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Parameter_List_Single_With_Value.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Parameter_List_Single_With_Value.png
index 94c8a14a0f2..1e1c88c2162 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Parameter_List_Single_With_Value.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Parameter_List_Single_With_Value.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Parameter_List_With_Value.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Parameter_List_With_Value.png
index 7e92f79a903..a067f7135ea 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Parameter_List_With_Value.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Parameter_List_With_Value.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Parameter_Search.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Parameter_Search.png
index f2e98a940f5..c9d26458064 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Parameter_Search.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Parameter_Search.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Parameter_Search_With_Value.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Parameter_Search_With_Value.png
index 69f292c87f3..3de2c55c760 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Parameter_Search_With_Value.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Parameter_Search_With_Value.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Text.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Text.png
index f28c6515854..e1d9cee35c0 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Text.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Text.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Text_With_Value.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Text_With_Value.png
index 3d370685223..38a139e15ab 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Text_With_Value.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Text_With_Value.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Unit_Of_Time.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Unit_Of_Time.png
index 954dfc13fa8..9fd0ca039b7 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Unit_Of_Time.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedDashboardView_filters_Light_Theme_Unit_Of_Time.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedQuestionView_Dark_Theme_Default.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedQuestionView_Dark_Theme_Default.png
index 1d1912b8e0f..5bf7cee9c07 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedQuestionView_Dark_Theme_Default.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedQuestionView_Dark_Theme_Default.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedQuestionView_Dark_Theme_Download.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedQuestionView_Dark_Theme_Download.png
index 936055370d1..2e9af3afd68 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedQuestionView_Dark_Theme_Download.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedQuestionView_Dark_Theme_Download.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedQuestionView_Light_Theme_Default.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedQuestionView_Light_Theme_Default.png
index 09def68ab92..9898765889b 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedQuestionView_Light_Theme_Default.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedQuestionView_Light_Theme_Default.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedQuestionView_Light_Theme_Download.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedQuestionView_Light_Theme_Download.png
index bacd99b6ce3..d1424d7ce1e 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedQuestionView_Light_Theme_Download.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedQuestionView_Light_Theme_Download.png differ
diff --git a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedQuestionView_Transparent_Theme_Default.png b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedQuestionView_Transparent_Theme_Default.png
index dee8b239686..e164e847de9 100644
Binary files a/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedQuestionView_Transparent_Theme_Default.png and b/.loki/reference/chrome_laptop_App_Embed_PublicOrEmbeddedQuestionView_Transparent_Theme_Default.png differ
diff --git a/.loki/reference/chrome_laptop_Components_Documents_Card_Embed.png b/.loki/reference/chrome_laptop_Components_Documents_Card_Embed.png
index 0ff2e99e026..fd11c18929e 100644
Binary files a/.loki/reference/chrome_laptop_Components_Documents_Card_Embed.png and b/.loki/reference/chrome_laptop_Components_Documents_Card_Embed.png differ
diff --git a/.loki/reference/chrome_laptop_Design_System_Colors_Default.png b/.loki/reference/chrome_laptop_Design_System_Colors_Default.png
index 7ade1240daf..96e0c56e553 100644
Binary files a/.loki/reference/chrome_laptop_Design_System_Colors_Default.png and b/.loki/reference/chrome_laptop_Design_System_Colors_Default.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_BoxPlot_Responsive_axes_Explicit_Settings.png b/.loki/reference/chrome_laptop_Viz_BoxPlot_Responsive_axes_Explicit_Settings.png
new file mode 100644
index 00000000000..303308ed8fe
Binary files /dev/null and b/.loki/reference/chrome_laptop_Viz_BoxPlot_Responsive_axes_Explicit_Settings.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_BoxPlot_Responsive_axes_Large.png b/.loki/reference/chrome_laptop_Viz_BoxPlot_Responsive_axes_Large.png
new file mode 100644
index 00000000000..da42b943135
Binary files /dev/null and b/.loki/reference/chrome_laptop_Viz_BoxPlot_Responsive_axes_Large.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_BoxPlot_Responsive_axes_Medium.png b/.loki/reference/chrome_laptop_Viz_BoxPlot_Responsive_axes_Medium.png
new file mode 100644
index 00000000000..6bd35a577fe
Binary files /dev/null and b/.loki/reference/chrome_laptop_Viz_BoxPlot_Responsive_axes_Medium.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_BoxPlot_Responsive_axes_Small.png b/.loki/reference/chrome_laptop_Viz_BoxPlot_Responsive_axes_Small.png
new file mode 100644
index 00000000000..9be0ac9d91f
Binary files /dev/null and b/.loki/reference/chrome_laptop_Viz_BoxPlot_Responsive_axes_Small.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Cartesian_presentation_Fullscreen_Contexts.png b/.loki/reference/chrome_laptop_Viz_Cartesian_presentation_Fullscreen_Contexts.png
new file mode 100644
index 00000000000..c7c2f0a0b55
Binary files /dev/null and b/.loki/reference/chrome_laptop_Viz_Cartesian_presentation_Fullscreen_Contexts.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Cartesian_presentation_Large_Contexts.png b/.loki/reference/chrome_laptop_Viz_Cartesian_presentation_Large_Contexts.png
new file mode 100644
index 00000000000..79f8b5dba7a
Binary files /dev/null and b/.loki/reference/chrome_laptop_Viz_Cartesian_presentation_Large_Contexts.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Cartesian_presentation_Medium_Contexts.png b/.loki/reference/chrome_laptop_Viz_Cartesian_presentation_Medium_Contexts.png
new file mode 100644
index 00000000000..e309db1a1e9
Binary files /dev/null and b/.loki/reference/chrome_laptop_Viz_Cartesian_presentation_Medium_Contexts.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Cartesian_presentation_Sdk_Custom_Border.png b/.loki/reference/chrome_laptop_Viz_Cartesian_presentation_Sdk_Custom_Border.png
new file mode 100644
index 00000000000..91eafaa8cc0
Binary files /dev/null and b/.loki/reference/chrome_laptop_Viz_Cartesian_presentation_Sdk_Custom_Border.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Cartesian_presentation_Sdk_Custom_Gridline_And_Font.png b/.loki/reference/chrome_laptop_Viz_Cartesian_presentation_Sdk_Custom_Gridline_And_Font.png
new file mode 100644
index 00000000000..1be6fd5ba8b
Binary files /dev/null and b/.loki/reference/chrome_laptop_Viz_Cartesian_presentation_Sdk_Custom_Gridline_And_Font.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Cartesian_presentation_Sdk_Dark.png b/.loki/reference/chrome_laptop_Viz_Cartesian_presentation_Sdk_Dark.png
new file mode 100644
index 00000000000..df11954445c
Binary files /dev/null and b/.loki/reference/chrome_laptop_Viz_Cartesian_presentation_Sdk_Dark.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Cartesian_presentation_Sdk_Light.png b/.loki/reference/chrome_laptop_Viz_Cartesian_presentation_Sdk_Light.png
new file mode 100644
index 00000000000..0229ec63919
Binary files /dev/null and b/.loki/reference/chrome_laptop_Viz_Cartesian_presentation_Sdk_Light.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Cartesian_presentation_Small_Contexts.png b/.loki/reference/chrome_laptop_Viz_Cartesian_presentation_Small_Contexts.png
new file mode 100644
index 00000000000..fb60a88b48b
Binary files /dev/null and b/.loki/reference/chrome_laptop_Viz_Cartesian_presentation_Small_Contexts.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Shared_RowChart_Default.png b/.loki/reference/chrome_laptop_Viz_Shared_RowChart_Default.png
index f5dc9d30379..a5f7341aee1 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Shared_RowChart_Default.png and b/.loki/reference/chrome_laptop_Viz_Shared_RowChart_Default.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Shared_RowChart_Huge_Font.png b/.loki/reference/chrome_laptop_Viz_Shared_RowChart_Huge_Font.png
index 4d618216fcf..c706e44bd33 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Shared_RowChart_Huge_Font.png and b/.loki/reference/chrome_laptop_Viz_Shared_RowChart_Huge_Font.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Box_Plot_Customization.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Box_Plot_Customization.png
index 511f88cfd80..3c5eaaf6f9a 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Box_Plot_Customization.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Box_Plot_Customization.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Custom_Y_Axis_Range_Off_Screen.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Custom_Y_Axis_Range_Off_Screen.png
index df3cb0d3e29..d6a8f50251d 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Custom_Y_Axis_Range_Off_Screen.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Custom_Y_Axis_Range_Off_Screen.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Dense_Temporal_Data.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Dense_Temporal_Data.png
index 9977adcbc54..b174abfb796 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Dense_Temporal_Data.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Dense_Temporal_Data.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Distribution_Shapes.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Distribution_Shapes.png
index 5841fab388e..b20ea7952db 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Distribution_Shapes.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Distribution_Shapes.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Label_Formatting.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Label_Formatting.png
index df4c6bb713a..35534e9bc50 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Label_Formatting.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Label_Formatting.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Label_Overflow.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Label_Overflow.png
index ccc8f4ef86d..da3035dbcfc 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Label_Overflow.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Label_Overflow.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Log_Scale.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Log_Scale.png
index a38c6ea30d5..c1a3fc58b20 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Log_Scale.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Log_Scale.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Log_Scale_Edge_Cases.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Log_Scale_Edge_Cases.png
index ba482b55ff8..186b494364d 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Log_Scale_Edge_Cases.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Log_Scale_Edge_Cases.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Many_Categories.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Many_Categories.png
index a393c4aa624..1eb82927e51 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Many_Categories.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Many_Categories.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Medium_Dense_Temporal_Data.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Medium_Dense_Temporal_Data.png
index b15abc57026..04ff7d8baa9 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Medium_Dense_Temporal_Data.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Medium_Dense_Temporal_Data.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Min_Max_No_Outliers.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Min_Max_No_Outliers.png
index 44df59a036f..638dd44ef17 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Min_Max_No_Outliers.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Min_Max_No_Outliers.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Multi_Series_Breakout_With_Hidden_Sort_Formatting.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Multi_Series_Breakout_With_Hidden_Sort_Formatting.png
index f7d2a718d56..3f9b8147111 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Multi_Series_Breakout_With_Hidden_Sort_Formatting.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Multi_Series_Breakout_With_Hidden_Sort_Formatting.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Multi_Series_Two_Metrics_With_Axis_Split_Formatting.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Multi_Series_Two_Metrics_With_Axis_Split_Formatting.png
index 767ee4ab31c..4a1cd8d020f 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Multi_Series_Two_Metrics_With_Axis_Split_Formatting.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Multi_Series_Two_Metrics_With_Axis_Split_Formatting.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Numeric_Dimension_Min_Max.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Numeric_Dimension_Min_Max.png
index 750d1d47984..f02d9ac42cc 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Numeric_Dimension_Min_Max.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Numeric_Dimension_Min_Max.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Numeric_Dimension_Tukey.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Numeric_Dimension_Tukey.png
index d014e11ddf2..61ac0c23c6a 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Numeric_Dimension_Tukey.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Numeric_Dimension_Tukey.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Numeric_Min_Max_All_Points.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Numeric_Min_Max_All_Points.png
index 3ee9d841e9b..2ceea74d38f 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Numeric_Min_Max_All_Points.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Numeric_Min_Max_All_Points.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Outlier_Overflow.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Outlier_Overflow.png
index fa112d99fff..1c95bd8d5ba 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Outlier_Overflow.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Outlier_Overflow.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Positive_Negative_Cross_Zero_Y_Axis_Auto.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Positive_Negative_Cross_Zero_Y_Axis_Auto.png
index 2fa6bf8c69b..d95c65b92f1 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Positive_Negative_Cross_Zero_Y_Axis_Auto.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Positive_Negative_Cross_Zero_Y_Axis_Auto.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Pow_Scale.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Pow_Scale.png
index 8afa93a96b3..6670656ca1c 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Pow_Scale.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Pow_Scale.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Scale_Extremes.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Scale_Extremes.png
index 0c79b58059a..a0db54eaf65 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Scale_Extremes.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Scale_Extremes.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Single_Category.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Single_Category.png
index d08161a12ad..2636df60a63 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Single_Category.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Single_Category.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Top_Bottom_Mixed_Outliers.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Top_Bottom_Mixed_Outliers.png
index e2b49dbbb47..ff2365d0b2e 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Top_Bottom_Mixed_Outliers.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_BoxPlotChart_Top_Bottom_Mixed_Outliers.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Area_Chart_Stepped_Nulls_Interpolated.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Area_Chart_Stepped_Nulls_Interpolated.png
index 76c4a4eba29..37fc398d63b 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Area_Chart_Stepped_Nulls_Interpolated.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Area_Chart_Stepped_Nulls_Interpolated.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Area_Chart_Stepped_Nulls_Skipped.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Area_Chart_Stepped_Nulls_Skipped.png
index d96bda93ed4..64b4117e5af 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Area_Chart_Stepped_Nulls_Skipped.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Area_Chart_Stepped_Nulls_Skipped.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Area_Fully_Null_Dimension_37902.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Area_Fully_Null_Dimension_37902.png
index b472b94a061..749172af1ae 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Area_Fully_Null_Dimension_37902.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Area_Fully_Null_Dimension_37902.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Area_Over_Bar.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Area_Over_Bar.png
index 2d6e4b2b409..f2820c6547e 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Area_Over_Bar.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Area_Over_Bar.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Area_Stack_All_Series_Without_Interpolation.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Area_Stack_All_Series_Without_Interpolation.png
index 0aba80ce74a..3a8d46bb93b 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Area_Stack_All_Series_Without_Interpolation.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Area_Stack_All_Series_Without_Interpolation.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Area_Stack_Interpolate_Missing_Values.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Area_Stack_Interpolate_Missing_Values.png
index 68ce266f1a8..775b5b95a98 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Area_Stack_Interpolate_Missing_Values.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Area_Stack_Interpolate_Missing_Values.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Area_Stack_Linear_X_Axis.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Area_Stack_Linear_X_Axis.png
index 8915494507f..fe6037f1fb8 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Area_Stack_Linear_X_Axis.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Area_Stack_Linear_X_Axis.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Area_Stacked_Auto_Data_Labels.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Area_Stacked_Auto_Data_Labels.png
index 313d4ddbbac..d1c0364aa5c 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Area_Stacked_Auto_Data_Labels.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Area_Stacked_Auto_Data_Labels.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_45_Degree_Labels.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_45_Degree_Labels.png
index 1b0b1dd3510..1ba2667049f 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_45_Degree_Labels.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_45_Degree_Labels.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Auto_Formatting_Compact.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Auto_Formatting_Compact.png
index d34b92a3778..e8e1837ae68 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Auto_Formatting_Compact.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Auto_Formatting_Compact.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Auto_Formatting_Full.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Auto_Formatting_Full.png
index e4a2b531b52..dc327ee7ef9 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Auto_Formatting_Full.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Auto_Formatting_Full.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Breakout_With_Line_Series_Stacked_Right_Axis_Only.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Breakout_With_Line_Series_Stacked_Right_Axis_Only.png
index 655af993868..22d2230bb63 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Breakout_With_Line_Series_Stacked_Right_Axis_Only.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Breakout_With_Line_Series_Stacked_Right_Axis_Only.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Correct_Width_When_Two_Y_Axes.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Correct_Width_When_Two_Y_Axes.png
index 919592f1a85..8305cad173e 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Correct_Width_When_Two_Y_Axes.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Correct_Width_When_Two_Y_Axes.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Data_Labels_Negatives.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Data_Labels_Negatives.png
index 70d04229e43..a6e7d457504 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Data_Labels_Negatives.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Data_Labels_Negatives.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Formatting_Full.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Formatting_Full.png
index 7ad6c827b28..21ae30ee17c 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Formatting_Full.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Formatting_Full.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Fully_Null_Dimension_37902.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Fully_Null_Dimension_37902.png
index 79dde95a28e..15369c76a59 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Fully_Null_Dimension_37902.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Fully_Null_Dimension_37902.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Histogram_Multi_Series.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Histogram_Multi_Series.png
index 8668f06d1e6..03502654282 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Histogram_Multi_Series.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Histogram_Multi_Series.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Histogram_Multi_Series_Binned.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Histogram_Multi_Series_Binned.png
index 0f972316d3e..976247770bd 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Histogram_Multi_Series_Binned.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Histogram_Multi_Series_Binned.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Histogram_Series_Breakout.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Histogram_Series_Breakout.png
index ee690b1826a..1b1403ecb0e 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Histogram_Series_Breakout.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Histogram_Series_Breakout.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Histogram_Stacked.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Histogram_Stacked.png
index 846862ebd44..3c109133ba0 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Histogram_Stacked.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Histogram_Stacked.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Histogram_Stacked_Normalized.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Histogram_Stacked_Normalized.png
index ee1bbc5e6a6..a71a36bb7de 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Histogram_Stacked_Normalized.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Histogram_Stacked_Normalized.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Histogram_Unaggregated_Dimension.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Histogram_Unaggregated_Dimension.png
index 0231b210964..95c68d0f6ab 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Histogram_Unaggregated_Dimension.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Histogram_Unaggregated_Dimension.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Histogram_X_Scale.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Histogram_X_Scale.png
index 286830d0dfa..f24ed7b2b58 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Histogram_X_Scale.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Histogram_X_Scale.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Linear_X_Scale.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Linear_X_Scale.png
index fc771663219..2ccac0a2134 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Linear_X_Scale.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Linear_X_Scale.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Log_Y_Scale_Stacked.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Log_Y_Scale_Stacked.png
index 5be4b56e629..cfd5134719b 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Log_Y_Scale_Stacked.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Log_Y_Scale_Stacked.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Log_Y_Scale_Stacked_Negative.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Log_Y_Scale_Stacked_Negative.png
index ab78c2d8a46..925985ad642 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Log_Y_Scale_Stacked_Negative.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Log_Y_Scale_Stacked_Negative.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Max_Categories_Default.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Max_Categories_Default.png
index 7dd31a499b0..d21f004184d 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Max_Categories_Default.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Max_Categories_Default.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Max_Categories_Stacked.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Max_Categories_Stacked.png
index b6643fc64d9..9c6731d1f40 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Max_Categories_Stacked.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Max_Categories_Stacked.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Max_Categories_Stacked_Normalized.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Max_Categories_Stacked_Normalized.png
index 69641b41170..761833c54ef 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Max_Categories_Stacked_Normalized.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Max_Categories_Stacked_Normalized.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Min_Height_Limit.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Min_Height_Limit.png
index 97cc84e2c38..5af2c7be1a4 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Min_Height_Limit.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Min_Height_Limit.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Non_Linear_Numeric_X_Axis.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Non_Linear_Numeric_X_Axis.png
index 2600c70162e..51f45565c6f 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Non_Linear_Numeric_X_Axis.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Non_Linear_Numeric_X_Axis.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Ordinal_X_Scale.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Ordinal_X_Scale.png
index 78c943194d9..fdaf3adcda6 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Ordinal_X_Scale.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Ordinal_X_Scale.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Ordinal_X_Scale_Auto_Rotated_Labels.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Ordinal_X_Scale_Auto_Rotated_Labels.png
index 22738b5e7b8..478f93d8a34 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Ordinal_X_Scale_Auto_Rotated_Labels.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Ordinal_X_Scale_Auto_Rotated_Labels.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Relative_Datetime_Ordinal_Scale.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Relative_Datetime_Ordinal_Scale.png
index c71f29cb5e2..34458d26738 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Relative_Datetime_Ordinal_Scale.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Relative_Datetime_Ordinal_Scale.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Split_Panels_Ordinal_Mixed_Ticks_Widths_Per_Panel.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Split_Panels_Ordinal_Mixed_Ticks_Widths_Per_Panel.png
index c0198aa8567..60d6d1f266a 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Split_Panels_Ordinal_Mixed_Ticks_Widths_Per_Panel.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Split_Panels_Ordinal_Mixed_Ticks_Widths_Per_Panel.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stack_Linear_X_Axis.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stack_Linear_X_Axis.png
index 891ec2ffd29..1b4533044d1 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stack_Linear_X_Axis.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stack_Linear_X_Axis.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_All_Labels_Timeseries_With_Gap_45717.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_All_Labels_Timeseries_With_Gap_45717.png
index 349149817c7..6edf38eeeab 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_All_Labels_Timeseries_With_Gap_45717.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_All_Labels_Timeseries_With_Gap_45717.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Labels_Null_Vs_Zero.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Labels_Null_Vs_Zero.png
index 0ba761674c8..20b0666528c 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Labels_Null_Vs_Zero.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Labels_Null_Vs_Zero.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Normalized_Custom_Min_Max_48021.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Normalized_Custom_Min_Max_48021.png
index 757dd771947..d7c0f5a39a2 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Normalized_Custom_Min_Max_48021.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Normalized_Custom_Min_Max_48021.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Normalized_Empty_Space_37880.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Normalized_Empty_Space_37880.png
index c8f7a3615f1..582f11ca963 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Normalized_Empty_Space_37880.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Normalized_Empty_Space_37880.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Normalized_Goal_Line_51054.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Normalized_Goal_Line_51054.png
index 9bf001323dc..9fc18b6baa1 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Normalized_Goal_Line_51054.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Normalized_Goal_Line_51054.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Normalized_Series_Labels.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Normalized_Series_Labels.png
index d9efb4e788c..2ef76bc027e 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Normalized_Series_Labels.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Normalized_Series_Labels.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Pow_Y_Axis.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Pow_Y_Axis.png
index d47b3aa1d3f..c956b9d07bd 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Pow_Y_Axis.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Pow_Y_Axis.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Pow_Y_Axis_Negatives.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Pow_Y_Axis_Negatives.png
index 414c6198b73..ca29942f5d7 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Pow_Y_Axis_Negatives.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Pow_Y_Axis_Negatives.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Series_Labels_And_Totals.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Series_Labels_And_Totals.png
index 1440644baac..eacdb618fa1 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Series_Labels_And_Totals.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Series_Labels_And_Totals.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Series_Labels_And_Totals_Ordinal.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Series_Labels_And_Totals_Ordinal.png
index 021bf0234bd..cde8aa62c44 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Series_Labels_And_Totals_Ordinal.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Series_Labels_And_Totals_Ordinal.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Series_Labels_Auto_Compactness.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Series_Labels_Auto_Compactness.png
index 03ca3b3d431..e3292a9dfa3 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Series_Labels_Auto_Compactness.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Series_Labels_Auto_Compactness.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Series_Labels_No_Totals.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Series_Labels_No_Totals.png
index ef026412da5..148630674c0 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Series_Labels_No_Totals.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Series_Labels_No_Totals.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Series_Labels_Normalized_Auto_Compactness.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Series_Labels_Normalized_Auto_Compactness.png
index cd22707d1b3..8c68ac70a3c 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Series_Labels_Normalized_Auto_Compactness.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Series_Labels_Normalized_Auto_Compactness.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Series_Labels_Rotated.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Series_Labels_Rotated.png
index 3eaa7a87e16..0f2b00814aa 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Series_Labels_Rotated.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Series_Labels_Rotated.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Total_Formatted_Values.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Total_Formatted_Values.png
index a3f83301dfc..fb38daf9e6a 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Total_Formatted_Values.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Stacked_Total_Formatted_Values.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Two_Axes_Stacked_With_Negative_Values.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Two_Axes_Stacked_With_Negative_Values.png
index e6f6b168353..ea238bafd17 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Two_Axes_Stacked_With_Negative_Values.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Two_Axes_Stacked_With_Negative_Values.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Two_Days_Of_Week.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Two_Days_Of_Week.png
index 882f8054e99..f392d1d0164 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Two_Days_Of_Week.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Two_Days_Of_Week.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Width_Dst_Timezones_56424.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Width_Dst_Timezones_56424.png
index c68af212f64..dd774d56048 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Width_Dst_Timezones_56424.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bar_Width_Dst_Timezones_56424.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bars_Breakout_Sorted_With_Negative_Values_Power_Y_Axis.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bars_Breakout_Sorted_With_Negative_Values_Power_Y_Axis.png
index 7645e1f3fa3..405d59adac7 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bars_Breakout_Sorted_With_Negative_Values_Power_Y_Axis.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Bars_Breakout_Sorted_With_Negative_Values_Power_Y_Axis.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Breakout_Null_And_Empty_String.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Breakout_Null_And_Empty_String.png
index f2f7082b866..3f5ed020806 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Breakout_Null_And_Empty_String.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Breakout_Null_And_Empty_String.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Combined_Bar_Time_Series_Different_Granularity_With_Breakout.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Combined_Bar_Time_Series_Different_Granularity_With_Breakout.png
index 39dabe658a8..4a45f690d1b 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Combined_Bar_Time_Series_Different_Granularity_With_Breakout.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Combined_Bar_Time_Series_Different_Granularity_With_Breakout.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Combined_With_Invalid_Settings.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Combined_With_Invalid_Settings.png
index 32b20b3fba0..812740804bc 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Combined_With_Invalid_Settings.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Combined_With_Invalid_Settings.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Combo_Data_Labels_Auto_Compactness_Propagates_From_Line.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Combo_Data_Labels_Auto_Compactness_Propagates_From_Line.png
index 0fffb73ecba..fd3a0c43d9b 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Combo_Data_Labels_Auto_Compactness_Propagates_From_Line.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Combo_Data_Labels_Auto_Compactness_Propagates_From_Line.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Combo_Data_Labels_Auto_Compactness_Propagates_From_Totals.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Combo_Data_Labels_Auto_Compactness_Propagates_From_Totals.png
index 0458af8799f..ad25847ca22 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Combo_Data_Labels_Auto_Compactness_Propagates_From_Totals.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Combo_Data_Labels_Auto_Compactness_Propagates_From_Totals.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Combo_Histogram.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Combo_Histogram.png
index e24e6ee3dc1..14194715092 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Combo_Histogram.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Combo_Histogram.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Combo_Split_Panels_Mixed_Series_Display_Settings.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Combo_Split_Panels_Mixed_Series_Display_Settings.png
index 38dbba951dd..0664235fe1f 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Combo_Split_Panels_Mixed_Series_Display_Settings.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Combo_Split_Panels_Mixed_Series_Display_Settings.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Combo_Stacked_Bars_Areas.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Combo_Stacked_Bars_Areas.png
index 8df66b2f666..349a6ddd0a2 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Combo_Stacked_Bars_Areas.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Combo_Stacked_Bars_Areas.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Combo_Stacked_Bars_Areas_Normalized.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Combo_Stacked_Bars_Areas_Normalized.png
index 5f0b44eae2c..6c9890c9458 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Combo_Stacked_Bars_Areas_Normalized.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Combo_Stacked_Bars_Areas_Normalized.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Compact_X_Axis_Does_Not_Work_38917.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Compact_X_Axis_Does_Not_Work_38917.png
index 0ce29e6acd4..ce22b161d8c 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Compact_X_Axis_Does_Not_Work_38917.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Compact_X_Axis_Does_Not_Work_38917.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Custom_Y_Axis_Range_With_Column_Scaling.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Custom_Y_Axis_Range_With_Column_Scaling.png
index b5356e54099..8a2353c87c5 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Custom_Y_Axis_Range_With_Column_Scaling.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Custom_Y_Axis_Range_With_Column_Scaling.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Data_Labels_Under_Trend_Goal_Lines_41280.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Data_Labels_Under_Trend_Goal_Lines_41280.png
index 6c6b21b49ed..6c06ab0f570 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Data_Labels_Under_Trend_Goal_Lines_41280.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Data_Labels_Under_Trend_Goal_Lines_41280.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Default.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Default.png
index 9fe5eae6c2c..3dbc9c9f877 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Default.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Default.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Goal_Between_Extent_And_Chart_Bound.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Goal_Between_Extent_And_Chart_Bound.png
index 43ef82803e0..4999d609a5f 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Goal_Between_Extent_And_Chart_Bound.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Goal_Between_Extent_And_Chart_Bound.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Goal_Line_Disabled.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Goal_Line_Disabled.png
index e4030cca966..e52972d3b59 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Goal_Line_Disabled.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Goal_Line_Disabled.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Goal_Line_Log_Y_Scale.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Goal_Line_Log_Y_Scale.png
index 07a1ed90e56..190f0d5495f 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Goal_Line_Log_Y_Scale.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Goal_Line_Log_Y_Scale.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Goal_Line_Out_Of_Bounds_37848.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Goal_Line_Out_Of_Bounds_37848.png
index ed607c794b7..75a64ce1a00 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Goal_Line_Out_Of_Bounds_37848.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Goal_Line_Out_Of_Bounds_37848.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Goal_Line_Pow_Y_Scale.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Goal_Line_Pow_Y_Scale.png
index e77bd4c15b0..c782f91c3ec 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Goal_Line_Pow_Y_Scale.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Goal_Line_Pow_Y_Scale.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Goal_Line_Under_Series_38824.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Goal_Line_Under_Series_38824.png
index b4a821aa170..15683bd3ca9 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Goal_Line_Under_Series_38824.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Goal_Line_Under_Series_38824.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Goal_Very_Small.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Goal_Very_Small.png
index 746235812b5..e54d20c2c07 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Goal_Very_Small.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Goal_Very_Small.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Histogram_Ticks_45_Degrees.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Histogram_Ticks_45_Degrees.png
index 4d7d7f5cf03..91cd1d2d283 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Histogram_Ticks_45_Degrees.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Histogram_Ticks_45_Degrees.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Histogram_Ticks_90_Degrees.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Histogram_Ticks_90_Degrees.png
index e90f818270f..ae89bf93342 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Histogram_Ticks_90_Degrees.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Histogram_Ticks_90_Degrees.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Image_Cut_Off_37275.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Image_Cut_Off_37275.png
index b91c273af7b..c14748c42ac 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Image_Cut_Off_37275.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Image_Cut_Off_37275.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Incorrect_Label_Y_Axis_Split_41285.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Incorrect_Label_Y_Axis_Split_41285.png
index 40dd6bcd271..2e1fe90a738 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Incorrect_Label_Y_Axis_Split_41285.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Incorrect_Label_Y_Axis_Split_41285.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Chart_Broken_Dimensions_Metrics_Settings.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Chart_Broken_Dimensions_Metrics_Settings.png
index bdfe5ddd46a..bffd6cab51a 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Chart_Broken_Dimensions_Metrics_Settings.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Chart_Broken_Dimensions_Metrics_Settings.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Chart_Split_Panels_Timeseries_Different_Ranges.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Chart_Split_Panels_Timeseries_Different_Ranges.png
index 1865ffb9942..6db24b704a8 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Chart_Split_Panels_Timeseries_Different_Ranges.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Chart_Split_Panels_Timeseries_Different_Ranges.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Custom_Y_Axis_Range_Equals_Extents.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Custom_Y_Axis_Range_Equals_Extents.png
index b2fb254ba24..c2a6fd69050 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Custom_Y_Axis_Range_Equals_Extents.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Custom_Y_Axis_Range_Equals_Extents.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Custom_Y_Axis_Range_Off_Screen_High.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Custom_Y_Axis_Range_Off_Screen_High.png
index c34aae56373..ef68f86586c 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Custom_Y_Axis_Range_Off_Screen_High.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Custom_Y_Axis_Range_Off_Screen_High.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Custom_Y_Axis_Range_Off_Screen_Low.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Custom_Y_Axis_Range_Off_Screen_Low.png
index ff8e8869a1f..41adc236d39 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Custom_Y_Axis_Range_Off_Screen_Low.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Custom_Y_Axis_Range_Off_Screen_Low.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Fully_Null_Dimension_37902.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Fully_Null_Dimension_37902.png
index b472b94a061..749172af1ae 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Fully_Null_Dimension_37902.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Fully_Null_Dimension_37902.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Linear_X_Scale.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Linear_X_Scale.png
index 82ab5fc12eb..587e170afc2 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Linear_X_Scale.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Linear_X_Scale.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Linear_X_Scale_Unsorted.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Linear_X_Scale_Unsorted.png
index 7befce193fc..1ba976d0615 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Linear_X_Scale_Unsorted.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Linear_X_Scale_Unsorted.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Log_Y_Scale.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Log_Y_Scale.png
index d0dba4bf748..1c209d1bfcd 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Log_Y_Scale.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Log_Y_Scale.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Log_Y_Scale_Negative.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Log_Y_Scale_Negative.png
index b1605c5b996..d3e049b99df 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Log_Y_Scale_Negative.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Log_Y_Scale_Negative.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Replace_Missing_Values_Zero.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Replace_Missing_Values_Zero.png
index c4f62ab3037..c9b696ff5f4 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Replace_Missing_Values_Zero.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Replace_Missing_Values_Zero.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Settings.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Settings.png
index 9b15653bccd..89f823bf67a 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Settings.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Settings.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Show_Dots_Auto.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Show_Dots_Auto.png
index e4030cca966..e52972d3b59 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Show_Dots_Auto.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Show_Dots_Auto.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Show_Dots_Off.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Show_Dots_Off.png
index e4030cca966..e52972d3b59 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Show_Dots_Off.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Show_Dots_Off.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Show_Dots_On.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Show_Dots_On.png
index 3f34d51995f..a244a528068 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Show_Dots_On.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Show_Dots_On.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Unpin_From_Zero.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Unpin_From_Zero.png
index 09578adf0cf..b18c0fd7db9 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Unpin_From_Zero.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Line_Unpin_From_Zero.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Log_Y_Scale_Custom_Y_Axis_Range.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Log_Y_Scale_Custom_Y_Axis_Range.png
index 40c4e0a9a4e..a039441b227 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Log_Y_Scale_Custom_Y_Axis_Range.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Log_Y_Scale_Custom_Y_Axis_Range.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Long_Dimension_Name_Cut_Off_37420.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Long_Dimension_Name_Cut_Off_37420.png
index 077a7ff29c7..47359304fa6 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Long_Dimension_Name_Cut_Off_37420.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Long_Dimension_Name_Cut_Off_37420.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Native_Auto_Y_Split.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Native_Auto_Y_Split.png
index f659c08db39..16fa9d947f7 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Native_Auto_Y_Split.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Native_Auto_Y_Split.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_No_Good_Axis_Split.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_No_Good_Axis_Split.png
index d77d7ce1474..3faa4490516 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_No_Good_Axis_Split.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_No_Good_Axis_Split.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Null_Category_Value_Formatting.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Null_Category_Value_Formatting.png
index 8f55a52eb19..b6c155ca468 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Null_Category_Value_Formatting.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Null_Category_Value_Formatting.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Number_Of_Insights_Error_39608.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Number_Of_Insights_Error_39608.png
index 175f89b61ca..8173defd3e3 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Number_Of_Insights_Error_39608.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Number_Of_Insights_Error_39608.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Numeric_X_Axis_Includes_Zero_37082.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Numeric_X_Axis_Includes_Zero_37082.png
index 81948e022d2..ab9d3343b51 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Numeric_X_Axis_Includes_Zero_37082.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Numeric_X_Axis_Includes_Zero_37082.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Offset_Based_Timezone_47835.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Offset_Based_Timezone_47835.png
index 2d534b9304a..5db0a23dfe9 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Offset_Based_Timezone_47835.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Offset_Based_Timezone_47835.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Pow_Y_Scale_Custom_Y_Axis_Range.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Pow_Y_Scale_Custom_Y_Axis_Range.png
index 5e6c15aae6b..f9fc7ee6e9b 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Pow_Y_Scale_Custom_Y_Axis_Range.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Pow_Y_Scale_Custom_Y_Axis_Range.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Safari_Non_Iana_Timezone_Repro_44128.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Safari_Non_Iana_Timezone_Repro_44128.png
index ac7584660cd..8deeb5d604f 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Safari_Non_Iana_Timezone_Repro_44128.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Safari_Non_Iana_Timezone_Repro_44128.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Series_Order_Settings_Do_Not_Match_Series_Count.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Series_Order_Settings_Do_Not_Match_Series_Count.png
index 34a150693e6..608eac12f21 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Series_Order_Settings_Do_Not_Match_Series_Count.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Series_Order_Settings_Do_Not_Match_Series_Count.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Split_Y_Axis.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Split_Y_Axis.png
index fe7faddff0d..c1bf3e146c2 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Split_Y_Axis.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Split_Y_Axis.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Stacked_Chart_Custom_Y_Axis_Range.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Stacked_Chart_Custom_Y_Axis_Range.png
index d37210c857c..ea09e5a16ea 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Stacked_Chart_Custom_Y_Axis_Range.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Stacked_Chart_Custom_Y_Axis_Range.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Stacked_Normalized_Custom_Y_Axis_Range.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Stacked_Normalized_Custom_Y_Axis_Range.png
index 930fe44dadb..0a72ce5865c 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Stacked_Normalized_Custom_Y_Axis_Range.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Stacked_Normalized_Custom_Y_Axis_Range.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Symlog_Decimals.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Symlog_Decimals.png
index 316481f8712..7707a8f889b 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Symlog_Decimals.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Symlog_Decimals.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Ticks_Native_Week_With_Gap_Long_Range.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Ticks_Native_Week_With_Gap_Long_Range.png
index b8f3231c8b1..68b687d94f3 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Ticks_Native_Week_With_Gap_Long_Range.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Ticks_Native_Week_With_Gap_Long_Range.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Ticks_Native_Week_With_Gap_Short_Range.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Ticks_Native_Week_With_Gap_Short_Range.png
index d27f005534c..5eda1284ebc 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Ticks_Native_Week_With_Gap_Short_Range.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Ticks_Native_Week_With_Gap_Short_Range.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Time_Series_Ticks_Compact_Formatting_Mixed_Timezones.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Time_Series_Ticks_Compact_Formatting_Mixed_Timezones.png
index bbbff6ffdde..a0560de85ac 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Time_Series_Ticks_Compact_Formatting_Mixed_Timezones.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Time_Series_Ticks_Compact_Formatting_Mixed_Timezones.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Time_Series_Yyyymmdd_Numbers_Format.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Time_Series_Yyyymmdd_Numbers_Format.png
index 93ecf85cf20..67bb9f80b70 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Time_Series_Yyyymmdd_Numbers_Format.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Time_Series_Yyyymmdd_Numbers_Format.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Timezone_Ticks_Placement.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Timezone_Ticks_Placement.png
index 30892d472b8..b5780eb40e5 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Timezone_Ticks_Placement.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Timezone_Ticks_Placement.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Combo.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Combo.png
index c3e187762e3..8750e5e86b2 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Combo.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Combo.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Combo_Log.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Combo_Log.png
index 8ea52e67a88..ddbf725fd9f 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Combo_Log.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Combo_Log.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Combo_Power.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Combo_Power.png
index 6c785581ea2..7a03e6c2695 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Combo_Power.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Combo_Power.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Goal_Lines_With_Scaling_Pow_Scale_Custom_Range.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Goal_Lines_With_Scaling_Pow_Scale_Custom_Range.png
index d2731cbdfea..c8290a3456b 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Goal_Lines_With_Scaling_Pow_Scale_Custom_Range.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Goal_Lines_With_Scaling_Pow_Scale_Custom_Range.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Multi_Series_Area.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Multi_Series_Area.png
index 4904253ce55..4015c1528aa 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Multi_Series_Area.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Multi_Series_Area.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Multi_Series_Bar.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Multi_Series_Bar.png
index a666fb0106e..4789a8147a4 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Multi_Series_Bar.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Multi_Series_Bar.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Multi_Series_Line.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Multi_Series_Line.png
index b534eefa3d6..f2918588ba8 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Multi_Series_Line.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Multi_Series_Line.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Multi_Series_Normalized_Stacked_Area.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Multi_Series_Normalized_Stacked_Area.png
index 4881541b558..d02c65fbcd2 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Multi_Series_Normalized_Stacked_Area.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Multi_Series_Normalized_Stacked_Area.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Multi_Series_Normalized_Stacked_Bar.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Multi_Series_Normalized_Stacked_Bar.png
index 3531e30b7ed..1e7d979b51a 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Multi_Series_Normalized_Stacked_Bar.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Multi_Series_Normalized_Stacked_Bar.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Multi_Series_Stacked_Area.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Multi_Series_Stacked_Area.png
index 1c2ce5ecaaa..a620f7834ea 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Multi_Series_Stacked_Area.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Multi_Series_Stacked_Area.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Multi_Series_Stacked_Bar.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Multi_Series_Stacked_Bar.png
index f10f264bb09..a356feb51dc 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Multi_Series_Stacked_Bar.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Multi_Series_Stacked_Bar.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Single_Series_Area.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Single_Series_Area.png
index a37dfe1c4ac..e3d075c2569 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Single_Series_Area.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Single_Series_Area.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Single_Series_Bar.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Single_Series_Bar.png
index 5d6e9343009..c11bb0a46df 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Single_Series_Bar.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Single_Series_Bar.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Single_Series_Line.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Single_Series_Line.png
index b12be29eda2..ff15f021e4f 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Single_Series_Line.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Trend_Single_Series_Line.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Two_Bars_Two_Areas_One_Line_Linear.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Two_Bars_Two_Areas_One_Line_Linear.png
index 88eb2a1e200..37dc62cdcc6 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Two_Bars_Two_Areas_One_Line_Linear.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Two_Bars_Two_Areas_One_Line_Linear.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Two_Bars_Two_Areas_One_Line_Log.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Two_Bars_Two_Areas_One_Line_Log.png
index 1827aae5cb9..6223ec0e811 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Two_Bars_Two_Areas_One_Line_Log.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Two_Bars_Two_Areas_One_Line_Log.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Two_Bars_Two_Areas_One_Line_Power.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Two_Bars_Two_Areas_One_Line_Power.png
index bfcf34a8e9a..dee72924954 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Two_Bars_Two_Areas_One_Line_Power.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Two_Bars_Two_Areas_One_Line_Power.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Two_Time_Series_Bars_Should_Not_Overlap.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Two_Time_Series_Bars_Should_Not_Overlap.png
index e9705ebb856..8d8e4246528 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Two_Time_Series_Bars_Should_Not_Overlap.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Two_Time_Series_Bars_Should_Not_Overlap.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Visualizer_Timeseries_Different_Units.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Visualizer_Timeseries_Different_Units.png
index 46c5e953708..fb08b23468c 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Visualizer_Timeseries_Different_Units.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Visualizer_Timeseries_Different_Units.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Watermark.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Watermark.png
index 5cacead37e8..05cd51e1751 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Watermark.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Watermark.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Wrong_Y_Axis_Range_37306.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Wrong_Y_Axis_Range_37306.png
index d45794337e1..f837bef36c4 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Wrong_Y_Axis_Range_37306.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Wrong_Y_Axis_Range_37306.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Y_Axis_Compact_Without_Data_Labels.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Y_Axis_Compact_Without_Data_Labels.png
index 09e73fd85a2..1ebc75934d8 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Y_Axis_Compact_Without_Data_Labels.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ComboChart_Y_Axis_Compact_Without_Data_Labels.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_FunnelBarChart_Default.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_FunnelBarChart_Default.png
index 49893de9d62..3ad9a2ef2f3 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_FunnelBarChart_Default.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_FunnelBarChart_Default.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_FunnelBarChart_Funnel_Bar_Ordered_Rows.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_FunnelBarChart_Funnel_Bar_Ordered_Rows.png
index fcae735a375..c27a9546337 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_FunnelBarChart_Funnel_Bar_Ordered_Rows.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_FunnelBarChart_Funnel_Bar_Ordered_Rows.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_FunnelBarChart_Funnel_Bar_Unordered_Rows.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_FunnelBarChart_Funnel_Bar_Unordered_Rows.png
index 1465f68a8a2..98b96b65184 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_FunnelBarChart_Funnel_Bar_Unordered_Rows.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_FunnelBarChart_Funnel_Bar_Unordered_Rows.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_All_Negative.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_All_Negative.png
index f9ed99a3cab..a207d085037 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_All_Negative.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_All_Negative.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_All_Negative_With_Other.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_All_Negative_With_Other.png
index 0ad2c909bc5..8b8788d7cc9 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_All_Negative_With_Other.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_All_Negative_With_Other.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_All_Settings.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_All_Settings.png
index 301a9ebbe89..39f514f98a4 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_All_Settings.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_All_Settings.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Auto_Compact_Total.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Auto_Compact_Total.png
index fb91453e324..a07058a236f 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Auto_Compact_Total.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Auto_Compact_Total.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Binned_Dimension.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Binned_Dimension.png
index c0e27ea9032..03b351a8061 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Binned_Dimension.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Binned_Dimension.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Boolean_Dimension.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Boolean_Dimension.png
index 4f3f1331edc..ef8995e64f3 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Boolean_Dimension.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Boolean_Dimension.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Colors.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Colors.png
index 3d63d8ded81..a5965be1ae5 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Colors.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Colors.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Column_Formatting.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Column_Formatting.png
index 6ba16057801..e5f8f038af7 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Column_Formatting.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Column_Formatting.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Column_Formatting_Percentages_On_Chart.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Column_Formatting_Percentages_On_Chart.png
index 101af6122af..d4cbc93930d 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Column_Formatting_Percentages_On_Chart.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Column_Formatting_Percentages_On_Chart.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Date_Dimension.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Date_Dimension.png
index c4b24da7caa..cc96906b9c5 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Date_Dimension.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Date_Dimension.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Default_Settings.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Default_Settings.png
index 6e7b110fbf0..5611c1b4d4d 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Default_Settings.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Default_Settings.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Hide_Legend.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Hide_Legend.png
index 958c3f3d4ca..893172f3676 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Hide_Legend.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Hide_Legend.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Hide_Total.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Hide_Total.png
index bab4adfc798..460d3a7ccc7 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Hide_Total.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Hide_Total.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Invalid_Dimension_Setting_44085.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Invalid_Dimension_Setting_44085.png
index d6f1a2ff07f..58b2a25c4c1 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Invalid_Dimension_Setting_44085.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Invalid_Dimension_Setting_44085.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Labels_On_Chart.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Labels_On_Chart.png
index 4c23aba9c38..00db7068183 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Labels_On_Chart.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Labels_On_Chart.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Labels_With_Percent.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Labels_With_Percent.png
index ea8ba6dcaf7..ed80e19f1a3 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Labels_With_Percent.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Labels_With_Percent.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Large_Minimum_Slice_Percentage.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Large_Minimum_Slice_Percentage.png
index 78637e1b96d..2c6d4d1a03d 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Large_Minimum_Slice_Percentage.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Large_Minimum_Slice_Percentage.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Long_Dimension_Name.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Long_Dimension_Name.png
index c33cc512967..661ec94e021 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Long_Dimension_Name.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Long_Dimension_Name.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Missing_Colors_44087.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Missing_Colors_44087.png
index 3f2afcea0bd..34785e1dcfd 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Missing_Colors_44087.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Missing_Colors_44087.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Missing_Currency_Formatting_2.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Missing_Currency_Formatting_2.png
index 0ceaba9e14b..014203ab982 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Missing_Currency_Formatting_2.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Missing_Currency_Formatting_2.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Missing_Currency_Formatting_3.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Missing_Currency_Formatting_3.png
index ab55611a49c..fd6bafae8d5 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Missing_Currency_Formatting_3.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Missing_Currency_Formatting_3.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Missing_Currency_Formatting_44086.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Missing_Currency_Formatting_44086.png
index 4595b926ff9..56dfe300ffa 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Missing_Currency_Formatting_44086.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Missing_Currency_Formatting_44086.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Missing_Label_Large_Slice_38424.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Missing_Label_Large_Slice_38424.png
index cd8a6716009..fa0716450fa 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Missing_Label_Large_Slice_38424.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Missing_Label_Large_Slice_38424.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Mixed_Positive_Negative.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Mixed_Positive_Negative.png
index 4e37c26d9d7..a069f1c95fa 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Mixed_Positive_Negative.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Mixed_Positive_Negative.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_No_Single_Column_Legend_45149.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_No_Single_Column_Legend_45149.png
index 4145db753d4..9d2709882ac 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_No_Single_Column_Legend_45149.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_No_Single_Column_Legend_45149.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Null_Dimension.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Null_Dimension.png
index 113f1746b26..6b840cd2211 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Null_Dimension.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Null_Dimension.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Num_Decimal_Places_Chart.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Num_Decimal_Places_Chart.png
index f6bc8446e3f..304fdd6f478 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Num_Decimal_Places_Chart.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Num_Decimal_Places_Chart.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Num_Decimal_Places_Legend.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Num_Decimal_Places_Legend.png
index 038b7e44d69..ec4561a55e4 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Num_Decimal_Places_Legend.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Num_Decimal_Places_Legend.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Numeric_Dimension.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Numeric_Dimension.png
index b426498962c..0f6cd87e69f 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Numeric_Dimension.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Numeric_Dimension.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Numeric_SQL_Column_Crashes_28568.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Numeric_SQL_Column_Crashes_28568.png
index 65b035802c8..f2bb209ecab 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Numeric_SQL_Column_Crashes_28568.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Numeric_SQL_Column_Crashes_28568.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Percentages_On_Chart_Boolean_Dimension_Crashes_44085.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Percentages_On_Chart_Boolean_Dimension_Crashes_44085.png
index 87a3d7d280a..841585a7ec7 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Percentages_On_Chart_Boolean_Dimension_Crashes_44085.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Percentages_On_Chart_Boolean_Dimension_Crashes_44085.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Relative_Date_Dimension.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Relative_Date_Dimension.png
index 5d5170643af..6c9e4207044 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Relative_Date_Dimension.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Relative_Date_Dimension.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Reordered_Renamed_Slices.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Reordered_Renamed_Slices.png
index c45d76bf691..48d7cd5fa0b 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Reordered_Renamed_Slices.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Reordered_Renamed_Slices.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Show_Percentages_Both.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Show_Percentages_Both.png
index 9a840656ea2..d82b40afb0f 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Show_Percentages_Both.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Show_Percentages_Both.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Show_Percentages_Off.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Show_Percentages_Off.png
index 86a4893bc23..fdf202f6fee 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Show_Percentages_Off.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Show_Percentages_Off.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Show_Percentages_On_Chart.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Show_Percentages_On_Chart.png
index d0506debc02..a75fb1697b8 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Show_Percentages_On_Chart.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Show_Percentages_On_Chart.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Show_Percentages_On_Chart_Dense.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Show_Percentages_On_Chart_Dense.png
index ec0839421a1..53ce12b470c 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Show_Percentages_On_Chart_Dense.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Show_Percentages_On_Chart_Dense.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Single_Dimension.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Single_Dimension.png
index d734e58ad0a..5bdb6191ce5 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Single_Dimension.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Single_Dimension.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Small_Minimum_Slice_Percentage.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Small_Minimum_Slice_Percentage.png
index 71b4ffb1a13..3982be39dc8 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Small_Minimum_Slice_Percentage.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Small_Minimum_Slice_Percentage.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Sunburst_Other_Label.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Sunburst_Other_Label.png
index 2eca7355f11..696913fb963 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Sunburst_Other_Label.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Sunburst_Other_Label.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Three_Rings.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Three_Rings.png
index 8bcfd27b106..31dfc485c65 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Three_Rings.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Three_Rings.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Three_Rings_No_Labels.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Three_Rings_No_Labels.png
index 0c477bf7851..e19e9ea213d 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Three_Rings_No_Labels.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Three_Rings_No_Labels.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Three_Rings_Other_Slices.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Three_Rings_Other_Slices.png
index 38c792fbadb..6aaa35134db 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Three_Rings_Other_Slices.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Three_Rings_Other_Slices.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Three_Rings_Percentages_And_Labels.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Three_Rings_Percentages_And_Labels.png
index 62a45d45615..affe86e2a1e 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Three_Rings_Percentages_And_Labels.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Three_Rings_Percentages_And_Labels.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Three_Rings_Percentages_On_Chart.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Three_Rings_Percentages_On_Chart.png
index 022c5262d86..ea7e1a6d979 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Three_Rings_Percentages_On_Chart.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Three_Rings_Percentages_On_Chart.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Tiny_Slices_Disappear_43766.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Tiny_Slices_Disappear_43766.png
index e3f81fe752b..9c72e414e9b 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Tiny_Slices_Disappear_43766.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Tiny_Slices_Disappear_43766.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Truncated_Total.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Truncated_Total.png
index ecd419830d1..a314b91f6e9 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Truncated_Total.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Truncated_Total.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Two_Rings.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Two_Rings.png
index d6324f3be3e..d13744934e5 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Two_Rings.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Two_Rings.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Unaggregated_Dimension.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Unaggregated_Dimension.png
index c9c23c4aa51..ed88f66ed37 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Unaggregated_Dimension.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Unaggregated_Dimension.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Watermark.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Watermark.png
index ae06e6bdc30..2195925718a 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Watermark.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Watermark.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Zero_Minimum_Slice_Percentage.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Zero_Minimum_Slice_Percentage.png
index 39b20e21af2..a3a88c8957c 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Zero_Minimum_Slice_Percentage.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_PieChart_Zero_Minimum_Slice_Percentage.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_RowChart_Default.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_RowChart_Default.png
index 0ec3c4889d5..85190fbfaad 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_RowChart_Default.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_RowChart_Default.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_RowChart_Metric_Column_With_Scaling.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_RowChart_Metric_Column_With_Scaling.png
index ae138781d36..bab1afe3686 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_RowChart_Metric_Column_With_Scaling.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_RowChart_Metric_Column_With_Scaling.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_RowChart_Watermark.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_RowChart_Watermark.png
index 82f383f5daa..4c494ea41fa 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_RowChart_Watermark.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_RowChart_Watermark.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScalarChart_Default.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScalarChart_Default.png
index 151b519aafb..e1eb543d8a8 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScalarChart_Default.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScalarChart_Default.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Auto_Y_Axis_Exclude_Zero_With_Goal.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Auto_Y_Axis_Exclude_Zero_With_Goal.png
index ffa3a65698e..102a9814e2c 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Auto_Y_Axis_Exclude_Zero_With_Goal.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Auto_Y_Axis_Exclude_Zero_With_Goal.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Bubble_Size.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Bubble_Size.png
index 2a2deca7606..e2a8ed53eba 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Bubble_Size.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Bubble_Size.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Custom_Y_Axis_Range.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Custom_Y_Axis_Range.png
index 0179d7cf3e3..cb5054a99f2 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Custom_Y_Axis_Range.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Custom_Y_Axis_Range.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Custom_Y_Axis_Range_Off_Screen.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Custom_Y_Axis_Range_Off_Screen.png
index d038625ebff..201d58b41b7 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Custom_Y_Axis_Range_Off_Screen.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Custom_Y_Axis_Range_Off_Screen.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Custom_Y_Axis_Range_With_Column_Scaling.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Custom_Y_Axis_Range_With_Column_Scaling.png
index 61d8002d953..62748caa249 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Custom_Y_Axis_Range_With_Column_Scaling.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Custom_Y_Axis_Range_With_Column_Scaling.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Default.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Default.png
index 1e3c7960d64..8ccbd4ec9df 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Default.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Default.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Goal_Line.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Goal_Line.png
index b7d1751e269..60ef1e4c5cc 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Goal_Line.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Goal_Line.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Histogram_X_Scale.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Histogram_X_Scale.png
index c9039ada4de..69494d78610 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Histogram_X_Scale.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Histogram_X_Scale.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Log_X_Scale.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Log_X_Scale.png
index 01d8198ffeb..c5bc77bc1b0 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Log_X_Scale.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Log_X_Scale.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Log_X_Scale_At_One.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Log_X_Scale_At_One.png
index befe7e25932..b5727b1e27a 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Log_X_Scale_At_One.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Log_X_Scale_At_One.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Multi_Dimension_Breakout.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Multi_Dimension_Breakout.png
index 88f091116b3..eba3f0faa5e 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Multi_Dimension_Breakout.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Multi_Dimension_Breakout.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Multi_Dimension_Breakout_Bubble_Size.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Multi_Dimension_Breakout_Bubble_Size.png
index 4882103f4be..691e32894b0 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Multi_Dimension_Breakout_Bubble_Size.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Multi_Dimension_Breakout_Bubble_Size.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Multi_Metric_Series.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Multi_Metric_Series.png
index 0e499776c06..fa810924a5f 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Multi_Metric_Series.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Multi_Metric_Series.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Ordinal_X_Scale.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Ordinal_X_Scale.png
index 8818abcd1ff..ebf4bfd2768 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Ordinal_X_Scale.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Ordinal_X_Scale.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Pin_To_Zero.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Pin_To_Zero.png
index 15d4fd75e5c..06c27181ab3 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Pin_To_Zero.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Pin_To_Zero.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Power_X_Scale.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Power_X_Scale.png
index e2ecbe41275..d646f7f5516 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Power_X_Scale.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Power_X_Scale.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Power_X_Scale_Multi_Series.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Power_X_Scale_Multi_Series.png
index 5c2a1dc5a29..4290f06a9fd 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Power_X_Scale_Multi_Series.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Power_X_Scale_Multi_Series.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Timeseries_X_Scale.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Timeseries_X_Scale.png
index 41d797d5e2c..d453e51b1a8 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Timeseries_X_Scale.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Timeseries_X_Scale.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Watermark.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Watermark.png
index 48359c8db38..627fbfde6e5 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Watermark.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Watermark.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Custom_Colors.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Custom_Colors.png
index 1e77b66ea2f..f8e1492e091 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Custom_Colors.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Custom_Colors.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Custom_Y_Axis_Range_Off_Screen.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Custom_Y_Axis_Range_Off_Screen.png
index b9cf0b77499..eda3dba04e1 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Custom_Y_Axis_Range_Off_Screen.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Custom_Y_Axis_Range_Off_Screen.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Custom_Y_Axis_Range_With_Column_Scaling.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Custom_Y_Axis_Range_With_Column_Scaling.png
index 1befd95d499..66b2c27a4f1 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Custom_Y_Axis_Range_With_Column_Scaling.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Custom_Y_Axis_Range_With_Column_Scaling.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Data_Labels.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Data_Labels.png
index f32c4ced957..74dc1120555 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Data_Labels.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Data_Labels.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Data_Labels_Column_Formatting.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Data_Labels_Column_Formatting.png
index 210034fce0b..6170201a3f6 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Data_Labels_Column_Formatting.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Data_Labels_Column_Formatting.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Data_Labels_Mixed.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Data_Labels_Mixed.png
index 68957e0e8e9..813baf0db3b 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Data_Labels_Mixed.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Data_Labels_Mixed.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Data_Labels_Timeseries.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Data_Labels_Timeseries.png
index 9cdb2195acf..da210d981fa 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Data_Labels_Timeseries.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Data_Labels_Timeseries.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Enourmous_Dataset.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Enourmous_Dataset.png
index 0203983f1be..a901cc29752 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Enourmous_Dataset.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Enourmous_Dataset.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Linear_Null_Dimension.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Linear_Null_Dimension.png
index 1a89b204f93..9c77f5e84ba 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Linear_Null_Dimension.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Linear_Null_Dimension.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Log_Y_Scale.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Log_Y_Scale.png
index 89847da13ef..3c245d29796 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Log_Y_Scale.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Log_Y_Scale.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Log_Y_Scale_Negative.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Log_Y_Scale_Negative.png
index e4b538a7cd0..545faaf7f0f 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Log_Y_Scale_Negative.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Log_Y_Scale_Negative.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Mixed_Above_Zero.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Mixed_Above_Zero.png
index 4ee101074e7..9dece4ed6bc 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Mixed_Above_Zero.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Mixed_Above_Zero.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Mixed_Below_Zero.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Mixed_Below_Zero.png
index 722d54d5707..ad09b885d5f 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Mixed_Below_Zero.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Mixed_Below_Zero.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Native_Time_Series_Quarter.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Native_Time_Series_Quarter.png
index da2bd5f3167..680b7233bbb 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Native_Time_Series_Quarter.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Native_Time_Series_Quarter.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Native_Time_Series_With_Gaps.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Native_Time_Series_With_Gaps.png
index 5943180d726..92f2dae28df 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Native_Time_Series_With_Gaps.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Native_Time_Series_With_Gaps.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Negative_Only.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Negative_Only.png
index 8d11137afa7..3bee6416b10 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Negative_Only.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Negative_Only.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_No_Total_Ordinal.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_No_Total_Ordinal.png
index 5b83aeb0834..cdd4f72253a 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_No_Total_Ordinal.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_No_Total_Ordinal.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_No_Total_Timeseries.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_No_Total_Timeseries.png
index 8ea2e613045..ea5c7b99d16 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_No_Total_Timeseries.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_No_Total_Timeseries.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Null_X_Axis_Value.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Null_X_Axis_Value.png
index 86be65453c7..c41f28916e9 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Null_X_Axis_Value.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Null_X_Axis_Value.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Nulls.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Nulls.png
index c99f09408e5..22a948f8256 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Nulls.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Nulls.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Ordinal_Null_Dimension.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Ordinal_Null_Dimension.png
index e6d099d05c0..28311d05900 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Ordinal_Null_Dimension.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Ordinal_Null_Dimension.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Ordinal_X_Scale.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Ordinal_X_Scale.png
index dad69802480..7781b4f783f 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Ordinal_X_Scale.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Ordinal_X_Scale.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Pow_Y_Scale.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Pow_Y_Scale.png
index 3df539cce27..26d274c13a7 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Pow_Y_Scale.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Pow_Y_Scale.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Pow_Y_Scale_Mixed.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Pow_Y_Scale_Mixed.png
index df558aaf628..41addf67e44 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Pow_Y_Scale_Mixed.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Pow_Y_Scale_Mixed.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Pow_Y_Scale_Negative_Only.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Pow_Y_Scale_Negative_Only.png
index e4b538a7cd0..545faaf7f0f 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Pow_Y_Scale_Negative_Only.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Pow_Y_Scale_Negative_Only.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Starts_Above_Zero_Crosses_Ends_Above.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Starts_Above_Zero_Crosses_Ends_Above.png
index 0cda6bcbe5b..26f9c4d0ad7 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Starts_Above_Zero_Crosses_Ends_Above.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Starts_Above_Zero_Crosses_Ends_Above.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Starts_Above_Zero_Ends_Below.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Starts_Above_Zero_Ends_Below.png
index deb99d8af21..5857628ecd6 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Starts_Above_Zero_Ends_Below.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Starts_Above_Zero_Ends_Below.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Starts_Below_Zero_Crosses_Ends_Below.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Starts_Below_Zero_Crosses_Ends_Below.png
index a6ca2c61e03..98cd40aa96c 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Starts_Below_Zero_Crosses_Ends_Below.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Starts_Below_Zero_Crosses_Ends_Below.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Starts_Below_Zero_Ends_Above.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Starts_Below_Zero_Ends_Above.png
index 1aaeab6cea9..2e6f6fdde61 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Starts_Below_Zero_Ends_Above.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Starts_Below_Zero_Ends_Above.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Structured_Time_Series_Year.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Structured_Time_Series_Year.png
index f6617b68638..c1783601ee6 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Structured_Time_Series_Year.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Structured_Time_Series_Year.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Time_Series_Data_As_Ordinal_X_Scale.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Time_Series_Data_As_Ordinal_X_Scale.png
index 7cb17452231..6379297e947 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Time_Series_Data_As_Ordinal_X_Scale.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Time_Series_Data_As_Ordinal_X_Scale.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Time_X_Scale_Two_Bars_Without_Total.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Time_X_Scale_Two_Bars_Without_Total.png
index 7c2cae955fb..e5a09dee133 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Time_X_Scale_Two_Bars_Without_Total.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Time_X_Scale_Two_Bars_Without_Total.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Timeseries_X_Scale.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Timeseries_X_Scale.png
index 67fb6ee33a0..8962a29511f 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Timeseries_X_Scale.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Timeseries_X_Scale.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Timeseries_X_Scale_Unsorted.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Timeseries_X_Scale_Unsorted.png
index 67fb6ee33a0..8962a29511f 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Timeseries_X_Scale_Unsorted.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Timeseries_X_Scale_Unsorted.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Two_Bars_With_Total.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Two_Bars_With_Total.png
index 6ee9fc14fde..5a0b07c2331 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Two_Bars_With_Total.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Two_Bars_With_Total.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Unaggregated_Linear.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Unaggregated_Linear.png
index a6f8fb8d401..1491a8fcce5 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Unaggregated_Linear.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Unaggregated_Linear.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Unaggregated_Ordinal.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Unaggregated_Ordinal.png
index 67c20bef1a8..40cdca1ca13 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Unaggregated_Ordinal.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Unaggregated_Ordinal.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Unaggregated_Timeseries.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Unaggregated_Timeseries.png
index b64a72908ba..43e35f884cc 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Unaggregated_Timeseries.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Unaggregated_Timeseries.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Watermark.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Watermark.png
index 8fbc2ecdeec..5071f0e34b3 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Watermark.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Watermark.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_With_Goal_Line.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_With_Goal_Line.png
index 62847d58797..6ddcd4c7c52 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_With_Goal_Line.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_With_Goal_Line.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Y_Axis_Auto_Compact_With_Data_Labels.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Y_Axis_Auto_Compact_With_Data_Labels.png
index 0c15d671b06..36c2edcc8c1 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Y_Axis_Auto_Compact_With_Data_Labels.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Y_Axis_Auto_Compact_With_Data_Labels.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Y_Axis_Compact_Without_Data_Labels.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Y_Axis_Compact_Without_Data_Labels.png
index 9011296b234..3e79c70537d 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Y_Axis_Compact_Without_Data_Labels.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Y_Axis_Compact_Without_Data_Labels.png differ
diff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Y_Axis_Full_With_Data_Labels.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Y_Axis_Full_With_Data_Labels.png
index a6488fa8746..dcd5fd6c87d 100644
Binary files a/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Y_Axis_Full_With_Data_Labels.png and b/.loki/reference/chrome_laptop_Viz_Static_Viz_WaterfallChart_Y_Axis_Full_With_Data_Labels.png differ
diff --git a/.loki/reference/chrome_laptop_viz_BarChart_Short_Bars_At_Baseline.png b/.loki/reference/chrome_laptop_viz_BarChart_Short_Bars_At_Baseline.png
index 53afe877991..435dc7c1499 100644
Binary files a/.loki/reference/chrome_laptop_viz_BarChart_Short_Bars_At_Baseline.png and b/.loki/reference/chrome_laptop_viz_BarChart_Short_Bars_At_Baseline.png differ
diff --git a/.loki/reference/chrome_laptop_viz_BarChart_Split_Panels_All_Panels_Empty.png b/.loki/reference/chrome_laptop_viz_BarChart_Split_Panels_All_Panels_Empty.png
index 3e464542bb3..9ef1a697ded 100644
Binary files a/.loki/reference/chrome_laptop_viz_BarChart_Split_Panels_All_Panels_Empty.png and b/.loki/reference/chrome_laptop_viz_BarChart_Split_Panels_All_Panels_Empty.png differ
diff --git a/.loki/reference/chrome_laptop_viz_BarChart_Split_Panels_Combo_All_Panels_Empty.png b/.loki/reference/chrome_laptop_viz_BarChart_Split_Panels_Combo_All_Panels_Empty.png
index 6423eb36ece..78cc0b8e1ac 100644
Binary files a/.loki/reference/chrome_laptop_viz_BarChart_Split_Panels_Combo_All_Panels_Empty.png and b/.loki/reference/chrome_laptop_viz_BarChart_Split_Panels_Combo_All_Panels_Empty.png differ
diff --git a/.loki/reference/chrome_laptop_viz_BarChart_Split_Panels_First_Panel_Empty.png b/.loki/reference/chrome_laptop_viz_BarChart_Split_Panels_First_Panel_Empty.png
index a6b934f1907..352f25f6714 100644
Binary files a/.loki/reference/chrome_laptop_viz_BarChart_Split_Panels_First_Panel_Empty.png and b/.loki/reference/chrome_laptop_viz_BarChart_Split_Panels_First_Panel_Empty.png differ
diff --git a/.loki/reference/chrome_laptop_viz_BoxPlot_All_Boxes_Off_Screen_With_Value_Labels.png b/.loki/reference/chrome_laptop_viz_BoxPlot_All_Boxes_Off_Screen_With_Value_Labels.png
index ec4c7210348..b463d5ce596 100644
Binary files a/.loki/reference/chrome_laptop_viz_BoxPlot_All_Boxes_Off_Screen_With_Value_Labels.png and b/.loki/reference/chrome_laptop_viz_BoxPlot_All_Boxes_Off_Screen_With_Value_Labels.png differ
diff --git a/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Hidden_On_Small_Card.png b/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Hidden_On_Small_Card.png
new file mode 100644
index 00000000000..2b4cc757840
Binary files /dev/null and b/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Hidden_On_Small_Card.png differ
diff --git a/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Hidden_When_Mostly_Truncated.png b/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Hidden_When_Mostly_Truncated.png
new file mode 100644
index 00000000000..e9f9cca376e
Binary files /dev/null and b/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Hidden_When_Mostly_Truncated.png differ
diff --git a/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Horizontal.png b/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Horizontal.png
new file mode 100644
index 00000000000..97ba5e14238
Binary files /dev/null and b/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Horizontal.png differ
diff --git a/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Large_Card_Horizontal.png b/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Large_Card_Horizontal.png
new file mode 100644
index 00000000000..b986b96efae
Binary files /dev/null and b/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Large_Card_Horizontal.png differ
diff --git a/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Large_Card_Vertical.png b/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Large_Card_Vertical.png
new file mode 100644
index 00000000000..3bf7913e9d7
Binary files /dev/null and b/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Large_Card_Vertical.png differ
diff --git a/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Large_Card_Vertical_Overflow.png b/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Large_Card_Vertical_Overflow.png
new file mode 100644
index 00000000000..bff9bcbae54
Binary files /dev/null and b/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Large_Card_Vertical_Overflow.png differ
diff --git a/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Minimum_Card_Size.png b/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Minimum_Card_Size.png
new file mode 100644
index 00000000000..a7746b2ba6b
Binary files /dev/null and b/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Minimum_Card_Size.png differ
diff --git a/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Query_Builder_Horizontal.png b/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Query_Builder_Horizontal.png
new file mode 100644
index 00000000000..f9729954620
Binary files /dev/null and b/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Query_Builder_Horizontal.png differ
diff --git a/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Query_Builder_Vertical.png b/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Query_Builder_Vertical.png
new file mode 100644
index 00000000000..aea68c0d285
Binary files /dev/null and b/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Query_Builder_Vertical.png differ
diff --git a/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Vertical.png b/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Vertical.png
new file mode 100644
index 00000000000..8d73229d012
Binary files /dev/null and b/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Vertical.png differ
diff --git a/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Vertical_Overflow.png b/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Vertical_Overflow.png
new file mode 100644
index 00000000000..b13d06b8f2e
Binary files /dev/null and b/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Vertical_Overflow.png differ
diff --git a/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Vertical_Truncated.png b/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Vertical_Truncated.png
new file mode 100644
index 00000000000..8d36a96b17b
Binary files /dev/null and b/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Vertical_Truncated.png differ
diff --git a/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Visualizer_Small_Canvas_Always_Visible.png b/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Visualizer_Small_Canvas_Always_Visible.png
new file mode 100644
index 00000000000..ce76d1e047d
Binary files /dev/null and b/.loki/reference/chrome_laptop_viz_Legend_LegendLayout_Visualizer_Small_Canvas_Always_Visible.png differ
diff --git a/.loki/reference/chrome_laptop_viz_LineChart_Goal_Line_Inside_Range_With_Data_Off_Screen.png b/.loki/reference/chrome_laptop_viz_LineChart_Goal_Line_Inside_Range_With_Data_Off_Screen.png
index 8f0d62c36d3..9bde21523dd 100644
Binary files a/.loki/reference/chrome_laptop_viz_LineChart_Goal_Line_Inside_Range_With_Data_Off_Screen.png and b/.loki/reference/chrome_laptop_viz_LineChart_Goal_Line_Inside_Range_With_Data_Off_Screen.png differ
diff --git a/.loki/reference/chrome_laptop_viz_LineChart_Line_Just_Above_Y_Axis_Max.png b/.loki/reference/chrome_laptop_viz_LineChart_Line_Just_Above_Y_Axis_Max.png
index 6716becfcd0..d48698abaa3 100644
Binary files a/.loki/reference/chrome_laptop_viz_LineChart_Line_Just_Above_Y_Axis_Max.png and b/.loki/reference/chrome_laptop_viz_LineChart_Line_Just_Above_Y_Axis_Max.png differ
diff --git a/.loki/reference/chrome_laptop_viz_LineChart_Line_Just_Below_Y_Axis_Max.png b/.loki/reference/chrome_laptop_viz_LineChart_Line_Just_Below_Y_Axis_Max.png
index 4c4ad78ee5c..0cd43241434 100644
Binary files a/.loki/reference/chrome_laptop_viz_LineChart_Line_Just_Below_Y_Axis_Max.png and b/.loki/reference/chrome_laptop_viz_LineChart_Line_Just_Below_Y_Axis_Max.png differ
diff --git a/.loki/reference/chrome_laptop_viz_PieChart_Dark_Theme.png b/.loki/reference/chrome_laptop_viz_PieChart_Dark_Theme.png
index e54326356fe..c0937480ed4 100644
Binary files a/.loki/reference/chrome_laptop_viz_PieChart_Dark_Theme.png and b/.loki/reference/chrome_laptop_viz_PieChart_Dark_Theme.png differ
diff --git a/.loki/reference/chrome_laptop_viz_PieChart_Embedded_Dashcard.png b/.loki/reference/chrome_laptop_viz_PieChart_Embedded_Dashcard.png
index 1e5abdccdf2..90294474ae6 100644
Binary files a/.loki/reference/chrome_laptop_viz_PieChart_Embedded_Dashcard.png and b/.loki/reference/chrome_laptop_viz_PieChart_Embedded_Dashcard.png differ
diff --git a/.loki/reference/chrome_laptop_viz_PieChart_Embedded_Question.png b/.loki/reference/chrome_laptop_viz_PieChart_Embedded_Question.png
index cbc83acce78..f828ed1caf4 100644
Binary files a/.loki/reference/chrome_laptop_viz_PieChart_Embedded_Question.png and b/.loki/reference/chrome_laptop_viz_PieChart_Embedded_Question.png differ
diff --git a/.loki/reference/chrome_laptop_viz_PieChart_Watermark.png b/.loki/reference/chrome_laptop_viz_PieChart_Watermark.png
index 9145ae1adb7..762bb8cc042 100644
Binary files a/.loki/reference/chrome_laptop_viz_PieChart_Watermark.png and b/.loki/reference/chrome_laptop_viz_PieChart_Watermark.png differ
diff --git a/.loki/reference/chrome_laptop_viz_TimelineEventsBand_Clusters.png b/.loki/reference/chrome_laptop_viz_TimelineEventsBand_Clusters.png
index 2562420c324..78adac7e41b 100644
Binary files a/.loki/reference/chrome_laptop_viz_TimelineEventsBand_Clusters.png and b/.loki/reference/chrome_laptop_viz_TimelineEventsBand_Clusters.png differ
diff --git a/.loki/reference/chrome_laptop_viz_TimelineEventsBand_Expanded_Stack.png b/.loki/reference/chrome_laptop_viz_TimelineEventsBand_Expanded_Stack.png
index 8a2f9967f3b..17fe2ce6105 100644
Binary files a/.loki/reference/chrome_laptop_viz_TimelineEventsBand_Expanded_Stack.png and b/.loki/reference/chrome_laptop_viz_TimelineEventsBand_Expanded_Stack.png differ
diff --git a/docs/questions/images/goal-line.png b/docs/questions/images/goal-line.png
index e333d82f015..b27fbc81b69 100644
Binary files a/docs/questions/images/goal-line.png and b/docs/questions/images/goal-line.png differ
diff --git a/docs/questions/visualizations/line-bar-and-area-charts.md b/docs/questions/visualizations/line-bar-and-area-charts.md
index 1893a712d7c..b996ac7a7fc 100644
--- a/docs/questions/visualizations/line-bar-and-area-charts.md
+++ b/docs/questions/visualizations/line-bar-and-area-charts.md
@@ -162,6 +162,8 @@ When you enable **Stack series**, the **Stacking** options are hidden.
![Goal line on chart](../images/goal-line.png)
+To see the goal's label and value, hover over the target icon on the goal line. In charts sent by email or Slack, like [dashboard subscriptions](../../dashboards/subscriptions.md), the goal label appears next to the line instead.
+
Goal lines can be used in conjunction with [alerts](../alerts.md) to send an email or a Slack message when your metric crosses this line.
### Trend lines
@@ -230,4 +232,4 @@ You can't hide the legend or change its position on the chart.
## Further reading
- [Summarizing and grouping](../query-builder/summarizing-and-grouping.md)
-- [Trend charts](./trend.md)
\ No newline at end of file
+- [Trend charts](./trend.md)
diff --git a/e2e/support/helpers/api/addQuestionToDashboard.ts b/e2e/support/helpers/api/addQuestionToDashboard.ts
index 9afb3019bc5..6bb376b777c 100644
--- a/e2e/support/helpers/api/addQuestionToDashboard.ts
+++ b/e2e/support/helpers/api/addQuestionToDashboard.ts
@@ -18,7 +18,7 @@ export const addQuestionToDashboard = ({
// Add sane defaults for the dashboard card size and position
row: 0,
col: 0,
- size_x: 11,
+ size_x: 12,
size_y: 8,
},
],
diff --git a/e2e/support/helpers/api/createNativeQuestionAndDashboard.ts b/e2e/support/helpers/api/createNativeQuestionAndDashboard.ts
index 905d66ccb3b..dc451e045e5 100644
--- a/e2e/support/helpers/api/createNativeQuestionAndDashboard.ts
+++ b/e2e/support/helpers/api/createNativeQuestionAndDashboard.ts
@@ -42,7 +42,7 @@ export const createNativeQuestionAndDashboard = ({
// Add sane defaults for the dashboard card size and position
row: 0,
col: 0,
- size_x: 11,
+ size_x: 12,
size_y: 6,
...cardDetails,
},
diff --git a/e2e/support/helpers/api/createQuestionAndAddToDashboard.ts b/e2e/support/helpers/api/createQuestionAndAddToDashboard.ts
index 836744fb002..7129fcb94dc 100644
--- a/e2e/support/helpers/api/createQuestionAndAddToDashboard.ts
+++ b/e2e/support/helpers/api/createQuestionAndAddToDashboard.ts
@@ -29,7 +29,7 @@ export const createQuestionAndAddToDashboard = (
// Add sane defaults for the dashboard card size and position
row: 0,
col: 0,
- size_x: 11,
+ size_x: 12,
size_y: 8,
...card,
},
diff --git a/e2e/support/helpers/api/createQuestionAndDashboard.ts b/e2e/support/helpers/api/createQuestionAndDashboard.ts
index 2f791aa8438..ec70905de16 100644
--- a/e2e/support/helpers/api/createQuestionAndDashboard.ts
+++ b/e2e/support/helpers/api/createQuestionAndDashboard.ts
@@ -30,7 +30,7 @@ export const createQuestionAndDashboard = ({
// Add sane defaults for the dashboard card size
row: 0,
col: 0,
- size_x: 11,
+ size_x: 12,
size_y: 6,
...cardDetails,
},
diff --git a/e2e/support/helpers/api/updateDashboardCards.ts b/e2e/support/helpers/api/updateDashboardCards.ts
index 8ec0d8dd119..95117cc08e7 100644
--- a/e2e/support/helpers/api/updateDashboardCards.ts
+++ b/e2e/support/helpers/api/updateDashboardCards.ts
@@ -4,7 +4,7 @@ export const DEFAULT_CARD = {
id: -1,
row: 0,
col: 0,
- size_x: 11,
+ size_x: 12,
size_y: 8,
visualization_settings: {},
parameter_mappings: [],
diff --git a/e2e/support/helpers/e2e-visual-tests-helpers.js b/e2e/support/helpers/e2e-visual-tests-helpers.js
index 44cf96136b1..9f39f23ec67 100644
--- a/e2e/support/helpers/e2e-visual-tests-helpers.js
+++ b/e2e/support/helpers/e2e-visual-tests-helpers.js
@@ -3,7 +3,7 @@ import { color as getColor } from "metabase/ui/colors";
import {
CHART_STYLE,
GOAL_LINE_DASH,
- TREND_LINE_DASH,
+ TREND_LINE_WIDTH,
} from "metabase/viz-core";
import { isFixedPositionElementVisible } from "./e2e-element-visibility-helpers";
@@ -38,9 +38,14 @@ export function goalLine() {
);
}
+export function goalLineMarker() {
+ return echartsContainer().find("path[fill-opacity='0']");
+}
+
export function trendLine() {
+ // Goal marker rings share the stroke width, but only line series use bevel joins.
return echartsContainer().find(
- `path[stroke-dasharray='${TREND_LINE_DASH.join(",")}']`,
+ `path[stroke-width='${TREND_LINE_WIDTH}'][stroke-linejoin='bevel']`,
);
}
@@ -75,12 +80,12 @@ export function timelineEventMarkerLine() {
export function chartGridLines() {
return echartsContainer().find(
- "path[stroke='var(--mb-color-cartesian-grid-line)'][fill='none']",
+ "path[stroke='var(--mb-color-chart-axis)'][fill='none']:not([stroke-linecap='round'])",
);
}
-export function splitPanelAxisLines() {
- const borderStrong = getColor("border-strong");
+export function splitPanelSeparators() {
+ const borderStrong = getColor("border-neutral-strong");
return echartsContainer().find(`path[stroke="${borderStrong}"]`);
}
@@ -303,3 +308,35 @@ export function applyBrush(left, right) {
.trigger("mousemove", right, 100)
.trigger("mouseup", right, 100);
}
+
+/**
+ * Select an inclusive range of distinct x positions, independent of chart padding.
+ * @param {number} startIndex
+ * @param {number} endIndex
+ * @param {Cypress.Chainable<JQuery<HTMLElement>>} elements
+ */
+export function applyBrushToPoints(
+ startIndex,
+ endIndex,
+ elements = cartesianChartCircles(),
+) {
+ elements.should("have.length.greaterThan", endIndex).then(($elements) => {
+ const positions = [
+ ...new Set(
+ $elements.toArray().map((element) => {
+ const { left, width } = element.getBoundingClientRect();
+ return Math.round((left + width / 2) * 100) / 100;
+ }),
+ ),
+ ].sort((left, right) => left - right);
+ expect(positions).to.have.length.greaterThan(endIndex);
+
+ echartsContainer().then(($container) => {
+ const { left } = $container[0].getBoundingClientRect();
+ applyBrush(
+ positions[startIndex] - left - 1,
+ positions[endIndex] - left + 1,
+ );
+ });
+ });
+}
diff --git a/e2e/test-component/scenarios/embedding-sdk/popover.cy.spec.tsx b/e2e/test-component/scenarios/embedding-sdk/popover.cy.spec.tsx
index 2493d6bf362..bce7e953619 100644
--- a/e2e/test-component/scenarios/embedding-sdk/popover.cy.spec.tsx
+++ b/e2e/test-component/scenarios/embedding-sdk/popover.cy.spec.tsx
@@ -81,7 +81,7 @@ describe("scenarios > embedding-sdk > popovers", () => {
getSdkRoot().within(() => {
cy.log("click on the legend overflow");
- cy.findByText("And 39 more").click();
+ cy.findByText(/^\+ \d+ more$/).click();
});
cy.log("check that the popover is showing chart legends");
diff --git a/e2e/test/scenarios/admin/i18n/content-translation/dashboards.cy.spec.ts b/e2e/test/scenarios/admin/i18n/content-translation/dashboards.cy.spec.ts
index 999f0239db1..37eaed58ec8 100644
--- a/e2e/test/scenarios/admin/i18n/content-translation/dashboards.cy.spec.ts
+++ b/e2e/test/scenarios/admin/i18n/content-translation/dashboards.cy.spec.ts
@@ -297,17 +297,19 @@ describe("scenarios > content translation > static embeds > dashboards", () => {
// Verify colors
cy.findByTestId("chart-legend").within(() => {
- cy.get("button [color]").then(($elements) => {
- const actualColors = Array.from($elements).map((el) =>
- el.getAttribute("color"),
- );
- expect(actualColors).to.deep.equal([
- "#69C8C8",
- "#C7EAEA",
- "#98D9D9",
- "#F3F3F4",
- ]);
- });
+ cy.findAllByTestId("legend-item")
+ .find("button")
+ .then(($elements) => {
+ const actualColors = Array.from($elements).map((element) =>
+ element.style.getPropertyValue("--legend-dot-color"),
+ );
+ expect(actualColors).to.deep.equal([
+ "#69C8C8",
+ "#C7EAEA",
+ "#98D9D9",
+ "#F3F3F4",
+ ]);
+ });
});
});
});
diff --git a/e2e/test/scenarios/dashboard-filters/parameters.cy.spec.js b/e2e/test/scenarios/dashboard-filters/parameters.cy.spec.js
index 6909f54ee39..b6e1814f393 100644
--- a/e2e/test/scenarios/dashboard-filters/parameters.cy.spec.js
+++ b/e2e/test/scenarios/dashboard-filters/parameters.cy.spec.js
@@ -1858,7 +1858,11 @@ describe("scenarios > dashboard > parameters", () => {
H.getDashboardCard(0).within(() => {
cy.findByText("Count").should("exist");
- cy.findAllByText("4,000").filter(":visible").should("have.length", 2); // y-axis label + filter
+ H.filterWidget()
+ .filter(":visible")
+ .findByText("4,000")
+ .should("be.visible");
+ H.echartsContainer().findByText("4.0k").should("be.visible");
cy.findByText("Category").should("not.exist");
cy.findByText("Doohickey").should("be.visible");
diff --git a/e2e/test/scenarios/dashboard/dashcard-click-behavior.cy.spec.js b/e2e/test/scenarios/dashboard/dashcard-click-behavior.cy.spec.js
index 62869afac33..b22ab7c4e1f 100644
--- a/e2e/test/scenarios/dashboard/dashcard-click-behavior.cy.spec.js
+++ b/e2e/test/scenarios/dashboard/dashcard-click-behavior.cy.spec.js
@@ -1209,7 +1209,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => {
H.getDashboardCard().realHover().icon("click").click();
H.getDashboardCard()
.button()
- .should("have.text", "Open the drill-through menu");
+ .should("contain.text", "Open the drill-through menu");
(function addCustomDashboardDestination() {
cy.log("custom destination (dashboard) behavior for 'Count' column");
@@ -1231,7 +1231,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => {
getCountToDashboardMapping().should("exist");
H.getDashboardCard()
.button()
- .should("have.text", "1 column has custom behavior");
+ .should("contain.text", "1 column has custom behavior");
})();
(function addCustomQuestionDestination() {
@@ -1252,7 +1252,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => {
getCreatedAtToQuestionMapping().should("exist");
H.getDashboardCard()
.button()
- .should("have.text", "2 columns have custom behavior");
+ .should("contain.text", "2 columns have custom behavior");
})();
cy.get("aside").button("Done").click();
@@ -1375,7 +1375,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => {
getCountToDashboardMapping().should("exist");
H.getDashboardCard()
.button()
- .should("have.text", "1 column has custom behavior");
+ .should("contain.text", "1 column has custom behavior");
cy.get("aside").button("Done").click();
H.saveDashboard();
@@ -1441,7 +1441,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => {
H.getDashboardCard()
.button()
- .should("have.text", "1 column has custom behavior");
+ .should("contain.text", "1 column has custom behavior");
(function addCustomUrlDestination() {
cy.log("custom destination (URL) behavior for 'Created At' column");
@@ -1475,7 +1475,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => {
H.getDashboardCard()
.button()
- .should("have.text", "2 columns have custom behavior");
+ .should("contain.text", "2 columns have custom behavior");
cy.get("aside").button("Done").click();
H.saveDashboard();
diff --git a/e2e/test/scenarios/dashboard/dashcard-fetching.cy.spec.js b/e2e/test/scenarios/dashboard/dashcard-fetching.cy.spec.js
index 9b7d8cb5045..5e44663bcfc 100644
--- a/e2e/test/scenarios/dashboard/dashcard-fetching.cy.spec.js
+++ b/e2e/test/scenarios/dashboard/dashcard-fetching.cy.spec.js
@@ -276,7 +276,7 @@ describe("issue 13736", () => {
},
{
card_id: successfulQuestionId,
- col: 11,
+ col: 12,
},
],
});
diff --git a/e2e/test/scenarios/dashboard/x-rays.cy.spec.js b/e2e/test/scenarios/dashboard/x-rays.cy.spec.js
index d46c422d6da..d0238fd711d 100644
--- a/e2e/test/scenarios/dashboard/x-rays.cy.spec.js
+++ b/e2e/test/scenarios/dashboard/x-rays.cy.spec.js
@@ -446,8 +446,6 @@ describe("scenarios > x-rays", { tags: "@slow" }, () => {
cy.findByText("Created At: Month").should("exist");
});
getDashcardByTitle("Sales per source").within(() => {
- cy.findByText("Organic").should("exist");
- cy.findByText("Affiliate").should("exist");
cy.findByText("Count").should("exist");
cy.findByText("Created At: Month").should("exist");
});
diff --git a/e2e/test/scenarios/embedding/embedding-dashboard.cy.spec.js b/e2e/test/scenarios/embedding/embedding-dashboard.cy.spec.js
index 7c28a78e1ff..3caa6795d60 100644
--- a/e2e/test/scenarios/embedding/embedding-dashboard.cy.spec.js
+++ b/e2e/test/scenarios/embedding/embedding-dashboard.cy.spec.js
@@ -1097,7 +1097,8 @@ describe("scenarios > embedding > dashboard appearance", () => {
H.getIframeBody().within(() => {
cy.findByText(questionDetails.name).should("exist");
- cy.findByText("May 2025").should("exist");
+ H.echartsContainer().should("be.visible");
+ H.chartPathWithFillColor("#509EE3").should("have.length", 5);
// TODO: Enable this once we fix the flakiness https://app.trunk.io/metabase/flaky-tests/test/facb35f0-6d76-5e7d-b21c-40401bbc3ff6?repo=metabase%2Fmetabase
// (metabase#49537)
diff --git a/e2e/test/scenarios/embedding/embedding-reproductions.cy.spec.js b/e2e/test/scenarios/embedding/embedding-reproductions.cy.spec.js
index 14b08cd8ae6..1dc3e0e0e75 100644
--- a/e2e/test/scenarios/embedding/embedding-reproductions.cy.spec.js
+++ b/e2e/test/scenarios/embedding/embedding-reproductions.cy.spec.js
@@ -932,7 +932,7 @@ describe("issue 8490", () => {
display: "pie",
},
],
- cards: [{}, { col: 11 }],
+ cards: [{}, { col: 12 }],
}).then(({ dashboard, questions: [lineChartQuestion] }) => {
cy.wrap(dashboard.id).as("dashboardId");
cy.wrap(lineChartQuestion.id).as("lineChartQuestionId");
diff --git a/e2e/test/scenarios/metrics/metrics-editing.cy.spec.js b/e2e/test/scenarios/metrics/metrics-editing.cy.spec.js
index 214be744351..8d848b87b44 100644
--- a/e2e/test/scenarios/metrics/metrics-editing.cy.spec.js
+++ b/e2e/test/scenarios/metrics/metrics-editing.cy.spec.js
@@ -154,260 +154,268 @@ function verifyMetricDefinitionScalar({ aggregation, value }) {
verifyScalarValue(value);
}
-describe("scenarios > metrics > editing", () => {
- beforeEach(() => {
- H.restore();
- cy.signInAsNormalUser();
- });
-
- describe("organization", () => {
- it("should be able to change the query definition of a metric and rename it", () => {
- H.createQuestion(ORDERS_SCALAR_METRIC).then(({ body: card }) => {
- H.setMetricDefaultDimension(card.id, "Created At");
- cy.visit(`/metric/${card.id}/query`);
- });
- H.MetricPage.queryEditor().should("be.visible");
- H.getNotebookStep("summarize").findByText("Formula").should("be.visible");
-
- cy.log("summarize step copy stays reachable at a small viewport");
- cy.viewport(800, 600);
- H.getNotebookStep("summarize")
- .findByText("Formula")
- .should("be.visible")
- .scrollIntoView();
- cy.viewport(1280, 800);
-
- H.getNotebookStep("summarize").button("Count").click();
- H.popover().within(() => {
- cy.findByText("Sum of ...").click();
- cy.findByText("Total").click();
- });
- H.MetricPage.saveButton().click();
- H.MetricPage.saveButton().should("not.exist");
- H.MetricPage.aboutTab().click();
- verifyMetricAboutTimeseries({ yAxis: "Sum of Total" });
-
- cy.log("rename the metric");
- cy.intercept("PUT", "/api/card/*").as("updateCard");
- H.MetricPage.aboutPage()
- .findByDisplayValue(ORDERS_SCALAR_METRIC.name)
- .clear()
- .type("New metric name{enter}");
- cy.wait("@updateCard")
- .its("response.body.name")
- .should("eq", "New metric name");
- H.MetricPage.aboutPage()
- .findByDisplayValue("New metric name")
- .should("be.visible");
+describe(
+ "scenarios > metrics > editing",
+ { viewportWidth: 1440 }, // make the viewport wider so the metric y-axis label appears
+ () => {
+ beforeEach(() => {
+ H.restore();
+ cy.signInAsNormalUser();
});
- });
-
- describe("data source", () => {
- it("should not allow to create a multi-stage metric", () => {
- startNewMetricWithSavedItem("Our analytics", "Orders Model");
- H.getNotebookStep("data").findByText("Orders Model").should("be.visible");
- H.getNotebookStep("summarize").findByText("Count").should("be.visible");
- H.MetricPage.queryEditor()
- .findByRole("button", { name: "Summarize" })
- .should("not.exist");
- });
- });
- describe("joins", () => {
- it("should join a table", () => {
- startNewMetricWithTable("Sample Database", "Products");
- startNewJoin();
- H.miniPicker().within(() => {
- cy.findByText("Sample Database").click();
- cy.findByText("Orders").click();
+ describe("organization", () => {
+ it("should be able to change the query definition of a metric and rename it", () => {
+ H.createQuestion(ORDERS_SCALAR_METRIC).then(({ body: card }) => {
+ H.setMetricDefaultDimension(card.id, "Created At");
+ cy.visit(`/metric/${card.id}/query`);
+ });
+ H.MetricPage.queryEditor().should("be.visible");
+ H.getNotebookStep("summarize")
+ .findByText("Formula")
+ .should("be.visible");
+
+ cy.log("summarize step copy stays reachable at a small viewport");
+ cy.viewport(800, 600);
+ H.getNotebookStep("summarize")
+ .findByText("Formula")
+ .should("be.visible")
+ .scrollIntoView();
+ cy.viewport(1440, 800);
+
+ H.getNotebookStep("summarize").button("Count").click();
+ H.popover().within(() => {
+ cy.findByText("Sum of ...").click();
+ cy.findByText("Total").click();
+ });
+ H.MetricPage.saveButton().click();
+ H.MetricPage.saveButton().should("not.exist");
+ H.MetricPage.aboutTab().click();
+ verifyMetricAboutTimeseries({ yAxis: "Sum of Total" });
+
+ cy.log("rename the metric");
+ cy.intercept("PUT", "/api/card/*").as("updateCard");
+ H.MetricPage.aboutPage()
+ .findByDisplayValue(ORDERS_SCALAR_METRIC.name)
+ .clear()
+ .type("New metric name{enter}");
+ cy.wait("@updateCard")
+ .its("response.body.name")
+ .should("eq", "New metric name");
+ H.MetricPage.aboutPage()
+ .findByDisplayValue("New metric name")
+ .should("be.visible");
});
- startNewFilter();
- H.popover().within(() => {
- cy.findByText("User").click();
- cy.findByText("State").click();
- cy.findByText("CA").click();
- cy.button("Add filter").click();
- });
- saveNewMetric();
- verifyMetricAboutTimeseries({ yAxis: "Count" });
- H.MetricPage.definitionTab().click();
- H.getNotebookStep("join")
- .findByLabelText("Right table")
- .should("have.text", "Orders");
- H.getNotebookStep("filter")
- .findByText("User → State is CA")
- .should("be.visible");
});
- it("should not be possible to join a metric", () => {
- H.createQuestion(ORDERS_SCALAR_METRIC);
- startNewMetricWithTable("Sample Database", "Orders");
- startNewJoin();
- H.miniPicker().within(() => {
- cy.findByText("Our analytics").click();
- cy.findByText("Orders").should("be.visible");
- cy.findByText(ORDERS_SCALAR_METRIC.name).should("not.exist");
- cy.findByText("Our analytics").click();
- });
- H.miniPickerBrowseAll().click();
- H.entityPickerModal().within(() => {
- cy.findByText("Our analytics").click();
- cy.findByText("Orders").should("be.visible");
- cy.findByText(ORDERS_SCALAR_METRIC.name).should("not.exist");
+ describe("data source", () => {
+ it("should not allow to create a multi-stage metric", () => {
+ startNewMetricWithSavedItem("Our analytics", "Orders Model");
+ H.getNotebookStep("data")
+ .findByText("Orders Model")
+ .should("be.visible");
+ H.getNotebookStep("summarize").findByText("Count").should("be.visible");
+ H.MetricPage.queryEditor()
+ .findByRole("button", { name: "Summarize" })
+ .should("not.exist");
});
});
- });
- describe("custom columns", () => {
- it("should be able to use custom columns and implicitly joinable columns in metric queries (metabase#42360)", () => {
- cy.log("custom column from same table");
- startNewMetricWithTable("Sample Database", "Orders");
- startNewCustomColumn();
- H.enterCustomColumnDetails({
- formula: "[Total] / 2",
- name: "Total2",
- });
- H.popover().button("Done").click();
- H.getNotebookStep("summarize").findByText("Count").click();
- H.popover().within(() => {
- cy.findByText("Sum of ...").click();
- cy.findByText("Total2").click();
- });
- saveNewMetric();
- verifyMetricDefinitionScalar({
- aggregation: "Sum of Total2",
- value: "755,310.84",
+ describe("joins", () => {
+ it("should join a table", () => {
+ startNewMetricWithTable("Sample Database", "Products");
+ startNewJoin();
+ H.miniPicker().within(() => {
+ cy.findByText("Sample Database").click();
+ cy.findByText("Orders").click();
+ });
+ startNewFilter();
+ H.popover().within(() => {
+ cy.findByText("User").click();
+ cy.findByText("State").click();
+ cy.findByText("CA").click();
+ cy.button("Add filter").click();
+ });
+ saveNewMetric();
+ verifyMetricAboutTimeseries({ yAxis: "Count" });
+ H.MetricPage.definitionTab().click();
+ H.getNotebookStep("join")
+ .findByLabelText("Right table")
+ .should("have.text", "Orders");
+ H.getNotebookStep("filter")
+ .findByText("User → State is CA")
+ .should("be.visible");
});
- cy.log("custom column from implicitly joined table");
- startNewMetricWithTable("Sample Database", "Orders");
- startNewCustomColumn();
- H.enterCustomColumnDetails({
- formula: "[Product → Price] * 2",
- name: "Price2",
- });
- H.popover().button("Done").click();
- H.getNotebookStep("summarize").findByText("Count").click();
- H.popover().within(() => {
- cy.findByText("Average of ...").click();
- cy.findByText("Price2").click();
- });
- saveNewMetric();
- verifyMetricDefinitionScalar({
- aggregation: "Average of Price2",
- value: "111.38",
+ it("should not be possible to join a metric", () => {
+ H.createQuestion(ORDERS_SCALAR_METRIC);
+ startNewMetricWithTable("Sample Database", "Orders");
+ startNewJoin();
+ H.miniPicker().within(() => {
+ cy.findByText("Our analytics").click();
+ cy.findByText("Orders").should("be.visible");
+ cy.findByText(ORDERS_SCALAR_METRIC.name).should("not.exist");
+ cy.findByText("Our analytics").click();
+ });
+ H.miniPickerBrowseAll().click();
+ H.entityPickerModal().within(() => {
+ cy.findByText("Our analytics").click();
+ cy.findByText("Orders").should("be.visible");
+ cy.findByText(ORDERS_SCALAR_METRIC.name).should("not.exist");
+ });
});
});
- });
- describe("filters", () => {
- it("should run the query from the empty state, then create a filtered timeseries metric based on a table", () => {
- startNewMetricWithTable("Sample Database", "Orders");
-
- cy.log("run the query from the metric empty state");
- cy.intercept("POST", "/api/dataset").as("dataset");
- H.runButtonInOverlay().click();
- cy.wait("@dataset");
- verifyScalarValue("18,760");
-
- cy.log("filter and aggregate, then save");
- addStringCategoryFilter({
- tableName: "Product",
- columnName: "Category",
- values: ["Gadget"],
- });
- H.getNotebookStep("summarize").findByText("Count").click();
- H.popover().within(() => {
- cy.findByText("Sum of ...").click();
- cy.findByText("Total").click();
+ describe("custom columns", () => {
+ it("should be able to use custom columns and implicitly joinable columns in metric queries (metabase#42360)", () => {
+ cy.log("custom column from same table");
+ startNewMetricWithTable("Sample Database", "Orders");
+ startNewCustomColumn();
+ H.enterCustomColumnDetails({
+ formula: "[Total] / 2",
+ name: "Total2",
+ });
+ H.popover().button("Done").click();
+ H.getNotebookStep("summarize").findByText("Count").click();
+ H.popover().within(() => {
+ cy.findByText("Sum of ...").click();
+ cy.findByText("Total2").click();
+ });
+ saveNewMetric();
+ verifyMetricDefinitionScalar({
+ aggregation: "Sum of Total2",
+ value: "755,310.84",
+ });
+
+ cy.log("custom column from implicitly joined table");
+ startNewMetricWithTable("Sample Database", "Orders");
+ startNewCustomColumn();
+ H.enterCustomColumnDetails({
+ formula: "[Product → Price] * 2",
+ name: "Price2",
+ });
+ H.popover().button("Done").click();
+ H.getNotebookStep("summarize").findByText("Count").click();
+ H.popover().within(() => {
+ cy.findByText("Average of ...").click();
+ cy.findByText("Price2").click();
+ });
+ saveNewMetric();
+ verifyMetricDefinitionScalar({
+ aggregation: "Average of Price2",
+ value: "111.38",
+ });
});
- saveNewMetric();
- verifyMetricAboutTimeseries({ yAxis: "Sum of Total" });
- H.MetricPage.definitionTab().click();
- H.getNotebookStep("filter")
- .findByText("Product → Category is Gadget")
- .should("be.visible");
});
- });
- describe("aggregations", () => {
- it("should create a metric with a custom aggregation expression based on 1 metric", () => {
- H.createQuestion(ORDERS_SCALAR_METRIC);
- H.startNewMetric();
- H.MetricPage.queryEditor().should("be.visible");
- cy.intercept("POST", "/api/dataset/query_metadata").as("metadata");
- H.miniPickerBrowseAll().click();
- H.entityPickerModal().within(() => {
- cy.findByText("Our analytics").click();
- cy.findByText(ORDERS_SCALAR_METRIC.name).click();
- });
- cy.wait("@metadata");
- H.getNotebookStep("summarize")
- .findByText(ORDERS_SCALAR_METRIC.name)
- .click();
- H.enterCustomColumnDetails({
- formula: `[${ORDERS_SCALAR_METRIC.name}] / 2`,
- name: "",
- blur: true,
- });
- H.popover().button("Update").should("not.be.disabled").click();
- saveNewMetric();
- verifyMetricAboutTimeseries({ yAxis: "Orders metric" });
- verifyMetricDefinitionScalar({
- aggregation: "Orders metric",
- value: "9,380",
+ describe("filters", () => {
+ it("should run the query from the empty state, then create a filtered timeseries metric based on a table", () => {
+ startNewMetricWithTable("Sample Database", "Orders");
+
+ cy.log("run the query from the metric empty state");
+ cy.intercept("POST", "/api/dataset").as("dataset");
+ H.runButtonInOverlay().click();
+ cy.wait("@dataset");
+ verifyScalarValue("18,760");
+
+ cy.log("filter and aggregate, then save");
+ addStringCategoryFilter({
+ tableName: "Product",
+ columnName: "Category",
+ values: ["Gadget"],
+ });
+ H.getNotebookStep("summarize").findByText("Count").click();
+ H.popover().within(() => {
+ cy.findByText("Sum of ...").click();
+ cy.findByText("Total").click();
+ });
+ saveNewMetric();
+ verifyMetricAboutTimeseries({ yAxis: "Sum of Total" });
+ H.MetricPage.definitionTab().click();
+ H.getNotebookStep("filter")
+ .findByText("Product → Category is Gadget")
+ .should("be.visible");
});
});
- });
-
- describe("compatible metrics", () => {
- it("should list, describe, search, and add an aggregation based on a compatible metric for the same table in questions (metabase#42470)", () => {
- H.createQuestion(ORDERS_SCALAR_METRIC);
- H.createQuestion(ORDERS_SCALAR_FILTER_METRIC);
- H.createQuestion(PRODUCTS_SCALAR_METRIC);
- H.createQuestion(ORDERS_SCALAR_MODEL_METRIC);
- H.startNewQuestion();
- H.miniPicker().within(() => {
- cy.findByText("Sample Database").click();
- cy.findByText("Orders").click();
- });
- startNewAggregation();
- H.popover().within(() => {
- cy.findByText("Metrics").click();
- cy.findByText(ORDERS_SCALAR_METRIC.name).should("be.visible");
- cy.findByText(ORDERS_SCALAR_FILTER_METRIC.name).should("be.visible");
- cy.findByText(PRODUCTS_SCALAR_METRIC.name).should("not.exist");
- cy.findByText(ORDERS_SCALAR_MODEL_METRIC.name).should("not.exist");
- });
- cy.log("hovering a metric shows its description");
- H.popover().within(() => {
- cy.findByText(ORDERS_SCALAR_FILTER_METRIC.name).realHover();
- cy.findByLabelText("More info").should("exist").realHover();
- });
- H.hovercard().within(() => {
- cy.contains("This is a description").should("be.visible");
- cy.contains("with markdown").should("be.visible");
- });
- H.popover().findByPlaceholderText("Find...").realHover();
- H.hovercard().should("not.exist");
-
- cy.log("search for metrics");
- H.popover().within(() => {
- cy.findByPlaceholderText("Find...").type("with filter");
- cy.findByText("Metrics").should("be.visible");
- cy.findByText(ORDERS_SCALAR_FILTER_METRIC.name).should("be.visible");
- cy.findByText(ORDERS_SCALAR_METRIC.name).should("not.exist");
- cy.findByText(PRODUCTS_SCALAR_METRIC.name).should("not.exist");
- cy.findByPlaceholderText("Find...").clear();
+ describe("aggregations", () => {
+ it("should create a metric with a custom aggregation expression based on 1 metric", () => {
+ H.createQuestion(ORDERS_SCALAR_METRIC);
+ H.startNewMetric();
+ H.MetricPage.queryEditor().should("be.visible");
+ cy.intercept("POST", "/api/dataset/query_metadata").as("metadata");
+ H.miniPickerBrowseAll().click();
+ H.entityPickerModal().within(() => {
+ cy.findByText("Our analytics").click();
+ cy.findByText(ORDERS_SCALAR_METRIC.name).click();
+ });
+ cy.wait("@metadata");
+ H.getNotebookStep("summarize")
+ .findByText(ORDERS_SCALAR_METRIC.name)
+ .click();
+ H.enterCustomColumnDetails({
+ formula: `[${ORDERS_SCALAR_METRIC.name}] / 2`,
+ name: "",
+ blur: true,
+ });
+ H.popover().button("Update").should("not.be.disabled").click();
+ saveNewMetric();
+ verifyMetricAboutTimeseries({ yAxis: "Orders metric" });
+ verifyMetricDefinitionScalar({
+ aggregation: "Orders metric",
+ value: "9,380",
+ });
});
+ });
- cy.log("pick a metric");
- H.popover().within(() => {
- cy.findByText(ORDERS_SCALAR_METRIC.name).should("be.visible").click();
+ describe("compatible metrics", () => {
+ it("should list, describe, search, and add an aggregation based on a compatible metric for the same table in questions (metabase#42470)", () => {
+ H.createQuestion(ORDERS_SCALAR_METRIC);
+ H.createQuestion(ORDERS_SCALAR_FILTER_METRIC);
+ H.createQuestion(PRODUCTS_SCALAR_METRIC);
+ H.createQuestion(ORDERS_SCALAR_MODEL_METRIC);
+ H.startNewQuestion();
+ H.miniPicker().within(() => {
+ cy.findByText("Sample Database").click();
+ cy.findByText("Orders").click();
+ });
+ startNewAggregation();
+ H.popover().within(() => {
+ cy.findByText("Metrics").click();
+ cy.findByText(ORDERS_SCALAR_METRIC.name).should("be.visible");
+ cy.findByText(ORDERS_SCALAR_FILTER_METRIC.name).should("be.visible");
+ cy.findByText(PRODUCTS_SCALAR_METRIC.name).should("not.exist");
+ cy.findByText(ORDERS_SCALAR_MODEL_METRIC.name).should("not.exist");
+ });
+
+ cy.log("hovering a metric shows its description");
+ H.popover().within(() => {
+ cy.findByText(ORDERS_SCALAR_FILTER_METRIC.name).realHover();
+ cy.findByLabelText("More info").should("exist").realHover();
+ });
+ H.hovercard().within(() => {
+ cy.contains("This is a description").should("be.visible");
+ cy.contains("with markdown").should("be.visible");
+ });
+ H.popover().findByPlaceholderText("Find...").realHover();
+ H.hovercard().should("not.exist");
+
+ cy.log("search for metrics");
+ H.popover().within(() => {
+ cy.findByPlaceholderText("Find...").type("with filter");
+ cy.findByText("Metrics").should("be.visible");
+ cy.findByText(ORDERS_SCALAR_FILTER_METRIC.name).should("be.visible");
+ cy.findByText(ORDERS_SCALAR_METRIC.name).should("not.exist");
+ cy.findByText(PRODUCTS_SCALAR_METRIC.name).should("not.exist");
+ cy.findByPlaceholderText("Find...").clear();
+ });
+
+ cy.log("pick a metric");
+ H.popover().within(() => {
+ cy.findByText(ORDERS_SCALAR_METRIC.name).should("be.visible").click();
+ });
+ H.visualize();
+ verifyScalarValue("18,760");
});
- H.visualize();
- verifyScalarValue("18,760");
});
- });
-});
+ },
+);
diff --git a/e2e/test/scenarios/metrics/metrics-explorer.cy.spec.ts b/e2e/test/scenarios/metrics/metrics-explorer.cy.spec.ts
index 885d3926f70..bfc9a641a69 100644
--- a/e2e/test/scenarios/metrics/metrics-explorer.cy.spec.ts
+++ b/e2e/test/scenarios/metrics/metrics-explorer.cy.spec.ts
@@ -1502,11 +1502,11 @@ describe("scenarios > metrics > explorer", () => {
});
cy.log("should split the chart into separate panels");
- H.splitPanelAxisLines().should("have.length", 2);
+ H.splitPanelSeparators().should("have.length", 1);
cy.log("toggling off should return to unified view");
cy.findByLabelText("Default layout").click();
- H.splitPanelAxisLines().should("have.length", 0);
+ H.splitPanelSeparators().should("have.length", 0);
cy.log("button should not be visible for non-line/area/bar charts");
selectDimensionBreakout("State", { seeAll: true });
@@ -1967,7 +1967,7 @@ describe("scenarios > metrics > explorer", () => {
.findByRole("button", { name: /All time/i })
.should("be.visible");
H.ensureChartIsActive();
- H.applyBrush(100, 250);
+ H.applyBrushToPoints(2, 7);
H.MetricsViewer.getMetricControls()
.findByRole("button", { name: /All time/i })
.should("not.exist");
diff --git a/e2e/test/scenarios/question/native-query-drill.cy.spec.ts b/e2e/test/scenarios/question/native-query-drill.cy.spec.ts
index eaf54a7f57a..c5cd85fe445 100644
--- a/e2e/test/scenarios/question/native-query-drill.cy.spec.ts
+++ b/e2e/test/scenarios/question/native-query-drill.cy.spec.ts
@@ -389,9 +389,7 @@ describe("scenarios > question > native query drill", () => {
H.createNativeQuestionAndDashboard({
questionDetails: timeseriesLineQuestionDetails,
}).then(({ body }) => H.visitDashboard(body.dashboard_id));
- H.getDashboardCard().within(() =>
- applyBrushFilter({ left: 150, right: 300 }),
- );
+ H.getDashboardCard().within(() => H.applyBrushToPoints(2, 5));
cy.wait("@dataset");
H.assertQueryBuilderRowCount(4);
});
@@ -400,9 +398,7 @@ describe("scenarios > question > native query drill", () => {
H.createNativeQuestionAndDashboard({
questionDetails: numericLineQuestionDetails,
}).then(({ body }) => H.visitDashboard(body.dashboard_id));
- H.getDashboardCard().within(() =>
- applyBrushFilter({ left: 100, right: 320 }),
- );
+ H.getDashboardCard().within(() => H.applyBrushToPoints(1, 6));
cy.wait("@dataset");
H.assertQueryBuilderRowCount(6);
});
diff --git a/e2e/test/scenarios/sharing/alert/alert-types.cy.spec.js b/e2e/test/scenarios/sharing/alert/alert-types.cy.spec.js
index c5de2cff444..d10e3bd08f1 100644
--- a/e2e/test/scenarios/sharing/alert/alert-types.cy.spec.js
+++ b/e2e/test/scenarios/sharing/alert/alert-types.cy.spec.js
@@ -79,7 +79,7 @@ describe("scenarios > alert > types", { tags: "@external" }, () => {
cy.log("Set the goal on timeseries question");
H.visitQuestion(timeSeriesQuestionId);
- cy.findByTestId("chart-container").should("contain", "Goal");
+ H.goalLineMarker().should("be.visible");
cy.findByLabelText("Move, trash, and more…").click();
H.popover().findByText("Create an alert").click();
@@ -109,7 +109,7 @@ describe("scenarios > alert > types", { tags: "@external" }, () => {
it("should not be possible to create goal based alert for a multi-series question", () => {
H.createQuestion(multiSeriesQuestionWithGoal, { visitQuestion: true });
- cy.findByTestId("chart-container").should("contain", "Goal");
+ H.goalLineMarker().should("be.visible");
cy.findByLabelText("Move, trash, and more…").click();
H.popover().findByText("Create an alert").click();
diff --git a/e2e/test/scenarios/visualizations/charts/bar_chart.cy.spec.js b/e2e/test/scenarios/visualizations/charts/bar_chart.cy.spec.js
index c9d81698bc4..a75f16d4e07 100644
--- a/e2e/test/scenarios/visualizations/charts/bar_chart.cy.spec.js
+++ b/e2e/test/scenarios/visualizations/charts/bar_chart.cy.spec.js
@@ -732,7 +732,10 @@ describe("scenarios > visualizations > bar chart", () => {
.contains("[data-testid=dashcard]", "Should split")
.within(() => {
// Verify this axis tick exists twice which verifies there are two y-axes
- H.echartsContainer().findAllByText("3.0k").should("have.length", 2);
+ H.echartsContainer()
+ .findAllByText("21.0k")
+ .should("have.length", 2)
+ .and("be.visible");
});
cy.findAllByTestId("dashcard")
@@ -1025,7 +1028,7 @@ describe("scenarios > visualizations > bar chart", () => {
},
});
- H.echartsContainer().findByText("Goal").trigger("mousemove");
+ H.goalLineMarker().trigger("mousemove");
H.tooltip().within(() => {
cy.findByText("Goal:").should("exist");
@@ -1039,6 +1042,9 @@ describe("scenarios > visualizations > bar chart", () => {
// Create a bar chart showing count of orders by month for the last 12 months
H.visitQuestionAdhoc({
display: "bar",
+ visualization_settings: {
+ "graph.x_axis.axis_enabled": "compact",
+ },
dataset_query: {
type: "query",
query: {
@@ -1068,14 +1074,15 @@ describe("scenarios > visualizations > bar chart", () => {
H.echartsContainer()
.findAllByText(
- /^(January|February|March|April|May|June|July|August|September|October|November|December) \d{4}$/,
+ /^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d{4}$/,
)
- .should("have.length", 12);
+ .should("have.length", 12)
+ .and("be.visible");
});
it("should rotate axis labels when they do not fit horizontally instead of hiding them (metabase#68048)", () => {
// Use a smaller viewport to ensure labels need to rotate
- cy.viewport(940, 800);
+ cy.viewport(820, 800);
const query = `
SELECT * FROM (
diff --git a/e2e/test/scenarios/visualizations/charts/boxplot.cy.spec.js b/e2e/test/scenarios/visualizations/charts/boxplot.cy.spec.js
index 27c10bbd8e8..cb70ea1e9bc 100644
--- a/e2e/test/scenarios/visualizations/charts/boxplot.cy.spec.js
+++ b/e2e/test/scenarios/visualizations/charts/boxplot.cy.spec.js
@@ -172,8 +172,27 @@ describe("scenarios > visualizations > boxplot", () => {
cy.findByLabelText("Goal label").clear().type("Target");
});
- H.echartsContainer().findByText("Target").should("exist");
H.goalLine().should("exist");
+ H.goalLineMarker().should("be.visible");
+ });
+
+ it("should show the goal in a tooltip when hovering the goal marker", () => {
+ H.visitQuestionAdhoc({
+ ...singleSeriesQuestion,
+ visualization_settings: {
+ ...singleSeriesQuestion.visualization_settings,
+ "graph.show_goal": true,
+ "graph.goal_value": 100,
+ "graph.goal_label": "Target",
+ },
+ });
+
+ H.goalLineMarker().trigger("mousemove");
+
+ H.tooltip().within(() => {
+ cy.findByText("Target:").should("be.visible");
+ cy.findByText("100").should("be.visible");
+ });
});
it("should render in dashboard and support drill-through on boxes and outliers", () => {
@@ -466,10 +485,10 @@ describe("scenarios > visualizations > boxplot", () => {
H.leftSidebar().findByText("Axes").click();
// Default: pinned to zero, y-axis should include 0
- H.echartsContainer().findByText("$0").should("be.visible");
+ H.echartsContainer().findByText("$0.00").should("be.visible");
H.leftSidebar().findByText("Unpin from zero").click();
// After unpinning, 0 should not be visible (y-axis starts higher since prices are ~$40-80)
- H.echartsContainer().findByText("$0").should("not.exist");
+ H.echartsContainer().findByText("$0.00").should("not.exist");
});
});
diff --git a/e2e/test/scenarios/visualizations/charts/combo.cy.spec.js b/e2e/test/scenarios/visualizations/charts/combo.cy.spec.js
index 78a849c4579..f7ed1de8dac 100644
--- a/e2e/test/scenarios/visualizations/charts/combo.cy.spec.js
+++ b/e2e/test/scenarios/visualizations/charts/combo.cy.spec.js
@@ -101,7 +101,7 @@ describe("scenarios > visualizations > combo", () => {
});
// First circle of stacked area series
- H.cartesianChartCircleWithColor("#98D9D9").eq(0).trigger("mousemove");
+ H.cartesianChartCircleWithColor("#98D9D9").eq(0).realHover();
// Check the tooltip shows only stacked areas series
H.assertEChartsTooltip({
diff --git a/e2e/test/scenarios/visualizations/charts/legend.cy.spec.js b/e2e/test/scenarios/visualizations/charts/legend.cy.spec.js
index ccc53d6141b..a084b26d53a 100644
--- a/e2e/test/scenarios/visualizations/charts/legend.cy.spec.js
+++ b/e2e/test/scenarios/visualizations/charts/legend.cy.spec.js
@@ -151,7 +151,9 @@ describe("scenarios > visualizations > legend", () => {
}).then(({ dashboard }) => H.visitDashboard(dashboard.id));
H.getDashboardCard(0).within(() =>
- H.chartPathWithFillColor(CATEGORY_COLOR.DOOHICKEY).first().realHover(),
+ H.chartPathWithFillColor(CATEGORY_COLOR.DOOHICKEY)
+ .first()
+ .realHover({ scrollBehavior: "nearest" }),
);
H.assertEChartsTooltip({
header: "2025",
@@ -163,6 +165,7 @@ describe("scenarios > visualizations > legend", () => {
],
});
+ H.getDashboardCard(0).scrollIntoView();
H.getDashboardCard(0).within(() => {
H.chartPathWithFillColor(CATEGORY_COLOR.DOOHICKEY).should(
"have.length",
@@ -176,9 +179,8 @@ describe("scenarios > visualizations > legend", () => {
cy.findByText("Created At: Year").should("exist"); // x-axis label
// some y-axis values
- cy.findByText("1,800").should("exist");
- cy.findByText("1,500").should("exist");
- cy.findByText("1,200").should("exist");
+ cy.findByText("1.8k").should("be.visible");
+ cy.findByText("0").should("be.visible");
});
hideSeries(1); // Gadget
@@ -201,7 +203,9 @@ describe("scenarios > visualizations > legend", () => {
});
H.getDashboardCard(0).within(() =>
- H.chartPathWithFillColor(CATEGORY_COLOR.DOOHICKEY).first().realHover(),
+ H.chartPathWithFillColor(CATEGORY_COLOR.DOOHICKEY)
+ .first()
+ .realHover({ scrollBehavior: "nearest" }),
);
H.assertEChartsTooltip({
header: "2025",
@@ -236,9 +240,9 @@ describe("scenarios > visualizations > legend", () => {
cy.findByText("Created At: Year").should("exist"); // x-axis label
// Ensure y-axis adjusts to visible series range
- cy.findByText("1,800").should("not.exist");
- cy.findByText("1,500").should("exist");
- cy.findByText("1,200").should("exist");
+ cy.findByText("1.5k").should("be.visible");
+ cy.findByText("0").should("be.visible");
+ cy.findByText("1.8k").should("not.exist");
});
showSeries(1);
@@ -253,9 +257,8 @@ describe("scenarios > visualizations > legend", () => {
H.echartsContainer().within(() => {
cy.findByText("Count").should("exist"); // y-axis label
cy.findByText("Created At: Year").should("exist"); // x-axis label
- cy.findByText("1,800").should("exist");
- cy.findByText("1,500").should("exist");
- cy.findByText("1,200").should("exist");
+ cy.findByText("1.8k").should("be.visible");
+ cy.findByText("0").should("be.visible");
});
showSeries(2);
@@ -264,7 +267,7 @@ describe("scenarios > visualizations > legend", () => {
H.getDashboardCard(1).within(() => {
H.echartsContainer().findByText("500").should("exist"); // max y-axis value
- cy.findByText("And 39 more").click();
+ cy.findByText(/\+ \d+ more/).click();
});
H.popover().within(() => hideSeries(29)); // TX (Texas);
H.getDashboardCard(1).click(); // click outside of popover to close it
@@ -272,15 +275,16 @@ describe("scenarios > visualizations > legend", () => {
H.echartsContainer().findByText("500").should("not.exist"),
);
+ H.getDashboardCard(2).scrollIntoView();
H.getDashboardCard(2).within(() => {
H.echartsContainer().within(() => {
// left axis
cy.findByText("Sum of Total").should("exist");
- cy.findByText("600,000").should("exist");
+ cy.findByText("600.0k").should("be.visible");
// right axis
cy.findByText("Sum of Quantity").should("exist");
- cy.findByText("30,000").should("exist");
+ cy.findByText("30.0k").should("be.visible");
});
H.trendLine().should("have.length", 2);
@@ -289,11 +293,11 @@ describe("scenarios > visualizations > legend", () => {
H.echartsContainer().within(() => {
// left axis
cy.findByText("Sum of Total").should("not.exist");
- cy.findByText("600,000").should("not.exist");
+ cy.findByText("600.0k").should("not.exist");
// right axis
cy.findByText("Sum of Quantity").should("exist");
- cy.findByText("30,000").should("exist");
+ cy.findByText("30.0k").should("be.visible");
});
H.trendLine().should("have.length", 1);
@@ -303,11 +307,11 @@ describe("scenarios > visualizations > legend", () => {
H.echartsContainer().within(() => {
// left axis
cy.findByText("Sum of Total").should("exist");
- cy.findByText("600,000").should("exist");
+ cy.findByText("600.0k").should("be.visible");
// right axis
cy.findByText("Sum of Quantity").should("not.exist");
- cy.findByText("30,000").should("not.exist");
+ cy.findByText("30.0k").should("not.exist");
});
H.trendLine().should("have.length", 1);
});
@@ -415,9 +419,8 @@ describe("scenarios > visualizations > legend", () => {
cy.findByText("Created At: Year").should("exist"); // x-axis label
// some y-axis values
- cy.findByText("1,800").should("exist");
- cy.findByText("1,500").should("exist");
- cy.findByText("1,200").should("exist");
+ cy.findByText("1.8k").should("be.visible");
+ cy.findByText("0").should("be.visible");
});
hideSeries(1); // Gadget
@@ -427,6 +430,40 @@ describe("scenarios > visualizations > legend", () => {
H.chartPathWithFillColor(CATEGORY_COLOR.WIDGET).should("have.length", 5);
});
+ it("should preserve full Y-axis formatting and custom ticks on a public dashboard", () => {
+ H.createDashboardWithQuestions({
+ questions: [
+ {
+ ...SINGLE_AGGREGATION_QUESTION,
+ visualization_settings: {
+ "graph.label_value_formatting": "full",
+ "graph.y_axis.split_number": 5,
+ },
+ },
+ ],
+ cards: [{ col: 0, row: 0, size_x: 24, size_y: 6 }],
+ }).then(({ dashboard }) => {
+ H.visitPublicDashboard(dashboard.id);
+ });
+
+ H.echartsContainer().within(() => {
+ cy.findByText("1,800").should("be.visible");
+ cy.findByText("1,500").should("be.visible");
+ cy.findByText("1,200").should("be.visible");
+ cy.findByText("1.8k").should("not.exist");
+ });
+
+ hideSeries(1); // Gadget
+
+ H.chartPathWithFillColor(CATEGORY_COLOR.GADGET).should("have.length", 0);
+ H.echartsContainer().within(() => {
+ cy.findByText("1,800").should("be.visible");
+ cy.findByText("1,500").should("be.visible");
+ cy.findByText("1,200").should("be.visible");
+ cy.findByText("900").should("be.visible");
+ });
+ });
+
it("should toggle series visibility in the query builder", () => {
H.createQuestion(SINGLE_AGGREGATION_QUESTION, { visitQuestion: true });
@@ -630,7 +667,7 @@ function hideSeries(legendItemIndex) {
cy.findAllByTestId("legend-item")
.eq(legendItemIndex)
.findByLabelText("Hide series")
- .click();
+ .click({ scrollBehavior: "nearest" });
}
function showSeries(legendItemIndex) {
@@ -638,7 +675,7 @@ function showSeries(legendItemIndex) {
cy.findAllByTestId("legend-item")
.eq(legendItemIndex)
.findByLabelText("Show series")
- .click();
+ .click({ scrollBehavior: "nearest" });
}
function getPieChartLegendItemPercentage(sliceName) {
diff --git a/e2e/test/scenarios/visualizations/charts/line_chart.cy.spec.js b/e2e/test/scenarios/visualizations/charts/line_chart.cy.spec.js
index 0210ae5be88..d1724630d1f 100644
--- a/e2e/test/scenarios/visualizations/charts/line_chart.cy.spec.js
+++ b/e2e/test/scenarios/visualizations/charts/line_chart.cy.spec.js
@@ -123,10 +123,10 @@ describe("scenarios > visualizations > line chart", () => {
// For bar chart
cy.icon("bar").click();
- cy.findByText("Line shape").should("not.be.visible");
- cy.findByText("Line style").should("not.be.visible");
- cy.findByText("Line size").should("not.be.visible");
- cy.findByText("Show dots on lines").should("not.be.visible");
+ cy.findByText("Line shape").should("not.exist");
+ cy.findByText("Line style").should("not.exist");
+ cy.findByText("Line size").should("not.exist");
+ cy.findByText("Show dots on lines").should("not.exist");
});
});
@@ -943,14 +943,9 @@ describe("scenarios > visualizations > line chart", () => {
});
H.queryBuilderMain().within(() => {
- H.echartsContainer().findByText("Quantity").should("exist");
+ H.echartsContainer().findByText("Quantity").should("be.visible");
});
- cy.wait(100); // wait to avoid grabbing the svg before the chart redraws
-
- cy.findByTestId("query-visualization-root")
- .trigger("mousedown", 180, 200)
- .trigger("mousemove", 180, 200)
- .trigger("mouseup", 220, 200);
+ H.applyBrushToPoints(6, 10);
cy.wait("@dataset");
@@ -961,7 +956,7 @@ describe("scenarios > visualizations > line chart", () => {
const X_AXIS_VALUE = 8;
H.echartsContainer().within(() => {
cy.get("text").contains("Quantity").should("be.visible");
- cy.findByText(X_AXIS_VALUE);
+ cy.findByText(X_AXIS_VALUE).should("be.visible");
});
});
@@ -993,7 +988,7 @@ describe("scenarios > visualizations > line chart", () => {
});
H.echartsContainer().findByText("$50.0k").should("exist");
- H.echartsContainer().findByText("Goal").trigger("mousemove");
+ H.goalLineMarker().trigger("mousemove");
H.tooltip().within(() => {
cy.findByText("Goal:").should("exist");
@@ -1018,7 +1013,7 @@ describe("scenarios > visualizations > line chart", () => {
});
H.echartsContainer().findByText("50.0k%").should("exist");
- H.echartsContainer().findByText("Goal").trigger("mousemove");
+ H.goalLineMarker().trigger("mousemove");
H.tooltip().within(() => {
cy.findByText("Goal:").should("exist");
@@ -1221,7 +1216,7 @@ describe("scenarios > visualizations > line chart", () => {
cy.findByText("8").should("be.visible");
});
- H.splitPanelAxisLines().should("have.length", 2);
+ H.splitPanelSeparators().should("have.length", 1);
H.cartesianChartCircleWithColor("#88BF4D");
H.cartesianChartCircleWithColor("#A989C5");
@@ -1267,10 +1262,7 @@ describe("scenarios > visualizations > line chart", () => {
});
// Brush
- cy.findByTestId("query-visualization-root")
- .trigger("mousedown", 180, 200)
- .trigger("mousemove", 180, 200)
- .trigger("mouseup", 400, 200);
+ H.applyBrushToPoints(6, 10);
cy.wait("@dataset");
cy.findByTestId("qb-filters-panel").should(
@@ -1303,7 +1295,7 @@ describe(
function assertOnTheYAxis() {
H.echartsContainer().find("text").contains("Count");
- H.echartsContainer().find("text").contains("6,000");
+ H.echartsContainer().find("text").contains("7.0k").should("be.visible");
}
beforeEach(() => {
diff --git a/e2e/test/scenarios/visualizations/charts/rows.cy.spec.js b/e2e/test/scenarios/visualizations/charts/rows.cy.spec.js
index 40d7b53e716..e0951484ad9 100644
--- a/e2e/test/scenarios/visualizations/charts/rows.cy.spec.js
+++ b/e2e/test/scenarios/visualizations/charts/rows.cy.spec.js
@@ -214,4 +214,31 @@ describe("scenarios > visualizations > rows", () => {
"This chart type doesn't support more than 100 series of data.",
);
});
+
+ it("should show the goal in a tooltip when hovering the goal marker", () => {
+ H.visitQuestionAdhoc({
+ display: "row",
+ dataset_query: {
+ database: SAMPLE_DB_ID,
+ type: "query",
+ query: {
+ "source-table": PRODUCTS_ID,
+ aggregation: [["count"]],
+ breakout: [["field", PRODUCTS.CATEGORY, null]],
+ },
+ },
+ visualization_settings: {
+ "graph.show_goal": true,
+ "graph.goal_value": 40,
+ "graph.goal_label": "Target",
+ },
+ });
+
+ cy.findByTestId("goal-line-marker").trigger("mouseover");
+
+ H.tooltip().within(() => {
+ cy.findByText("Target:").should("be.visible");
+ cy.findByText("40").should("be.visible");
+ });
+ });
});
diff --git a/e2e/test/scenarios/visualizations/charts/scalar.cy.spec.ts b/e2e/test/scenarios/visualizations/charts/scalar.cy.spec.ts
index 55c9ce23e0c..58f6138c223 100644
--- a/e2e/test/scenarios/visualizations/charts/scalar.cy.spec.ts
+++ b/e2e/test/scenarios/visualizations/charts/scalar.cy.spec.ts
@@ -115,8 +115,10 @@ describe("scenarios > visualizations > scalar", () => {
H.openVizSettingsSidebar();
H.sidebar().findByText("Date style").should("be.visible");
- H.sidebar().findByText("Show the time").should("be.hidden");
- H.sidebar().findByText("Time style").should("be.hidden");
+ H.leftSidebar().within(() => {
+ cy.findByText("Show the time").should("not.exist");
+ cy.findByText("Time style").should("not.exist");
+ });
});
it("should not auto-select chart type when opening and saving a native question with parameters that have default values (metabase#33208)", () => {
diff --git a/e2e/test/scenarios/visualizations/charts/smartscalar-trend.cy.spec.js b/e2e/test/scenarios/visualizations/charts/smartscalar-trend.cy.spec.js
index 878fd1a6710..776eb913354 100644
--- a/e2e/test/scenarios/visualizations/charts/smartscalar-trend.cy.spec.js
+++ b/e2e/test/scenarios/visualizations/charts/smartscalar-trend.cy.spec.js
@@ -608,8 +608,8 @@ describe("scenarios > visualizations > trend chart (SmartScalar)", () => {
cy.findByTestId("scalar-period").findByText("2024").should("be.visible");
H.popover().within(() => {
cy.findByText("Date granularity").should("be.visible");
- cy.findByText("Date style").should("not.be.visible");
- cy.findByText("Show the time").should("not.be.visible");
+ cy.findByText("Date style").should("not.exist");
+ cy.findByText("Show the time").should("not.exist");
});
cy.log("quarter and month granularities keep the relevant period");
diff --git a/e2e/test/scenarios/visualizations/charts/trendline.cy.spec.js b/e2e/test/scenarios/visualizations/charts/trendline.cy.spec.js
index 81ae83dc25c..46ceaa34ad7 100644
--- a/e2e/test/scenarios/visualizations/charts/trendline.cy.spec.js
+++ b/e2e/test/scenarios/visualizations/charts/trendline.cy.spec.js
@@ -28,18 +28,49 @@ describe("scenarios > question > trendline", () => {
cy.findByText("Display").click();
cy.findByText("Trend line").click();
});
+
+ cy.log("global customization is hidden when there are multiple series");
+ H.leftSidebar().within(() => {
+ cy.findByText("Trend line color").should("not.exist");
+ cy.findByText("Trend line style").should("not.exist");
+ });
H.trendLine().should("have.length", 2);
+ cy.log("trend lines are customized in the series settings popover");
H.leftSidebar().within(() => {
cy.findByText("Data").click();
cy.findByTestId("settings-avg").click();
});
H.popover().within(() => {
- cy.findByText("Show trend line for this series").click();
+ cy.findByText("Trend line color").should("be.visible");
+ cy.findByText("Trend line style").should("be.visible");
+ cy.findByTestId("chart-settings-widget-trendline.style")
+ .icon("line_style_dashed")
+ .click();
});
- H.trendLine().should("have.length", 1);
+ H.trendLine().filter("[stroke-dasharray]").should("have.length", 1);
+
+ cy.log("pick a custom color for this series trend line");
+ H.leftSidebar().findByTestId("settings-avg").click();
+ // #8A5EB0 is the default trend line color, the shade of the avg series
+ H.popover().findByLabelText("#8A5EB0").click();
+ cy.findByTestId("color-selector-popover")
+ .findByLabelText("#509EE3")
+ .click();
+ H.trendLine()
+ .filter("[stroke='#509EE3']")
+ .should("have.length", 1)
+ .and("have.attr", "stroke-dasharray");
+ cy.log("hiding the series trend line hides its customization settings");
+ H.leftSidebar().findByTestId("settings-avg").click();
+ H.popover().findByText("Show trend line for this series").click();
+ H.trendLine().should("have.length", 1);
+ H.leftSidebar().findByTestId("settings-avg").click();
H.popover().within(() => {
+ cy.findByText("Show trend line for this series").should("be.visible");
+ cy.findByText("Trend line color").should("not.exist");
+ cy.findByText("Trend line style").should("not.exist");
cy.findByText("Show trend line for this series").click();
});
H.trendLine().should("have.length", 2);
@@ -57,7 +88,47 @@ describe("scenarios > question > trendline", () => {
cy.findByText("Done").click();
});
H.trendLine().should("have.length", 1);
- H.cartesianChartCircle().should("exist");
+ H.cartesianChartCircle().should("be.visible");
+ });
+
+ it("should allow customizing the trend line color and style", () => {
+ setup({
+ name: "Trend line customization",
+ query: {
+ "source-table": ORDERS_ID,
+ aggregation: [["count"]],
+ breakout: [["field", ORDERS.CREATED_AT, { "temporal-unit": "year" }]],
+ },
+ display: "line",
+ });
+
+ cy.log("color and style settings appear only when the trend line is on");
+ H.openVizSettingsSidebar();
+ H.leftSidebar().within(() => {
+ cy.findByText("Display").click();
+ cy.findByText("Trend line color").should("not.exist");
+ cy.findByText("Trend line style").should("not.exist");
+ cy.findByText("Trend line").click();
+ cy.findByText("Trend line color").should("be.visible");
+ cy.findByText("Trend line style").should("be.visible");
+ });
+
+ cy.log("by default the trend line is solid and uses the series shade");
+ H.trendLine()
+ .should("be.visible")
+ .and("have.attr", "stroke", "#227FD2")
+ .and("not.have.attr", "stroke-dasharray");
+
+ cy.log("changing the style renders a dashed trend line");
+ H.leftSidebar().within(() => {
+ cy.icon("line_style_dashed").click();
+ });
+ H.trendLine().should("be.visible").and("have.attr", "stroke-dasharray");
+
+ cy.log("changing the color applies it to the trend line");
+ H.leftSidebar().findByLabelText("#227FD2").click();
+ H.popover().findByLabelText("#88BF4D").click();
+ H.trendLine().should("be.visible").and("have.attr", "stroke", "#88BF4D");
});
it("should display trend line for stack-100% chart (metabase#25614)", () => {
diff --git a/e2e/test/scenarios/visualizations/charts/waterfall.cy.spec.js b/e2e/test/scenarios/visualizations/charts/waterfall.cy.spec.js
index e43106ac878..f08d1acc8e8 100644
--- a/e2e/test/scenarios/visualizations/charts/waterfall.cy.spec.js
+++ b/e2e/test/scenarios/visualizations/charts/waterfall.cy.spec.js
@@ -167,8 +167,8 @@ describe("scenarios > visualizations > waterfall", () => {
});
// y-axis labels (some)
- ["0", "300,000", "900,000", "1,800,000"].forEach((label) => {
- cy.findByText(label).should("exist");
+ ["0", "450.0k", "900.0k", "1.8M"].forEach((label) => {
+ cy.findByText(label).should("be.visible");
});
});
}
@@ -404,8 +404,35 @@ describe("scenarios > visualizations > waterfall", () => {
cy.findByLabelText("Goal label").clear().type("Target");
});
- H.echartsContainer().findByText("Target").should("exist");
H.goalLine().should("exist");
+ H.goalLineMarker().should("be.visible");
+ });
+
+ it("should show the goal in a tooltip when hovering the goal marker", () => {
+ H.visitQuestionAdhoc({
+ display: "waterfall",
+ dataset_query: {
+ type: "query",
+ database: SAMPLE_DB_ID,
+ query: {
+ "source-table": ORDERS_ID,
+ aggregation: [["count"], ["sum", ["field-id", ORDERS.TOTAL]]],
+ breakout: [["field", ORDERS.CREATED_AT, { "temporal-unit": "year" }]],
+ },
+ },
+ visualization_settings: {
+ "graph.show_goal": true,
+ "graph.goal_value": 11000,
+ "graph.goal_label": "Target",
+ },
+ });
+
+ H.goalLineMarker().trigger("mousemove");
+
+ H.tooltip().within(() => {
+ cy.findByText("Target:").should("be.visible");
+ cy.findByText("11,000").should("be.visible");
+ });
});
describe("scenarios > visualizations > waterfall settings", () => {
diff --git a/e2e/test/scenarios/visualizations/drillthroughs/chart_drill.cy.spec.js b/e2e/test/scenarios/visualizations/drillthroughs/chart_drill.cy.spec.js
index b24e6efab2e..0da1e6c7004 100644
--- a/e2e/test/scenarios/visualizations/drillthroughs/chart_drill.cy.spec.js
+++ b/e2e/test/scenarios/visualizations/drillthroughs/chart_drill.cy.spec.js
@@ -69,11 +69,7 @@ describe("scenarios > visualizations > drillthroughs > chart drill", () => {
H.echartsTriggerBlur();
cy.wait(100); // wait to avoid grabbing the svg before the chart redraws
- cy.log("Zoom-in on the left side, which corresponds to July 2025");
- cy.findByTestId("query-visualization-root") // drag across to filter
- .trigger("mousedown", 120, 200)
- .trigger("mousemove", 230, 200)
- .trigger("mouseup", 230, 200);
+ H.applyBrushToPoints(1, 3);
// Note: Test was flaking because apparently mouseup doesn't always happen at the same position.
// It is enough that we assert that the filter exists.
@@ -119,12 +115,7 @@ describe("scenarios > visualizations > drillthroughs > chart drill", () => {
cy.findByLabelText("Legend").findByText("Gadget").should("exist");
H.echartsContainer().findByText(/Count/).should("exist");
});
- cy.wait(100); // wait to avoid grabbing the svg before the chart redraws
-
- cy.findByTestId("query-visualization-root")
- .trigger("mousedown", 240, 200)
- .trigger("mousemove", 420, 200)
- .trigger("mouseup", 420, 200);
+ H.applyBrushToPoints(5, 10);
cy.wait("@dataset").its("response.body.error").should("not.exist");
diff --git a/e2e/test/scenarios/visualizations/tabular/pivot_tables.cy.spec.js b/e2e/test/scenarios/visualizations/tabular/pivot_tables.cy.spec.js
index 4cbd6aa4f0a..563840ac670 100644
--- a/e2e/test/scenarios/visualizations/tabular/pivot_tables.cy.spec.js
+++ b/e2e/test/scenarios/visualizations/tabular/pivot_tables.cy.spec.js
@@ -477,8 +477,7 @@ describe("scenarios > visualizations > pivot tables", { tags: "@slow" }, () => {
// Confirm that Product -> Category doesn't have the option to hide subtotals
openColumnSettings("Product → Category");
- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage
- cy.findByText("Show totals").should("not.be.visible");
+ H.popover().findByText("Show totals").should("not.exist");
// turn off subtotals for User -> Source
openColumnSettings("User → Source");
@@ -648,8 +647,7 @@ WHERE NOT (
cy.findByText("Separator style");
cy.log("Value fields cannot be sorted");
- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage
- cy.findByText(/Sort order/).should("not.be.visible");
+ H.popover().findByText("Sort order").should("not.exist");
cy.log("Change the value formatting");
cy.findByDisplayValue("Normal").click();
diff --git a/e2e/test/scenarios/visualizer/cartesian.cy.spec.ts b/e2e/test/scenarios/visualizer/cartesian.cy.spec.ts
index 4841bf5653e..4b51f1d2733 100644
--- a/e2e/test/scenarios/visualizer/cartesian.cy.spec.ts
+++ b/e2e/test/scenarios/visualizer/cartesian.cy.spec.ts
@@ -227,6 +227,11 @@ describe("scenarios > visualizer > cartesian", () => {
});
H.saveDashcardVisualizerModal({ mode: "create" });
+
+ // the new dashcard is below the minimum size for showing a legend,
+ // so enlarge it before asserting on the legend items
+ H.resizeDashboardCard({ card: H.getDashboardCard(0), x: 2000, y: 600 });
+
// Wait for card queries before saving the dashboard
H.getDashboardCard(0).within(() => {
cy.findByText(PRODUCTS_COUNT_BY_CREATED_AT.name).should("exist");
@@ -583,8 +588,8 @@ describe("scenarios > visualizer > cartesian", () => {
cy.findByText("Doohickey").should("exist");
cy.findByText("Widget").should("exist");
// y-axis labels
- cy.findByText("6,000").should("exist");
- cy.findByText("1,000").should("exist");
+ cy.findByText("6.0k").should("be.visible");
+ cy.findByText("3.0k").should("be.visible");
});
H.dataSource(Q1_NAME).should("exist");
diff --git a/e2e/test/scenarios/visualizer/drillthrough.cy.spec.ts b/e2e/test/scenarios/visualizer/drillthrough.cy.spec.ts
index 339c310ea58..03344f48d78 100644
--- a/e2e/test/scenarios/visualizer/drillthrough.cy.spec.ts
+++ b/e2e/test/scenarios/visualizer/drillthrough.cy.spec.ts
@@ -76,8 +76,14 @@ describe("scenarios > visualizer > drillthrough", () => {
// ...but works for single-series ones
H.getDashboardCard(3).within(() => {
- cy.findByText(PRODUCTS_COUNT_BY_CREATED_AT.name).should("exist");
- H.applyBrush(200, 300);
+ cy.findByText(PRODUCTS_COUNT_BY_CREATED_AT.name).should("be.visible");
+ const MAY_2026_POINT_INDEX = 13;
+ const FEB_2027_POINT_INDEX = 22;
+ H.applyBrushToPoints(
+ MAY_2026_POINT_INDEX,
+ FEB_2027_POINT_INDEX,
+ H.chartPathWithFillColor("#509EE3"),
+ );
cy.wait("@dataset");
});
cy.get("@dataset.all").should("have.length", 1);
diff --git a/frontend/src/embedding-sdk-bundle/components/private/SdkThemeProvider.cartesian.unit.spec.tsx b/frontend/src/embedding-sdk-bundle/components/private/SdkThemeProvider.cartesian.unit.spec.tsx
new file mode 100644
index 00000000000..5961282035a
--- /dev/null
+++ b/frontend/src/embedding-sdk-bundle/components/private/SdkThemeProvider.cartesian.unit.spec.tsx
@@ -0,0 +1,179 @@
+import { renderWithProviders, screen } from "__support__/ui";
+import { ensureMetabaseProviderPropsStore } from "embedding-sdk-shared/lib/ensure-metabase-provider-props-store";
+import type { MetabaseEmbeddingTheme } from "metabase/embedding-sdk/theme";
+import { getMetabaseSdkCssVariables } from "metabase/styled-components/theme/css-variables";
+import { useMantineTheme } from "metabase/ui";
+import { getDarkTheme, getLightTheme } from "metabase/ui/colors";
+import { useBrowserRenderingContext } from "metabase/visualizations/hooks/use-browser-rendering-context";
+
+import { SdkThemeProvider } from "./SdkThemeProvider";
+
+const LIGHT_AXIS_COLOR = getLightTheme().colors["chart-axis"];
+const DARK_AXIS_COLOR = getDarkTheme().colors["chart-axis"];
+
+function CartesianThemeProbe() {
+ const theme = useMantineTheme();
+ const { getColor, theme: visualizationTheme } = useBrowserRenderingContext({
+ fontFamily: "Lato",
+ });
+ const variables = getMetabaseSdkCssVariables({ theme, font: "Lato" });
+ const axisCssColor = Array.from(
+ variables.styles.matchAll(/--mb-color-chart-axis:\s*([^;]+);/g),
+ ).at(-1)?.[1];
+
+ return (
+ <>
+ <output data-testid="axis-color">{getColor("chart-axis")}</output>
+ <output data-testid="css-axis-color">{axisCssColor}</output>
+ <output data-testid="gridline-color">
+ {visualizationTheme.cartesian.splitLine.lineStyle.color}
+ </output>
+ <output data-testid="tick-font-size">
+ {visualizationTheme.cartesian.ticks.fontSize}
+ </output>
+ <output data-testid="variables">{variables.styles}</output>
+ </>
+ );
+}
+
+function setup(theme?: MetabaseEmbeddingTheme) {
+ return renderWithProviders(
+ <SdkThemeProvider theme={theme}>
+ <CartesianThemeProbe />
+ </SdkThemeProvider>,
+ );
+}
+
+describe("SDK Cartesian colors", () => {
+ beforeEach(() => {
+ ensureMetabaseProviderPropsStore().cleanup();
+ });
+
+ it.each<{
+ name: string;
+ theme?: MetabaseEmbeddingTheme;
+ axisColor: string;
+ }>([
+ { name: "default", axisColor: LIGHT_AXIS_COLOR },
+ {
+ name: "light preset",
+ theme: { preset: "light" },
+ axisColor: LIGHT_AXIS_COLOR,
+ },
+ {
+ name: "dark preset",
+ theme: { preset: "dark" },
+ axisColor: DARK_AXIS_COLOR,
+ },
+ {
+ name: "dark V1 background",
+ theme: { colors: { background: "#111111" } },
+ axisColor: DARK_AXIS_COLOR,
+ },
+ {
+ name: "dark V2 background",
+ theme: { version: 2, colors: { "background_page-primary": "#111111" } },
+ axisColor: DARK_AXIS_COLOR,
+ },
+ {
+ name: "explicit V2 chart axis",
+ theme: { version: 2, colors: { "chart-axis": "#456789" } },
+ axisColor: "#456789",
+ },
+ {
+ name: "V2 chart axis overriding a border color",
+ theme: {
+ version: 2,
+ colors: { border: "#123456", "chart-axis": "#456789" },
+ },
+ axisColor: "#456789",
+ },
+ ])("shares the axis token in the $name theme", ({ theme, axisColor }) => {
+ setup(theme);
+
+ expect(screen.getByTestId("axis-color")).toHaveTextContent(axisColor);
+ expect(screen.getByTestId("gridline-color")).toHaveTextContent(
+ "var(--mb-color-chart-axis)",
+ );
+ expect(screen.getByTestId("css-axis-color")).toHaveTextContent(axisColor);
+ expect(screen.getByTestId("variables")).not.toHaveTextContent(
+ "--mb-color-cartesian-grid-line",
+ );
+ });
+
+ it.each<{
+ name: string;
+ theme: MetabaseEmbeddingTheme;
+ gridlineColor: string;
+ }>([
+ {
+ name: "light V1",
+ theme: { colors: { border: "#123456" } },
+ gridlineColor: "rgba(18, 52, 86, 0.5)",
+ },
+ {
+ name: "dark V1",
+ theme: { colors: { border: "#123456", background: "#111111" } },
+ gridlineColor: "#123456",
+ },
+ {
+ name: "light V2",
+ theme: { version: 2, colors: { border: "#123456" } },
+ gridlineColor: "rgba(18, 52, 86, 0.5)",
+ },
+ {
+ name: "dark V2",
+ theme: {
+ version: 2,
+ colors: { border: "#123456", "background_page-primary": "#111111" },
+ },
+ gridlineColor: "#123456",
+ },
+ ])("preserves custom borders in $name", ({ theme, gridlineColor }) => {
+ setup(theme);
+
+ expect(screen.getByTestId("axis-color")).toHaveTextContent("#123456");
+ expect(screen.getByTestId("gridline-color")).toHaveTextContent(
+ gridlineColor,
+ );
+ expect(screen.getByTestId("css-axis-color")).toHaveTextContent("#123456");
+ });
+
+ it("keeps gridline overrides separate from axis colors and font sizes", () => {
+ setup({
+ colors: { border: "#123456" },
+ components: {
+ cartesian: {
+ label: { fontSize: "18px" },
+ splitLine: { lineStyle: { color: "#abcdef" } },
+ },
+ },
+ });
+
+ expect(screen.getByTestId("axis-color")).toHaveTextContent("#123456");
+ expect(screen.getByTestId("gridline-color")).toHaveTextContent("#abcdef");
+ expect(screen.getByTestId("tick-font-size")).toHaveTextContent("18");
+ });
+
+ it("restores defaults when a customer removes their border override", () => {
+ const { rerender } = setup({ colors: { border: "#123456" } });
+
+ expect(screen.getByTestId("axis-color")).toHaveTextContent("#123456");
+
+ rerender(
+ <SdkThemeProvider theme={{}}>
+ <CartesianThemeProbe />
+ </SdkThemeProvider>,
+ );
+
+ expect(screen.getByTestId("axis-color")).toHaveTextContent(
+ LIGHT_AXIS_COLOR,
+ );
+ expect(screen.getByTestId("css-axis-color")).toHaveTextContent(
+ LIGHT_AXIS_COLOR,
+ );
+ expect(screen.getByTestId("gridline-color")).toHaveTextContent(
+ "var(--mb-color-chart-axis)",
+ );
+ });
+});
diff --git a/frontend/src/embedding-sdk-bundle/hooks/private/use-embedding-theme-override.ts b/frontend/src/embedding-sdk-bundle/hooks/private/use-embedding-theme-override.ts
index 2b23624bc94..ff16b9ebf82 100644
--- a/frontend/src/embedding-sdk-bundle/hooks/private/use-embedding-theme-override.ts
+++ b/frontend/src/embedding-sdk-bundle/hooks/private/use-embedding-theme-override.ts
@@ -9,11 +9,15 @@ import {
isEmbeddingThemeV1,
isEmbeddingThemeV2,
} from "metabase/embedding-sdk/theme";
+import { getEmbeddingCartesianColors } from "metabase/embedding-sdk/theme/cartesian-colors";
import { setGlobalEmbeddingColors } from "metabase/embedding-sdk/theme/embedding-color-palette";
import { useSelector } from "metabase/redux";
import { useSetting } from "metabase/settings";
import { getFont } from "metabase/styled-components/selectors";
-import type { MantineThemeOverride } from "metabase/ui";
+import {
+ DEFAULT_METABASE_COMPONENT_THEME,
+ type MantineThemeOverride,
+} from "metabase/ui";
import { deriveFullMetabaseTheme } from "metabase/ui/colors";
import { getColorShades } from "metabase/ui/utils/colors";
@@ -34,11 +38,7 @@ export function useEmbeddingThemeOverride(
// This must be done before ThemeProvider calls getThemeOverrides.
setGlobalEmbeddingColors(themeWithPreset?.colors, appColors ?? {});
- return getEmbeddingThemeOverride(
- themeWithPreset || {},
- font,
- appColors ?? {},
- );
+ return getEmbeddingThemeOverride(theme || {}, font, appColors ?? {});
}
// We must include Modular Embedding specific overrides for portals (e.g. popover and modal) to target the correct portal id
@@ -50,6 +50,12 @@ export function useEmbeddingThemeOverride(
whitelabelColors: appColors ?? {},
embeddingThemeOverride: theme,
});
+ const { axisColor, gridlineColor } = getEmbeddingCartesianColors({
+ background: derivedTheme.colors["background_page-primary"],
+ foreground: derivedTheme.colors["text-primary"],
+ border: theme.colors?.border,
+ axis: theme.colors?.["chart-axis"],
+ });
// Convert derived colors to Mantine color tuples
const colors = Object.fromEntries(
@@ -59,7 +65,17 @@ export function useEmbeddingThemeOverride(
]),
);
- return { colors, fontFamily: font ?? DEFAULT_FONT, components };
+ return {
+ colors: { ...colors, "chart-axis": getColorShades(axisColor) },
+ fontFamily: font ?? DEFAULT_FONT,
+ components,
+ other: {
+ cartesian: {
+ ...DEFAULT_METABASE_COMPONENT_THEME.cartesian,
+ splitLine: { lineStyle: { color: gridlineColor } },
+ },
+ },
+ };
}
// No theme provided: just return the component overrides for portals
diff --git a/frontend/src/embedding-sdk-bundle/lib/theme/get-embedding-theme.ts b/frontend/src/embedding-sdk-bundle/lib/theme/get-embedding-theme.ts
index 133c2eb62ae..8f5d3f74952 100644
--- a/frontend/src/embedding-sdk-bundle/lib/theme/get-embedding-theme.ts
+++ b/frontend/src/embedding-sdk-bundle/lib/theme/get-embedding-theme.ts
@@ -2,6 +2,7 @@ import { merge } from "icepick";
import _ from "underscore";
import { DEFAULT_FONT } from "embedding-sdk-bundle/config";
+import { applyThemePreset } from "embedding-sdk-shared/lib/apply-theme-preset";
import type {
MetabaseColor,
MetabaseComponentTheme,
@@ -12,6 +13,7 @@ import {
DEFAULT_SDK_FONT_SIZE,
getEmbeddingComponentOverrides,
} from "metabase/embedding-sdk/theme";
+import { getEmbeddingCartesianColors } from "metabase/embedding-sdk/theme/cartesian-colors";
import type { MappableSdkColor } from "metabase/embedding-sdk/theme/embedding-color-palette";
import {
SDK_MISSING_COLORS_FALLBACK,
@@ -41,12 +43,20 @@ const stripUndefinedKeys = <T>(x: T): unknown =>
* into a Mantine theme override for internal use.
*/
export function getEmbeddingThemeOverride(
- theme: MetabaseTheme,
+ userTheme: MetabaseTheme,
font: string | undefined,
whitelabeledColors?: ColorSettings | undefined,
): MantineThemeOverride {
+ const theme = applyThemePreset(userTheme) ?? userTheme;
+ const { axisColor, gridlineColor } = getEmbeddingCartesianColors({
+ background: theme.colors?.background,
+ foreground: theme.colors?.["text-primary"],
+ border: userTheme.colors?.border,
+ });
const components: MetabaseComponentTheme = merge(
- DEFAULT_EMBEDDED_COMPONENT_THEME,
+ merge(DEFAULT_EMBEDDED_COMPONENT_THEME, {
+ cartesian: { splitLine: { lineStyle: { color: gridlineColor } } },
+ }),
stripUndefinedKeys(theme.components),
);
@@ -60,10 +70,13 @@ export function getEmbeddingThemeOverride(
other: {
...components,
fontSize: theme.fontSize ?? SDK_BASE_FONT_SIZE,
+ hasCustomChartFontSize:
+ theme.fontSize !== undefined ||
+ theme.components?.cartesian?.label?.fontSize !== undefined,
},
components: getEmbeddingComponentOverrides(),
- colors: {},
+ colors: { "chart-axis": colorTuple(axisColor) },
};
// Apply whitelabeled colors from appearance settings
diff --git a/frontend/src/embedding-sdk-bundle/lib/theme/get-embedding-theme.unit.spec.ts b/frontend/src/embedding-sdk-bundle/lib/theme/get-embedding-theme.unit.spec.ts
index b553ff51206..561fc92e271 100644
--- a/frontend/src/embedding-sdk-bundle/lib/theme/get-embedding-theme.unit.spec.ts
+++ b/frontend/src/embedding-sdk-bundle/lib/theme/get-embedding-theme.unit.spec.ts
@@ -2,6 +2,7 @@ import {
DEFAULT_EMBEDDED_COMPONENT_THEME,
getEmbeddingComponentOverrides,
} from "metabase/embedding-sdk/theme";
+import { getDarkTheme, getLightTheme } from "metabase/ui/colors";
import { getEmbeddingThemeOverride } from "./get-embedding-theme";
@@ -37,6 +38,9 @@ describe("Transform Embedding Theme Override", () => {
lineHeight: 1.5,
fontFamily: "Roboto",
colors: {
+ "chart-axis": expect.arrayContaining([
+ getLightTheme().colors["chart-axis"],
+ ]),
brand: expect.arrayContaining(["hotpink"]),
"core-brand": expect.arrayContaining(["hotpink"]),
"text-primary": expect.arrayContaining(["yellow"]),
@@ -49,6 +53,7 @@ describe("Transform Embedding Theme Override", () => {
"button_label-subtle-neutral-default": expect.arrayContaining([
"yellow",
]),
+ "icon-primary": expect.arrayContaining(["yellow"]),
"text-tertiary": expect.arrayContaining(["green"]),
"text-disabled": expect.arrayContaining(["green"]),
"background-primary": expect.arrayContaining(["orange"]),
@@ -69,6 +74,7 @@ describe("Transform Embedding Theme Override", () => {
},
other: {
fontSize: "2rem",
+ hasCustomChartFontSize: true,
...DEFAULT_EMBEDDED_COMPONENT_THEME,
},
components: getEmbeddingComponentOverrides(),
@@ -84,6 +90,9 @@ describe("Transform Embedding Theme Override", () => {
expect(theme).toEqual({
fontFamily: "Roboto",
colors: {
+ "chart-axis": expect.arrayContaining([
+ getDarkTheme().colors["chart-axis"],
+ ]),
"background-primary": expect.arrayContaining(["green"]),
"background_page-primary": expect.arrayContaining(["green"]),
"background_surface-primary": expect.arrayContaining(["green"]),
@@ -93,8 +102,36 @@ describe("Transform Embedding Theme Override", () => {
"background_page-secondary": expect.arrayContaining(["green"]),
"background_page-tertiary": expect.arrayContaining(["green"]),
},
- other: { fontSize: "14px", ...DEFAULT_EMBEDDED_COMPONENT_THEME },
+ other: {
+ fontSize: "14px",
+ hasCustomChartFontSize: false,
+ ...DEFAULT_EMBEDDED_COMPONENT_THEME,
+ },
components: getEmbeddingComponentOverrides(),
});
});
+
+ it.each(["13px", DEFAULT_EMBEDDED_COMPONENT_THEME.cartesian.label.fontSize])(
+ "preserves an explicit chart label font size of %s",
+ (fontSize) => {
+ const theme = getEmbeddingThemeOverride(
+ { components: { cartesian: { label: { fontSize } } } },
+ undefined,
+ );
+
+ expect(theme.other).toMatchObject({
+ hasCustomChartFontSize: true,
+ cartesian: { label: { fontSize } },
+ });
+ },
+ );
+
+ it("preserves an explicit base font size matching the default", () => {
+ const theme = getEmbeddingThemeOverride({ fontSize: "14px" }, undefined);
+
+ expect(theme.other).toMatchObject({
+ fontSize: "14px",
+ hasCustomChartFontSize: true,
+ });
+ });
});
diff --git a/frontend/src/metabase-types/api/card.ts b/frontend/src/metabase-types/api/card.ts
index 4266c41247c..14c18ec4b36 100644
--- a/frontend/src/metabase-types/api/card.ts
+++ b/frontend/src/metabase-types/api/card.ts
@@ -145,6 +145,8 @@ export interface UnsavedCard<Q extends DatasetQuery = DatasetQuery> {
export type LineSize = "S" | "M" | "L";
+export type LineStyle = "solid" | "dashed" | "dotted";
+
export type SeriesSettings = {
title?: string;
color?: string;
@@ -154,11 +156,13 @@ export type SeriesSettings = {
display?: VisualizationDisplay;
axis?: string;
"line.size"?: LineSize;
- "line.style"?: "solid" | "dashed" | "dotted";
+ "line.style"?: LineStyle;
"line.interpolate"?: string;
"line.marker_enabled"?: boolean;
"line.missing"?: string;
show_series_trendline?: boolean;
+ "trendline.color"?: string;
+ "trendline.style"?: LineStyle;
};
export type SeriesOrderSetting = {
@@ -357,6 +361,9 @@ export type VisualizationSettings = {
*/
column_settings?: Record<string, ColumnSettings>;
+ /** Show the x-axis title. `"auto"` hides it on short cards. */
+ "graph.x_axis.labels_enabled"?: boolean | "auto";
+
/** Override the x-axis label. */
"graph.x_axis.title_text"?: string;
@@ -374,6 +381,9 @@ export type VisualizationSettings = {
/** Let Metabase choose the y-axis bounds automatically. */
"graph.y_axis.auto_range"?: boolean;
+ /** Show the y-axis title. `"auto"` hides it on narrow cards. */
+ "graph.y_axis.labels_enabled"?: boolean | "auto";
+
/** Override the y-axis label. On a split chart this labels the left axis. */
"graph.y_axis.title_text"?: string;
diff --git a/frontend/src/metabase-types/api/embedding-theme.ts b/frontend/src/metabase-types/api/embedding-theme.ts
index 643486b5389..ed2e582ff7a 100644
--- a/frontend/src/metabase-types/api/embedding-theme.ts
+++ b/frontend/src/metabase-types/api/embedding-theme.ts
@@ -216,7 +216,10 @@ export type MetabaseComponentTheme = {
goalLine: {
label: {
- /** Font size of goal line labels */
+ /**
+ * Font size of goal line labels
+ * @deprecated Has no effect, goal line labels are not shown on interactive charts.
+ */
fontSize: string;
};
};
diff --git a/frontend/src/metabase-types/guards/card.ts b/frontend/src/metabase-types/guards/card.ts
index 9c7e87720c4..cd897bcadee 100644
--- a/frontend/src/metabase-types/guards/card.ts
+++ b/frontend/src/metabase-types/guards/card.ts
@@ -1,5 +1,11 @@
-import type { Card, UnsavedCard } from "metabase-types/api";
+import type { Card, LineStyle, UnsavedCard } from "metabase-types/api";
export function isSavedCard(card: Card | UnsavedCard): card is Card {
return "id" in card && card.id != null;
}
+
+const LINE_STYLES: LineStyle[] = ["solid", "dashed", "dotted"];
+
+export function isLineStyle(value: string): value is LineStyle {
+ return LINE_STYLES.some((style) => style === value);
+}
diff --git a/frontend/src/metabase/dashboard/components/DashCard/DashCardVisualization.tsx b/frontend/src/metabase/dashboard/components/DashCard/DashCardVisualization.tsx
index b6dde03f129..8976ccacc78 100644
--- a/frontend/src/metabase/dashboard/components/DashCard/DashCardVisualization.tsx
+++ b/frontend/src/metabase/dashboard/components/DashCard/DashCardVisualization.tsx
@@ -678,7 +678,6 @@ export function DashCardVisualization({
onTimelineEventsEnabledChange={handleTimelineEventsEnabledChange}
enableEntityNavigation={enableEntityNavigation}
onSameOriginNavigation={onSameOriginNavigation}
- autoAdjustSettings
/>
</EmbeddingEntityContextProvider>
</div>
diff --git a/frontend/src/metabase/dashboard/components/DashboardChartSettings/ChartNestedSettingSeriesMultiple.unit.spec.tsx b/frontend/src/metabase/dashboard/components/DashboardChartSettings/ChartNestedSettingSeriesMultiple.unit.spec.tsx
index 66fc584e17a..65594dbfcb3 100644
--- a/frontend/src/metabase/dashboard/components/DashboardChartSettings/ChartNestedSettingSeriesMultiple.unit.spec.tsx
+++ b/frontend/src/metabase/dashboard/components/DashboardChartSettings/ChartNestedSettingSeriesMultiple.unit.spec.tsx
@@ -21,13 +21,16 @@ function getSeries(
return {
card: createMockCard({
display,
- visualization_settings: changeSeriesName
- ? {
- series_settings: {
- [`Test ${index}`]: { title: `Test ${index} updated` },
- },
- }
- : {},
+ visualization_settings: {
+ "graph.show_values": true,
+ ...(changeSeriesName
+ ? {
+ series_settings: {
+ [`Test ${index}`]: { title: `Test ${index} updated` },
+ },
+ }
+ : {}),
+ },
name: `Test ${index}`,
}),
...createMockDataset({
diff --git a/frontend/src/metabase/dashboard/components/DashboardChartSettings/DashboardChartSettings.unit.spec.tsx b/frontend/src/metabase/dashboard/components/DashboardChartSettings/DashboardChartSettings.unit.spec.tsx
index da40435d373..f67f372bf8a 100644
--- a/frontend/src/metabase/dashboard/components/DashboardChartSettings/DashboardChartSettings.unit.spec.tsx
+++ b/frontend/src/metabase/dashboard/components/DashboardChartSettings/DashboardChartSettings.unit.spec.tsx
@@ -1,13 +1,18 @@
import userEvent from "@testing-library/user-event";
-import { renderWithProviders, screen } from "__support__/ui";
+import { renderWithProviders, screen, within } from "__support__/ui";
import { MockDashboardContext } from "metabase/dashboard/context/mock-context";
import { registerVisualizations } from "metabase/visualizations/register";
+import type { Series } from "metabase-types/api";
import {
createMockCard,
+ createMockColumn,
createMockDashboard,
createMockDashboardCard,
createMockDataset,
+ createMockDatasetData,
+ createMockInsight,
+ createMockSingleSeries,
createMockVisualizationSettings,
} from "metabase-types/api/mocks";
@@ -75,3 +80,70 @@ describe("DashboardChartSettings", () => {
});
});
});
+
+describe("DashboardChartSettings trend line customization", () => {
+ // the card name differs from the metric key so a write under the wrong key
+ // would be caught
+ const trendLineCard = createMockCard({
+ name: "Orders over time",
+ display: "line",
+ visualization_settings: {
+ "graph.dimensions": ["CREATED_AT"],
+ "graph.metrics": ["count"],
+ "graph.show_trendline": true,
+ },
+ });
+
+ const getTrendLineSeries = (): Series => [
+ createMockSingleSeries(trendLineCard, {
+ data: createMockDatasetData({
+ rows: [
+ ["2024-01-01T00:00:00Z", 1],
+ ["2024-02-01T00:00:00Z", 2],
+ ],
+ cols: [
+ createMockColumn({
+ name: "CREATED_AT",
+ display_name: "Created At",
+ base_type: "type/DateTime",
+ effective_type: "type/DateTime",
+ unit: "month",
+ }),
+ createMockColumn({
+ name: "count",
+ display_name: "Count",
+ base_type: "type/BigInteger",
+ effective_type: "type/BigInteger",
+ source: "aggregation",
+ }),
+ ],
+ insights: [createMockInsight({ col: "count" })],
+ }),
+ }),
+ ];
+
+ it("should save the single series trend line style into the dashcard series settings", async () => {
+ const onChange = jest.fn();
+ setup({
+ series: getTrendLineSeries(),
+ dashcard: createMockDashboardCard({ card: trendLineCard }),
+ settings: trendLineCard.visualization_settings,
+ onChange,
+ });
+
+ await userEvent.click(screen.getByRole("tab", { name: "Display" }));
+ await userEvent.click(
+ within(
+ screen.getByTestId("chart-settings-widget-graph.trendline_style"),
+ ).getByRole("button", { name: /line_style_dashed/i }),
+ );
+ await userEvent.click(screen.getByRole("button", { name: "Done" }));
+
+ const [settings] = onChange.mock.lastCall ?? [];
+ expect(settings).toMatchObject({
+ series_settings: { count: { "trendline.style": "dashed" } },
+ });
+ expect(Object.keys(settings.series_settings)).toEqual(["count"]);
+ expect(settings).not.toHaveProperty("graph.trendline_style");
+ });
+});
diff --git a/frontend/src/metabase/embedding-sdk/theme/cartesian-colors.ts b/frontend/src/metabase/embedding-sdk/theme/cartesian-colors.ts
new file mode 100644
index 00000000000..7b947aaeece
--- /dev/null
+++ b/frontend/src/metabase/embedding-sdk/theme/cartesian-colors.ts
@@ -0,0 +1,34 @@
+import { getDarkTheme, getLightTheme } from "metabase/ui/colors";
+
+import {
+ applyColorOperation,
+ getIsDarkThemeFromColors,
+} from "./dynamic-css-vars";
+
+export function getEmbeddingCartesianColors({
+ background,
+ foreground,
+ border,
+ axis,
+}: {
+ background?: string;
+ foreground?: string;
+ border?: string;
+ axis?: string;
+}) {
+ const isDarkTheme = getIsDarkThemeFromColors(background, foreground);
+ const theme = isDarkTheme ? getDarkTheme() : getLightTheme();
+ let gridlineColor = "var(--mb-color-chart-axis)";
+
+ if (border && axis === undefined) {
+ gridlineColor = applyColorOperation(border, {
+ source: "border",
+ alpha: isDarkTheme ? undefined : 0.5,
+ });
+ }
+
+ return {
+ axisColor: axis ?? border ?? theme.colors["chart-axis"],
+ gridlineColor,
+ };
+}
diff --git a/frontend/src/metabase/embedding-sdk/theme/default-component-theme.ts b/frontend/src/metabase/embedding-sdk/theme/default-component-theme.ts
index b28772a35ae..c181d50b208 100644
--- a/frontend/src/metabase/embedding-sdk/theme/default-component-theme.ts
+++ b/frontend/src/metabase/embedding-sdk/theme/default-component-theme.ts
@@ -88,7 +88,7 @@ export const DEFAULT_METABASE_COMPONENT_THEME: MetabaseComponentTheme = {
},
splitLine: {
lineStyle: {
- color: "var(--mb-color-cartesian-grid-line)",
+ color: "var(--mb-color-chart-axis)",
},
},
},
diff --git a/frontend/src/metabase/embedding-sdk/theme/dynamic-css-vars-config.ts b/frontend/src/metabase/embedding-sdk/theme/dynamic-css-vars-config.ts
index db1cfa7b8a6..56973889753 100644
--- a/frontend/src/metabase/embedding-sdk/theme/dynamic-css-vars-config.ts
+++ b/frontend/src/metabase/embedding-sdk/theme/dynamic-css-vars-config.ts
@@ -20,10 +20,6 @@ export const DYNAMIC_CSS_VARIABLES: DynamicCssVarConfig = {
light: { source: "background", darken: 0.1 },
dark: { source: "background", lighten: 0.4 },
},
- "--mb-color-cartesian-grid-line": {
- light: { source: "border", alpha: 0.5 },
- dark: { source: "border" },
- },
"--mb-color-table-border": {
light: { source: "border", alpha: 0.5 },
dark: { source: "border", alpha: 0.15 },
diff --git a/frontend/src/metabase/embedding-sdk/theme/dynamic-css-vars.ts b/frontend/src/metabase/embedding-sdk/theme/dynamic-css-vars.ts
index bd788a88e24..2a594e5cf76 100644
--- a/frontend/src/metabase/embedding-sdk/theme/dynamic-css-vars.ts
+++ b/frontend/src/metabase/embedding-sdk/theme/dynamic-css-vars.ts
@@ -4,6 +4,7 @@ import Color from "color";
import type { MantineTheme, MantineThemeOverride } from "metabase/ui";
import { isDark, isLight } from "metabase/ui/colors";
+import type { ResolvedColorScheme } from "metabase/utils/color-scheme";
import type { ColorOperation } from "../types/private/css-variables";
@@ -41,9 +42,17 @@ export function applyColorOperation(
* Determine if the current color scheme is dark based on the palette.
*/
export function getIsDarkThemeFromPalette(theme: MantineThemeOverride) {
- const backgroundColor = theme.fn?.themeColor?.("background_page-primary");
- const foregroundColor = theme.fn?.themeColor?.("text-primary");
+ return getIsDarkThemeFromColors(
+ theme.fn?.themeColor?.("background_page-primary"),
+ theme.fn?.themeColor?.("text-primary"),
+ );
+}
+export function getIsDarkThemeFromColors(
+ backgroundColor?: string,
+ foregroundColor?: string,
+ colorScheme: ResolvedColorScheme = "light",
+) {
// Dark background color indicates a dark theme.
if (isColorDefined(backgroundColor)) {
return isDark(backgroundColor);
@@ -54,7 +63,7 @@ export function getIsDarkThemeFromPalette(theme: MantineThemeOverride) {
return isLight(foregroundColor);
}
- return false;
+ return colorScheme === "dark";
}
/**
diff --git a/frontend/src/metabase/embedding-sdk/theme/embedding-color-palette.ts b/frontend/src/metabase/embedding-sdk/theme/embedding-color-palette.ts
index 6e7b6ebd141..c0fa9bcdae6 100644
--- a/frontend/src/metabase/embedding-sdk/theme/embedding-color-palette.ts
+++ b/frontend/src/metabase/embedding-sdk/theme/embedding-color-palette.ts
@@ -37,6 +37,7 @@ export const SDK_TO_MAIN_APP_COLORS_MAPPING: Record<
"button_label-default-neutral-default",
"button_label-light-neutral-default",
"button_label-subtle-neutral-default",
+ "icon-primary",
],
"text-secondary": ["text-secondary"],
"text-tertiary": ["text-tertiary", "text-disabled"],
diff --git a/frontend/src/metabase/explorations/components/ExplorationVisualization/ExplorationGroupVisualization.tsx b/frontend/src/metabase/explorations/components/ExplorationVisualization/ExplorationGroupVisualization.tsx
index 682d0dd1355..500a0fdd456 100644
--- a/frontend/src/metabase/explorations/components/ExplorationVisualization/ExplorationGroupVisualization.tsx
+++ b/frontend/src/metabase/explorations/components/ExplorationVisualization/ExplorationGroupVisualization.tsx
@@ -21,7 +21,6 @@ import {
} from "metabase/ui";
import { is403Error } from "metabase/utils/errors";
import Visualization from "metabase/visualizations/components/Visualization";
-import { LEGEND_ITEM_FONT_SIZE } from "metabase/visualizations/components/legend/LegendItem.styled";
import type { ClickActionsMode, OnBrush } from "metabase/visualizations/types";
import { type HighlightedObject, isCartesianChart } from "metabase/viz-core";
import type {
@@ -54,6 +53,8 @@ import {
resolveHighlightForSeries,
} from "./utils";
+const LEGEND_ITEM_FONT_SIZE = "0.928em";
+
interface ExplorationGroupVisualizationProps {
explorationId: ExplorationId;
page: ExplorationPageNode;
diff --git a/frontend/src/metabase/metrics-viewer/components/MetricsViewerVisualization/MetricsViewerVisualization.tsx b/frontend/src/metabase/metrics-viewer/components/MetricsViewerVisualization/MetricsViewerVisualization.tsx
index 4a9c44b3e71..378891911be 100644
--- a/frontend/src/metabase/metrics-viewer/components/MetricsViewerVisualization/MetricsViewerVisualization.tsx
+++ b/frontend/src/metabase/metrics-viewer/components/MetricsViewerVisualization/MetricsViewerVisualization.tsx
@@ -134,7 +134,6 @@ export function MetricsViewerVisualization({
onBrush={onBrush}
mode={clickActionsMode}
onChangeCardAndRun={noop}
- autoAdjustSettings
isMetricsViewer
/>
</DebouncedFrame>
diff --git a/frontend/src/metabase/static-viz/components/BoxPlotChart/BoxPlotChart.stories.tsx b/frontend/src/metabase/static-viz/components/BoxPlotChart/BoxPlotChart.stories.tsx
index 9f00ca7f25d..91873f774c1 100644
--- a/frontend/src/metabase/static-viz/components/BoxPlotChart/BoxPlotChart.stories.tsx
+++ b/frontend/src/metabase/static-viz/components/BoxPlotChart/BoxPlotChart.stories.tsx
@@ -35,6 +35,7 @@ const renderingContext: RenderingContext = {
measureTextWidth(text, Number(style.size), Number(style.weight)),
measureTextHeight: (_, style) => measureTextHeight(Number(style.size)),
fontFamily: "Lato",
+ isStatic: true,
theme: DEFAULT_VISUALIZATION_THEME,
};
diff --git a/frontend/src/metabase/static-viz/components/BoxPlotChart/BoxPlotChart.tsx b/frontend/src/metabase/static-viz/components/BoxPlotChart/BoxPlotChart.tsx
index 9db5bfd8072..c4d2010f885 100644
--- a/frontend/src/metabase/static-viz/components/BoxPlotChart/BoxPlotChart.tsx
+++ b/frontend/src/metabase/static-viz/components/BoxPlotChart/BoxPlotChart.tsx
@@ -3,13 +3,16 @@ import { init } from "echarts/core";
import type { StaticChartProps } from "metabase/static-viz/components/StaticVisualization";
import { readAllPointsOutOfRange } from "metabase/static-viz/lib/data-visibility";
+import { withCartesianChartSize } from "metabase/static-viz/lib/rendering-context";
import { sanitizeSvgForBatik } from "metabase/static-viz/lib/svg";
+import { STATIC_CARTESIAN_CHART_SIZE } from "metabase/static-viz/lib/utils";
import {
getBoxPlotLayoutModel,
getBoxPlotModel,
getBoxPlotOption,
getChartLayout,
getLegendItems,
+ getSizeAdjustedSettings,
registerEChartsModules,
} from "metabase/viz-core";
@@ -20,20 +23,35 @@ import { calculateLegendRows } from "../Legend/utils";
registerEChartsModules();
-const WIDTH = 540;
-const HEIGHT = 360;
const LEGEND_PADDING = 8;
export function BoxPlotChart({
rawSeries,
- settings,
- renderingContext,
- width = WIDTH,
- height = HEIGHT,
+ settings: originalSettings,
+ renderingContext: originalRenderingContext,
+ width = STATIC_CARTESIAN_CHART_SIZE.width,
+ height = STATIC_CARTESIAN_CHART_SIZE.height,
isStorybook = false,
hasDevWatermark = false,
+ gridSize,
}: StaticChartProps) {
- const chartModel = getBoxPlotModel(rawSeries, settings);
+ const renderingContext = withCartesianChartSize(originalRenderingContext, {
+ width,
+ height,
+ });
+ const settings = getSizeAdjustedSettings({
+ settings: originalSettings,
+ width,
+ height,
+ gridSize,
+ });
+ const chartModel = getBoxPlotModel(
+ rawSeries,
+ settings,
+ [],
+ undefined,
+ renderingContext.cartesianSize,
+ );
const legendItems = getLegendItems(chartModel.seriesModels);
const isReversed = settings["legend.is_reversed"];
diff --git a/frontend/src/metabase/static-viz/components/ComboChart/ComboChart.tsx b/frontend/src/metabase/static-viz/components/ComboChart/ComboChart.tsx
index fd45fd0b107..ea648094425 100644
--- a/frontend/src/metabase/static-viz/components/ComboChart/ComboChart.tsx
+++ b/frontend/src/metabase/static-viz/components/ComboChart/ComboChart.tsx
@@ -3,13 +3,18 @@ import { init } from "echarts/core";
import type { StaticChartProps } from "metabase/static-viz/components/StaticVisualization";
import { readAllPointsOutOfRange } from "metabase/static-viz/lib/data-visibility";
+import { withCartesianChartSize } from "metabase/static-viz/lib/rendering-context";
import { sanitizeSvgForBatik } from "metabase/static-viz/lib/svg";
-import { getChartHeight } from "metabase/static-viz/lib/utils";
+import {
+ STATIC_CARTESIAN_CHART_SIZE,
+ getChartHeight,
+} from "metabase/static-viz/lib/utils";
import {
getCartesianChartModel,
getCartesianChartOption,
getChartLayout,
getLegendItems,
+ getSizeAdjustedSettings,
registerEChartsModules,
} from "metabase/viz-core";
@@ -18,22 +23,31 @@ import { DataOutOfRangeOverlay } from "../DataOutOfRangeOverlay/DataOutOfRangeOv
import { Legend } from "../Legend";
import { calculateLegendRows } from "../Legend/utils";
-const WIDTH = 540;
-const HEIGHT = 360;
const LEGEND_PADDING = 8;
registerEChartsModules();
export const ComboChart = ({
rawSeries,
- settings,
- renderingContext,
- width = WIDTH,
- height = HEIGHT,
+ settings: originalSettings,
+ renderingContext: originalRenderingContext,
+ width = STATIC_CARTESIAN_CHART_SIZE.width,
+ height = STATIC_CARTESIAN_CHART_SIZE.height,
isStorybook = false,
hasDevWatermark = false,
fitWithinBounds = false,
+ gridSize,
}: StaticChartProps) => {
+ const renderingContext = withCartesianChartSize(originalRenderingContext, {
+ width,
+ height,
+ });
+ const settings = getSizeAdjustedSettings({
+ settings: originalSettings,
+ width,
+ height,
+ gridSize,
+ });
const chartModel = getCartesianChartModel(
rawSeries,
settings,
diff --git a/frontend/src/metabase/static-viz/components/ComboChart/stories/shared.tsx b/frontend/src/metabase/static-viz/components/ComboChart/stories/shared.tsx
index 99df3fc49d7..3ef27271558 100644
--- a/frontend/src/metabase/static-viz/components/ComboChart/stories/shared.tsx
+++ b/frontend/src/metabase/static-viz/components/ComboChart/stories/shared.tsx
@@ -27,5 +27,6 @@ export const renderingContext: RenderingContext = {
measureTextWidth(text, Number(style.size), Number(style.weight)),
measureTextHeight: (_, style) => measureTextHeight(Number(style.size)),
fontFamily: "Lato",
+ isStatic: true,
theme: DEFAULT_VISUALIZATION_THEME,
};
diff --git a/frontend/src/metabase/static-viz/components/FunnelBarChart/FunnelBarChart.stories.tsx b/frontend/src/metabase/static-viz/components/FunnelBarChart/FunnelBarChart.stories.tsx
index 9e6167c8ff7..d1e90ae6601 100644
--- a/frontend/src/metabase/static-viz/components/FunnelBarChart/FunnelBarChart.stories.tsx
+++ b/frontend/src/metabase/static-viz/components/FunnelBarChart/FunnelBarChart.stories.tsx
@@ -36,6 +36,7 @@ const renderingContext: RenderingContext = {
measureTextWidth(text, Number(style.size), Number(style.weight)),
measureTextHeight: (_, style) => measureTextHeight(Number(style.size)),
fontFamily: "Lato",
+ isStatic: true,
theme: DEFAULT_VISUALIZATION_THEME,
};
diff --git a/frontend/src/metabase/static-viz/components/Legend/Legend.tsx b/frontend/src/metabase/static-viz/components/Legend/Legend.tsx
index 9b0116beaaa..8b1402f35fe 100644
--- a/frontend/src/metabase/static-viz/components/Legend/Legend.tsx
+++ b/frontend/src/metabase/static-viz/components/Legend/Legend.tsx
@@ -1,7 +1,9 @@
import { Group } from "@visx/group";
+import Color from "color";
import { Text } from "metabase/static-viz/components/Text";
import { measureTextWidth } from "metabase/static-viz/lib/text";
+import { color as getColor } from "metabase/ui/colors";
import { truncateText } from "metabase/viz-core";
import {
@@ -30,12 +32,13 @@ export const Legend = ({
legendItemMarginRight = LEGEND_ITEM_MARGIN_RIGHT,
items,
}: LegendProps) => {
+ const markerBorder = Color(getColor("shadow-default"));
+
return (
<Group left={left} top={top}>
{items.map((item, index) => {
const { name: originalName, color, left, top, width, percent } = item;
- const radius = LEGEND_CIRCLE_SIZE / 2;
const textX = LEGEND_CIRCLE_SIZE + LEGEND_CIRCLE_MARGIN_RIGHT;
const percentTextWidth =
@@ -73,7 +76,17 @@ export const Legend = ({
return (
<Group left={left} top={top} key={index}>
- <circle fill={color} r={radius} cx={radius} cy={radius} />
+ <rect
+ x={0.25}
+ y={0.25}
+ width={LEGEND_CIRCLE_SIZE - 0.5}
+ height={LEGEND_CIRCLE_SIZE - 0.5}
+ rx={LEGEND_CIRCLE_SIZE * 0.32}
+ fill={color}
+ stroke={markerBorder.hex()}
+ strokeOpacity={markerBorder.alpha()}
+ strokeWidth={0.5}
+ />
<Text
textAnchor="start"
verticalAnchor="start"
diff --git a/frontend/src/metabase/static-viz/components/PieChart/PieChart.stories.tsx b/frontend/src/metabase/static-viz/components/PieChart/PieChart.stories.tsx
index 1edfa952743..e6bd1600a8f 100644
--- a/frontend/src/metabase/static-viz/components/PieChart/PieChart.stories.tsx
+++ b/frontend/src/metabase/static-viz/components/PieChart/PieChart.stories.tsx
@@ -35,6 +35,7 @@ const renderingContext: RenderingContext = {
measureTextWidth(text, Number(style.size), Number(style.weight)),
measureTextHeight: (_, style) => measureTextHeight(Number(style.size)),
fontFamily: "Lato",
+ isStatic: true,
theme: DEFAULT_VISUALIZATION_THEME,
};
diff --git a/frontend/src/metabase/static-viz/components/RowChart/RowChart.tsx b/frontend/src/metabase/static-viz/components/RowChart/RowChart.tsx
index c7c47cc7012..752425d71ad 100644
--- a/frontend/src/metabase/static-viz/components/RowChart/RowChart.tsx
+++ b/frontend/src/metabase/static-viz/components/RowChart/RowChart.tsx
@@ -137,6 +137,7 @@ export const StaticRowChart = ({
xScaleType={settings["graph.y_axis.scale"]}
xValueRange={xValueRange}
labelledSeries={labelledSeries}
+ isStatic
/>
</Group>
{hasDevWatermark && (
diff --git a/frontend/src/metabase/static-viz/components/RowChart/stories-data.ts b/frontend/src/metabase/static-viz/components/RowChart/stories-data.ts
index 2b8338ebefb..714e296f7fd 100644
--- a/frontend/src/metabase/static-viz/components/RowChart/stories-data.ts
+++ b/frontend/src/metabase/static-viz/components/RowChart/stories-data.ts
@@ -16,6 +16,7 @@ export const renderingContext: RenderingContext = {
measureTextWidth(text, Number(style.size), Number(style.weight)),
measureTextHeight: (_, style) => measureTextHeight(Number(style.size)),
fontFamily: "Lato",
+ isStatic: true,
theme: DEFAULT_VISUALIZATION_THEME,
};
diff --git a/frontend/src/metabase/static-viz/components/SankeyChart/SankeyChart.stories.tsx b/frontend/src/metabase/static-viz/components/SankeyChart/SankeyChart.stories.tsx
index 9bf5a871da4..ee98d743b5d 100644
--- a/frontend/src/metabase/static-viz/components/SankeyChart/SankeyChart.stories.tsx
+++ b/frontend/src/metabase/static-viz/components/SankeyChart/SankeyChart.stories.tsx
@@ -36,6 +36,7 @@ const renderingContext: RenderingContext = {
measureTextWidth(text, Number(style.size), Number(style.weight)),
measureTextHeight: (_, style) => measureTextHeight(Number(style.size)),
fontFamily: "Lato",
+ isStatic: true,
theme: DEFAULT_VISUALIZATION_THEME,
};
diff --git a/frontend/src/metabase/static-viz/components/ScalarChart/ScalarChart.stories.tsx b/frontend/src/metabase/static-viz/components/ScalarChart/ScalarChart.stories.tsx
index 8833a4be34b..af0d65dd268 100644
--- a/frontend/src/metabase/static-viz/components/ScalarChart/ScalarChart.stories.tsx
+++ b/frontend/src/metabase/static-viz/components/ScalarChart/ScalarChart.stories.tsx
@@ -37,6 +37,7 @@ const renderingContext: RenderingContext = {
measureTextWidth(text, Number(style.size), Number(style.weight)),
measureTextHeight: (_, style) => measureTextHeight(Number(style.size)),
fontFamily: "Lato",
+ isStatic: true,
theme: DEFAULT_VISUALIZATION_THEME,
};
diff --git a/frontend/src/metabase/static-viz/components/ScatterPlot/ScatterPlot.stories.tsx b/frontend/src/metabase/static-viz/components/ScatterPlot/ScatterPlot.stories.tsx
index 698167ef5fc..1de244b1a48 100644
--- a/frontend/src/metabase/static-viz/components/ScatterPlot/ScatterPlot.stories.tsx
+++ b/frontend/src/metabase/static-viz/components/ScatterPlot/ScatterPlot.stories.tsx
@@ -37,6 +37,7 @@ const renderingContext: RenderingContext = {
measureTextWidth(text, Number(style.size), Number(style.weight)),
measureTextHeight: (_, style) => measureTextHeight(Number(style.size)),
fontFamily: "Lato",
+ isStatic: true,
theme: DEFAULT_VISUALIZATION_THEME,
};
diff --git a/frontend/src/metabase/static-viz/components/ScatterPlot/ScatterPlot.tsx b/frontend/src/metabase/static-viz/components/ScatterPlot/ScatterPlot.tsx
index 00992f00c60..ce817e1908d 100644
--- a/frontend/src/metabase/static-viz/components/ScatterPlot/ScatterPlot.tsx
+++ b/frontend/src/metabase/static-viz/components/ScatterPlot/ScatterPlot.tsx
@@ -3,13 +3,18 @@ import { init } from "echarts/core";
import type { StaticChartProps } from "metabase/static-viz/components/StaticVisualization";
import { readAllPointsOutOfRange } from "metabase/static-viz/lib/data-visibility";
+import { withCartesianChartSize } from "metabase/static-viz/lib/rendering-context";
import { sanitizeSvgForBatik } from "metabase/static-viz/lib/svg";
-import { getChartHeight } from "metabase/static-viz/lib/utils";
+import {
+ STATIC_CARTESIAN_CHART_SIZE,
+ getChartHeight,
+} from "metabase/static-viz/lib/utils";
import {
getChartLayout,
getLegendItems,
getScatterPlotModel,
getScatterPlotOption,
+ getSizeAdjustedSettings,
registerEChartsModules,
} from "metabase/viz-core";
@@ -20,20 +25,29 @@ import { calculateLegendRows } from "../Legend/utils";
registerEChartsModules();
-const WIDTH = 540;
-const HEIGHT = 360;
const LEGEND_PADDING = 8;
export function ScatterPlot({
rawSeries,
- settings,
- renderingContext,
- width = WIDTH,
- height = HEIGHT,
+ settings: originalSettings,
+ renderingContext: originalRenderingContext,
+ width = STATIC_CARTESIAN_CHART_SIZE.width,
+ height = STATIC_CARTESIAN_CHART_SIZE.height,
isStorybook = false,
hasDevWatermark = false,
fitWithinBounds = false,
+ gridSize,
}: StaticChartProps) {
+ const renderingContext = withCartesianChartSize(originalRenderingContext, {
+ width,
+ height,
+ });
+ const settings = getSizeAdjustedSettings({
+ settings: originalSettings,
+ width,
+ height,
+ gridSize,
+ });
const chartModel = getScatterPlotModel(
rawSeries,
settings,
diff --git a/frontend/src/metabase/static-viz/components/StaticVisualization/StaticVisualization.tsx b/frontend/src/metabase/static-viz/components/StaticVisualization/StaticVisualization.tsx
index 64cf8610753..f0a0037b540 100644
--- a/frontend/src/metabase/static-viz/components/StaticVisualization/StaticVisualization.tsx
+++ b/frontend/src/metabase/static-viz/components/StaticVisualization/StaticVisualization.tsx
@@ -28,6 +28,7 @@ export const StaticVisualization = ({
width,
height,
fitWithinBounds,
+ gridSize,
}: StaticVisualizationProps) => {
const display = rawSeries[0].card.display;
const transformedSeries = getVisualizationTransformed(rawSeries).series;
@@ -41,6 +42,7 @@ export const StaticVisualization = ({
width,
height,
fitWithinBounds,
+ gridSize,
};
switch (display) {
diff --git a/frontend/src/metabase/static-viz/components/StaticVisualization/types.ts b/frontend/src/metabase/static-viz/components/StaticVisualization/types.ts
index 62ecc028d50..3968765185d 100644
--- a/frontend/src/metabase/static-viz/components/StaticVisualization/types.ts
+++ b/frontend/src/metabase/static-viz/components/StaticVisualization/types.ts
@@ -1,6 +1,7 @@
import type {
ComputedVisualizationSettings,
RenderingContext,
+ VisualizationGridSize,
} from "metabase/viz-core";
import type { RawSeries } from "metabase-types/api";
@@ -14,4 +15,5 @@ export interface StaticChartProps {
hasDevWatermark?: boolean;
// When true, width/height are the exact output box: charts fit their legend inside it
fitWithinBounds?: boolean;
+ gridSize?: VisualizationGridSize;
}
diff --git a/frontend/src/metabase/static-viz/components/TreemapChart/TreemapChart.stories.tsx b/frontend/src/metabase/static-viz/components/TreemapChart/TreemapChart.stories.tsx
index 1bd811f5c86..ee45854b535 100644
--- a/frontend/src/metabase/static-viz/components/TreemapChart/TreemapChart.stories.tsx
+++ b/frontend/src/metabase/static-viz/components/TreemapChart/TreemapChart.stories.tsx
@@ -35,6 +35,7 @@ const renderingContext: RenderingContext = {
measureTextWidth(text, Number(style.size), Number(style.weight)),
measureTextHeight: (_, style) => measureTextHeight(Number(style.size)),
fontFamily: "Lato",
+ isStatic: true,
theme: DEFAULT_VISUALIZATION_THEME,
};
diff --git a/frontend/src/metabase/static-viz/components/WaterfallChart/WaterfallChart.stories.tsx b/frontend/src/metabase/static-viz/components/WaterfallChart/WaterfallChart.stories.tsx
index fbe86d02806..042fd3bf033 100644
--- a/frontend/src/metabase/static-viz/components/WaterfallChart/WaterfallChart.stories.tsx
+++ b/frontend/src/metabase/static-viz/components/WaterfallChart/WaterfallChart.stories.tsx
@@ -34,6 +34,7 @@ const renderingContext: RenderingContext = {
measureTextWidth(text, Number(style.size), Number(style.weight)),
measureTextHeight: (_, style) => measureTextHeight(Number(style.size)),
fontFamily: "Lato",
+ isStatic: true,
theme: DEFAULT_VISUALIZATION_THEME,
};
diff --git a/frontend/src/metabase/static-viz/components/WaterfallChart/WaterfallChart.tsx b/frontend/src/metabase/static-viz/components/WaterfallChart/WaterfallChart.tsx
index fc7f5990b1a..82b182510e4 100644
--- a/frontend/src/metabase/static-viz/components/WaterfallChart/WaterfallChart.tsx
+++ b/frontend/src/metabase/static-viz/components/WaterfallChart/WaterfallChart.tsx
@@ -2,9 +2,12 @@ import { init } from "echarts/core";
import type { StaticChartProps } from "metabase/static-viz/components/StaticVisualization";
import { readAllPointsOutOfRange } from "metabase/static-viz/lib/data-visibility";
+import { withCartesianChartSize } from "metabase/static-viz/lib/rendering-context";
import { sanitizeSvgForBatik } from "metabase/static-viz/lib/svg";
+import { STATIC_CARTESIAN_CHART_SIZE } from "metabase/static-viz/lib/utils";
import {
getChartLayout,
+ getSizeAdjustedSettings,
getWaterfallChartModel,
getWaterfallChartOption,
registerEChartsModules,
@@ -15,18 +18,26 @@ import { DataOutOfRangeOverlay } from "../DataOutOfRangeOverlay/DataOutOfRangeOv
registerEChartsModules();
-const WIDTH = 540;
-const HEIGHT = 360;
-
export function WaterfallChart({
rawSeries,
- settings,
- renderingContext,
- width = WIDTH,
- height = HEIGHT,
+ settings: originalSettings,
+ renderingContext: originalRenderingContext,
+ width = STATIC_CARTESIAN_CHART_SIZE.width,
+ height = STATIC_CARTESIAN_CHART_SIZE.height,
isStorybook = false,
hasDevWatermark = false,
+ gridSize,
}: StaticChartProps) {
+ const renderingContext = withCartesianChartSize(originalRenderingContext, {
+ width,
+ height,
+ });
+ const settings = getSizeAdjustedSettings({
+ settings: originalSettings,
+ width,
+ height,
+ gridSize,
+ });
const chartModel = getWaterfallChartModel(
rawSeries,
settings,
diff --git a/frontend/src/metabase/static-viz/index.tsx b/frontend/src/metabase/static-viz/index.tsx
index aa98aeab0af..a71aa7b313f 100644
--- a/frontend/src/metabase/static-viz/index.tsx
+++ b/frontend/src/metabase/static-viz/index.tsx
@@ -220,6 +220,7 @@ function RenderChart(
width={options.width}
height={options.height}
fitWithinBounds={options.fitWithinBounds}
+ gridSize={options.gridSize}
/>,
);
}
diff --git a/frontend/src/metabase/static-viz/lib/colors.unit.spec.ts b/frontend/src/metabase/static-viz/lib/colors.unit.spec.ts
new file mode 100644
index 00000000000..cdbf602bbe5
--- /dev/null
+++ b/frontend/src/metabase/static-viz/lib/colors.unit.spec.ts
@@ -0,0 +1,18 @@
+import { DEFAULT_VISUALIZATION_THEME } from "metabase/viz-core";
+
+import { createColorGetter } from "./colors";
+import { replaceFunctionalColors } from "./svg";
+
+describe("static chart axis colors", () => {
+ it("uses the same opaque gray for axis lines and gridlines", () => {
+ const axisColor = createColorGetter()("chart-axis");
+ const gridlineColor =
+ DEFAULT_VISUALIZATION_THEME.cartesian.splitLine.lineStyle.color;
+
+ expect(axisColor).toBe("#DCDFE0");
+ expect(gridlineColor).toBe(axisColor);
+ expect(replaceFunctionalColors(`<path stroke="${gridlineColor}"/>`)).toBe(
+ `<path stroke="${axisColor}"/>`,
+ );
+ });
+});
diff --git a/frontend/src/metabase/static-viz/lib/rendering-context.ts b/frontend/src/metabase/static-viz/lib/rendering-context.ts
index 3f56f609a0a..8c93d054828 100644
--- a/frontend/src/metabase/static-viz/lib/rendering-context.ts
+++ b/frontend/src/metabase/static-viz/lib/rendering-context.ts
@@ -1,13 +1,32 @@
+import { DEFAULT_METABASE_COMPONENT_THEME } from "metabase/ui";
import type { ColorPalette } from "metabase/ui/colors/types";
import {
DEFAULT_VISUALIZATION_THEME,
type RenderingContext,
+ getCartesianChartSize,
+ getVisualizationTheme,
} from "metabase/viz-core";
import { createColorGetter } from "../lib/colors";
import { measureTextHeight, measureTextWidth } from "./text";
+export const withCartesianChartSize = (
+ renderingContext: RenderingContext,
+ size: { width: number; height: number },
+): RenderingContext => {
+ const cartesianSize = getCartesianChartSize(size);
+ return {
+ ...renderingContext,
+ cartesianSize,
+ theme: getVisualizationTheme({
+ theme: DEFAULT_METABASE_COMPONENT_THEME,
+ isStaticViz: true,
+ cartesianSize,
+ }),
+ };
+};
+
export const createStaticRenderingContext = (
colors?: ColorPalette,
): RenderingContext => {
@@ -37,6 +56,7 @@ export const createStaticRenderingContext = (
typeof style.size === "number" ? style.size : parseInt(style.size),
),
fontFamily: "Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif",
+ isStatic: true,
theme: DEFAULT_VISUALIZATION_THEME,
};
};
diff --git a/frontend/src/metabase/static-viz/lib/rendering-context.unit.spec.ts b/frontend/src/metabase/static-viz/lib/rendering-context.unit.spec.ts
new file mode 100644
index 00000000000..dae9a88e911
--- /dev/null
+++ b/frontend/src/metabase/static-viz/lib/rendering-context.unit.spec.ts
@@ -0,0 +1,27 @@
+import {
+ createStaticRenderingContext,
+ withCartesianChartSize,
+} from "./rendering-context";
+import { STATIC_CARTESIAN_CHART_SIZE } from "./utils";
+
+describe("withCartesianChartSize", () => {
+ it("sizes the default static cartesian chart as medium", () => {
+ const renderingContext = withCartesianChartSize(
+ createStaticRenderingContext(),
+ STATIC_CARTESIAN_CHART_SIZE,
+ );
+
+ expect(renderingContext.cartesianSize).toBe("medium");
+ expect(renderingContext.theme.cartesian.ticks).toEqual({
+ fontSize: 12,
+ marginX: 10,
+ marginY: 12,
+ });
+ expect(renderingContext.theme.cartesian.axisTitle).toEqual({
+ fontSize: 12,
+ fontWeight: 700,
+ marginX: 12,
+ marginY: 16,
+ });
+ });
+});
diff --git a/frontend/src/metabase/static-viz/lib/utils.ts b/frontend/src/metabase/static-viz/lib/utils.ts
index 177b438f008..5b0bf5c2fb9 100644
--- a/frontend/src/metabase/static-viz/lib/utils.ts
+++ b/frontend/src/metabase/static-viz/lib/utils.ts
@@ -1,3 +1,8 @@
+export const STATIC_CARTESIAN_CHART_SIZE = {
+ width: 540,
+ height: 360,
+} as const;
+
export const getChartHeight = ({
fitWithinBounds,
height,
diff --git a/frontend/src/metabase/static-viz/types.ts b/frontend/src/metabase/static-viz/types.ts
index 6c38b1456a1..5081d8b10d2 100644
--- a/frontend/src/metabase/static-viz/types.ts
+++ b/frontend/src/metabase/static-viz/types.ts
@@ -1,4 +1,5 @@
import type { ColorPalette } from "metabase/ui/colors/types";
+import type { VisualizationGridSize } from "metabase/viz-core";
import type {
Card,
ColumnFormattingSetting,
@@ -24,6 +25,7 @@ export type RenderChartOptions = {
height?: number;
// When true, width/height are treated as the exact output box
fitWithinBounds?: boolean;
+ gridSize?: VisualizationGridSize;
};
export type RenderChartDashcardSettings = DashCardVisualizationSettings & {
diff --git a/frontend/src/metabase/styled-components/theme/css-variables.ts b/frontend/src/metabase/styled-components/theme/css-variables.ts
index 06c71034499..ffc18198704 100644
--- a/frontend/src/metabase/styled-components/theme/css-variables.ts
+++ b/frontend/src/metabase/styled-components/theme/css-variables.ts
@@ -88,6 +88,7 @@ export function getMetabaseSdkCssVariables({
whitelabelColors,
forceDynamicBrandRamp,
})}
+ --mb-color-chart-axis: ${theme.fn.themeColor("chart-axis")};
${getSdkDesignSystemCssVariables(theme)}
${getDynamicCssVariables(theme)}
${getThemeSpecificCssVariables(theme)}
diff --git a/frontend/src/metabase/ui/colors/colors.ts b/frontend/src/metabase/ui/colors/colors.ts
index c2f7c51ddb1..261e0ad487e 100644
--- a/frontend/src/metabase/ui/colors/colors.ts
+++ b/frontend/src/metabase/ui/colors/colors.ts
@@ -31,6 +31,7 @@ export const mutateColors = (whitelabelColors: ColorSettings) => {
};
export const staticVizOverrides = {
+ "chart-axis": baseColors.orion[20],
"text-primary": baseColors.orion[80],
"text-secondary": baseColors.orion[60],
"text-disabled": baseColors.orion[40],
diff --git a/frontend/src/metabase/ui/colors/constants/themes/dark.ts b/frontend/src/metabase/ui/colors/constants/themes/dark.ts
index 7cf92620f7f..ec572e4c557 100644
--- a/frontend/src/metabase/ui/colors/constants/themes/dark.ts
+++ b/frontend/src/metabase/ui/colors/constants/themes/dark.ts
@@ -215,6 +215,7 @@ const getActualColors = (brand: BrandRamp) => ({
"button_label-subtle-neutral-default": baseColors.orionAlphaInverse[80], // Matches text-primary
"button_label-subtle-positive-default": baseColors.palm[30],
"button_label-subtle-positive-hover": baseColors.palm[20],
+ "chart-axis": baseColors.orionAlphaInverse[20],
"core-blue-saturated": baseColors.ocean[40],
"core-brand-hover": brand[30],
"core-filter-strong": baseColors.filter[20],
diff --git a/frontend/src/metabase/ui/colors/constants/themes/light.ts b/frontend/src/metabase/ui/colors/constants/themes/light.ts
index f06030b958f..761fff41898 100644
--- a/frontend/src/metabase/ui/colors/constants/themes/light.ts
+++ b/frontend/src/metabase/ui/colors/constants/themes/light.ts
@@ -221,6 +221,7 @@ const getActualColors = (brand: BrandRamp) => ({
"button_label-subtle-neutral-default": baseColors.orionAlpha[80], // Matches text-primary
"button_label-subtle-positive-default": baseColors.palm[70],
"button_label-subtle-positive-hover": baseColors.palm[80],
+ "chart-axis": baseColors.orionAlpha[20],
"core-blue-saturated": baseColors.ocean[60],
"core-brand-hover": brand[50],
"core-filter-strong": baseColors.filter[50],
diff --git a/frontend/src/metabase/ui/colors/types/color-keys.ts b/frontend/src/metabase/ui/colors/types/color-keys.ts
index f8d1328000a..e79855525b8 100644
--- a/frontend/src/metabase/ui/colors/types/color-keys.ts
+++ b/frontend/src/metabase/ui/colors/types/color-keys.ts
@@ -203,6 +203,7 @@ export type MetabaseColorKey =
| "button_label-subtle-neutral-default"
| "button_label-subtle-positive-default"
| "button_label-subtle-positive-hover"
+ | "chart-axis"
| "core-blue-saturated"
| "core-brand"
| "core-brand-hover"
diff --git a/frontend/src/metabase/ui/component-theme.ts b/frontend/src/metabase/ui/component-theme.ts
index cf02421982a..9cfbda28e98 100644
--- a/frontend/src/metabase/ui/component-theme.ts
+++ b/frontend/src/metabase/ui/component-theme.ts
@@ -265,7 +265,7 @@ export const DEFAULT_METABASE_COMPONENT_THEME: MetabaseComponentTheme = {
},
splitLine: {
lineStyle: {
- color: "var(--mb-color-cartesian-grid-line)",
+ color: "var(--mb-color-chart-axis)",
},
},
},
diff --git a/frontend/src/metabase/visualizations/components/Visualization/Visualization.tsx b/frontend/src/metabase/visualizations/components/Visualization/Visualization.tsx
index 6893a0b00a7..a57f64efdd6 100644
--- a/frontend/src/metabase/visualizations/components/Visualization/Visualization.tsx
+++ b/frontend/src/metabase/visualizations/components/Visualization/Visualization.tsx
@@ -160,7 +160,6 @@ type VisualizationOwnProps = {
replacementContent?: JSX.Element | null;
selectedTimelineEventIds?: number[];
settings?: VisualizationSettings;
- autoAdjustSettings?: boolean;
showTitle?: boolean;
showWarnings?: boolean;
hideLegend?: boolean;
@@ -632,7 +631,6 @@ class Visualization extends PureComponent<
render() {
const {
actionButtons,
- autoAdjustSettings,
canToggleSeriesVisibility,
className,
dashboard,
@@ -965,7 +963,6 @@ class Visualization extends PureComponent<
selectedTimelineEventIds={selectedTimelineEventIds}
series={series}
settings={settings}
- autoAdjustSettings={!!autoAdjustSettings}
showAllLegendItems={showAllLegendItems}
hideLegend={hideLegend}
showTitle={!!showTitle}
diff --git a/frontend/src/metabase/visualizations/components/legend/Legend.module.css b/frontend/src/metabase/visualizations/components/legend/Legend.module.css
new file mode 100644
index 00000000000..c23419a7deb
--- /dev/null
+++ b/frontend/src/metabase/visualizations/components/legend/Legend.module.css
@@ -0,0 +1,37 @@
+.horizontalRoot {
+ overflow: hidden;
+}
+
+.overflowLabel {
+ cursor: pointer;
+ white-space: nowrap;
+
+ &:hover {
+ color: var(--mb-color-core-brand);
+ }
+}
+
+.popoverScroll {
+ overflow-x: hidden;
+}
+
+.itemLabel {
+ transition: opacity 0.25s linear;
+}
+
+.hoverableLabel:hover {
+ color: var(--mb-color-core-brand);
+}
+
+.itemTitle {
+ color: var(--mb-color-text-primary);
+ overflow: hidden;
+}
+
+.clickableTitle {
+ cursor: pointer;
+
+ &:hover {
+ color: var(--mb-color-core-brand);
+ }
+}
diff --git a/frontend/src/metabase/visualizations/components/legend/Legend.styled.tsx b/frontend/src/metabase/visualizations/components/legend/Legend.styled.tsx
deleted file mode 100644
index ecb41d7f42f..00000000000
--- a/frontend/src/metabase/visualizations/components/legend/Legend.styled.tsx
+++ /dev/null
@@ -1,30 +0,0 @@
-// eslint-disable-next-line eslint-js/no-restricted-imports
-import styled from "@emotion/styled";
-
-import { darken } from "metabase/ui/colors";
-
-export const LegendRoot = styled.div<{ isVertical: boolean }>`
- display: flex;
- flex-direction: ${({ isVertical }) => (isVertical ? "column" : "row")};
- overflow: ${({ isVertical }) => (isVertical ? "" : "hidden")};
- padding: 2px;
-`;
-
-export const LegendLink = styled.div`
- cursor: pointer;
- color: var(--mb-color-core-brand);
- font-weight: bold;
-
- &:hover {
- color: ${() => darken("core-brand")};
- }
-`;
-
-export const LegendLinkContainer = styled.div<{ isVertical: boolean }>`
- margin-top: ${({ isVertical }) => (isVertical ? "0.5rem" : "")};
-`;
-
-export const LegendPopoverContainer = styled.div`
- padding: 0.5rem;
- overflow-x: hidden;
-`;
diff --git a/frontend/src/metabase/visualizations/components/legend/Legend.tsx b/frontend/src/metabase/visualizations/components/legend/Legend.tsx
index 1acd566a773..29eeb686e88 100644
--- a/frontend/src/metabase/visualizations/components/legend/Legend.tsx
+++ b/frontend/src/metabase/visualizations/components/legend/Legend.tsx
@@ -1,17 +1,19 @@
+import cx from "classnames";
import { t } from "ttag";
import _ from "underscore";
-import { Popover } from "metabase/ui";
+import { Box, Flex, Popover, Text, rem } from "metabase/ui";
import type { HoveredObject } from "metabase/viz-core";
-import {
- LegendLink,
- LegendLinkContainer,
- LegendPopoverContainer,
- LegendRoot,
-} from "./Legend.styled";
+import S from "./Legend.module.css";
import type { LegendItemData } from "./LegendItem";
import { LegendItem } from "./LegendItem";
+import {
+ LEGEND_PADDING,
+ LEGEND_SIZES,
+ type LegendSize,
+ getOverflowLabel,
+} from "./layout";
const POPOVER_BORDER = 1;
const POPOVER_PADDING = 8;
@@ -24,8 +26,7 @@ interface LegendProps {
visibleIndex?: number;
visibleLength?: number;
isVertical?: boolean;
- isInsidePopover?: boolean;
- isQueryBuilder?: boolean;
+ size?: LegendSize;
onHoverChange?: (data?: HoveredObject | null) => void;
onSelectSeries?: (
event: React.MouseEvent,
@@ -43,24 +44,29 @@ export const Legend = ({
visibleIndex = 0,
visibleLength = originalItems.length,
isVertical,
- isInsidePopover,
+ size = "sm",
onHoverChange,
onSelectSeries,
onToggleSeriesVisibility,
isReversed,
- isQueryBuilder,
}: LegendProps) => {
const items = isReversed ? _.clone(originalItems).reverse() : originalItems;
const overflowIndex = visibleIndex + visibleLength;
const visibleItems = items.slice(visibleIndex, overflowIndex);
const overflowLength = items.length - overflowIndex;
+ const { itemGap, rowGap, maxVerticalWidth, typography } = LEGEND_SIZES[size];
return (
- <LegendRoot
- className={className}
+ <Flex
+ className={cx({ [S.horizontalRoot]: !isVertical }, className)}
aria-label={t`Legend`}
- isVertical={!!isVertical}
+ direction={isVertical ? "column" : "row"}
+ align={isVertical ? "stretch" : "center"}
+ gap={isVertical ? rowGap : itemGap}
+ miw={0}
+ maw="100%"
+ p={LEGEND_PADDING}
>
{visibleItems.map((item, index) => {
const localIndex = index + visibleIndex;
@@ -74,9 +80,7 @@ export const Legend = ({
item={item}
index={itemIndex}
isMuted={hovered != null && itemIndex !== hovered.index}
- dotSize={isQueryBuilder ? "12px" : "8px"}
- isVertical={isVertical}
- isInsidePopover={isInsidePopover}
+ size={size}
isReversed={isReversed}
onHoverChange={onHoverChange}
onSelectSeries={onSelectSeries}
@@ -85,30 +89,40 @@ export const Legend = ({
);
})}
{overflowLength > 0 && (
- <Popover width="target" offset={POPOVER_OFFSET} position="top-start">
+ <Popover
+ width={rem(maxVerticalWidth)}
+ offset={POPOVER_OFFSET}
+ position="top-start"
+ >
<Popover.Target>
- <LegendLinkContainer isVertical={!!isVertical}>
- <LegendLink>{t`And ${overflowLength} more`}</LegendLink>
- </LegendLinkContainer>
+ <Text
+ component="div"
+ className={S.overflowLabel}
+ c="text-secondary"
+ fz={typography}
+ lh={typography}
+ >
+ {getOverflowLabel(overflowLength)}
+ </Text>
</Popover.Target>
<Popover.Dropdown>
- <LegendPopoverContainer>
+ <Box className={S.popoverScroll} p="sm">
<Legend
items={originalItems}
hovered={hovered}
visibleIndex={overflowIndex}
visibleLength={overflowLength}
isVertical={isVertical}
- isInsidePopover
+ size={size}
onHoverChange={onHoverChange}
onSelectSeries={onSelectSeries}
onToggleSeriesVisibility={onToggleSeriesVisibility}
isReversed={isReversed}
/>
- </LegendPopoverContainer>
+ </Box>
</Popover.Dropdown>
</Popover>
)}
- </LegendRoot>
+ </Flex>
);
};
diff --git a/frontend/src/metabase/visualizations/components/legend/LegendItem.styled.tsx b/frontend/src/metabase/visualizations/components/legend/LegendItem.styled.tsx
deleted file mode 100644
index 119badbcb42..00000000000
--- a/frontend/src/metabase/visualizations/components/legend/LegendItem.styled.tsx
+++ /dev/null
@@ -1,50 +0,0 @@
-// eslint-disable-next-line eslint-js/no-restricted-imports
-import styled from "@emotion/styled";
-
-export const LegendItemRoot = styled.div<{ isVertical: boolean }>`
- display: flex;
- align-items: center;
- min-width: 0;
-
- &:not(:first-of-type) {
- margin-top: ${({ isVertical }) => (isVertical ? "0.25rem" : "")};
- margin-left: ${({ isVertical }) => (isVertical ? "" : "0.75rem")};
- }
-`;
-
-export const LegendItemLabel = styled.div<{ isMuted: boolean }>`
- display: flex;
- align-items: center;
- width: 100%;
- opacity: ${({ isMuted }) => (isMuted ? "0.4" : "1")};
- transition: opacity 0.25s linear;
-
- &:hover {
- color: ${({ onMouseEnter }) =>
- onMouseEnter && "var(--mb-color-core-brand)"};
- }
-`;
-
-const LEGEND_ITEM_TITLE_MARGIN = 4;
-
-export const LEGEND_ITEM_FONT_SIZE = "0.928em";
-
-export const LegendItemTitle = styled.div<{
- dotSize: string;
- isInsidePopover?: boolean;
-}>`
- color: var(--mb-color-text-primary);
- font-size: ${LEGEND_ITEM_FONT_SIZE};
- font-weight: 700;
- margin-left: ${LEGEND_ITEM_TITLE_MARGIN}px;
- overflow: hidden;
- cursor: ${({ onClick }) => (onClick ? "pointer" : "")};
- max-width: ${({ dotSize, isInsidePopover }) =>
- isInsidePopover
- ? `calc(100% - ${dotSize}px - ${LEGEND_ITEM_TITLE_MARGIN}px)`
- : "unset"};
-
- &:hover {
- color: ${({ onClick }) => onClick && "var(--mb-color-core-brand)"};
- }
-`;
diff --git a/frontend/src/metabase/visualizations/components/legend/LegendItem.tsx b/frontend/src/metabase/visualizations/components/legend/LegendItem.tsx
index 9cd5e7d37c3..dd4b4b3c59c 100644
--- a/frontend/src/metabase/visualizations/components/legend/LegendItem.tsx
+++ b/frontend/src/metabase/visualizations/components/legend/LegendItem.tsx
@@ -2,14 +2,11 @@ import cx from "classnames";
import { memo } from "react";
import DashboardS from "metabase/css/dashboard.module.css";
-import { Ellipsified } from "metabase/ui";
+import { Box, Ellipsified, Flex, rem } from "metabase/ui";
-import {
- LegendItemLabel,
- LegendItemRoot,
- LegendItemTitle,
-} from "./LegendItem.styled";
+import S from "./Legend.module.css";
import { LegendItemDot } from "./LegendItemDot";
+import { LEGEND_SIZES, type LegendSize } from "./layout";
export interface LegendItemData {
key: string;
@@ -20,11 +17,9 @@ export interface LegendItemData {
interface LegendItemProps {
item: LegendItemData;
- dotSize?: string;
+ size?: LegendSize;
index: number;
isMuted?: boolean;
- isVertical?: boolean;
- isInsidePopover?: boolean;
isReversed?: boolean;
onHoverChange?: (data?: { index: number; element: Element }) => void;
onSelectSeries?: (
@@ -37,16 +32,16 @@ interface LegendItemProps {
const LegendItemInner = ({
item,
- dotSize = "8px",
+ size = "sm",
index,
isMuted,
- isVertical,
- isInsidePopover,
isReversed,
onHoverChange,
onSelectSeries,
onToggleSeriesVisibility,
}: LegendItemProps) => {
+ const { dotSize, dotGap, typography } = LEGEND_SIZES[size];
+
const handleDotClick = (event: React.MouseEvent) => {
onToggleSeriesVisibility?.(event, index);
};
@@ -64,31 +59,37 @@ const LegendItemInner = ({
};
return (
- <LegendItemRoot isVertical={!!isVertical} data-testid="legend-item">
- <LegendItemLabel
- isMuted={!!isMuted}
+ <Flex align="center" miw={0} data-testid="legend-item">
+ <Flex
+ className={cx(S.itemLabel, {
+ [S.hoverableLabel]: onHoverChange != null,
+ })}
+ align="center"
+ w="100%"
+ opacity={isMuted ? 0.4 : 1}
onMouseEnter={onHoverChange && handleItemMouseEnter}
onMouseLeave={onHoverChange && handleItemMouseLeave}
>
<LegendItemDot
color={item.color}
- size={dotSize}
+ size={rem(dotSize)}
isVisible={item.visible ?? true}
onClick={onToggleSeriesVisibility && handleDotClick}
/>
- <LegendItemTitle
- className={cx(
- DashboardS.fullscreenNormalText,
- DashboardS.DashboardChartLegend,
- )}
- dotSize={dotSize}
- isInsidePopover={isInsidePopover}
+ <Box
+ className={cx(DashboardS.fullscreenNormalText, S.itemTitle, {
+ [S.clickableTitle]: onSelectSeries != null,
+ })}
+ fz={typography}
+ lh={typography}
+ ml={dotGap}
+ miw={0}
onClick={onSelectSeries && handleItemClick}
>
<Ellipsified>{item.name}</Ellipsified>
- </LegendItemTitle>
- </LegendItemLabel>
- </LegendItemRoot>
+ </Box>
+ </Flex>
+ </Flex>
);
};
diff --git a/frontend/src/metabase/visualizations/components/legend/LegendItemDot.module.css b/frontend/src/metabase/visualizations/components/legend/LegendItemDot.module.css
new file mode 100644
index 00000000000..3db16023015
--- /dev/null
+++ b/frontend/src/metabase/visualizations/components/legend/LegendItemDot.module.css
@@ -0,0 +1,40 @@
+.root {
+ position: relative;
+}
+
+.rootButton {
+ position: relative;
+ cursor: pointer;
+}
+
+.circle {
+ position: absolute;
+ top: 0;
+ left: 0;
+ border-radius: 32%;
+ transition: all 0.2s;
+}
+
+.outerCircle {
+ background-color: var(--mb-color-border-neutral);
+}
+
+.innerCircle {
+ print-color-adjust: exact;
+ background-color: var(--mb-color-background_page-primary);
+ border: 0.125rem solid var(--mb-color-text-disabled);
+}
+
+.innerCircle.visible {
+ background-color: var(--legend-dot-color);
+ border: 0;
+ box-shadow: inset 0 0 0 0.5px var(--mb-color-shadow-default);
+}
+
+.rootButton:hover .innerCircle {
+ transform: scale(0.8);
+}
+
+.rootButton:hover .outerCircle {
+ transform: scale(1.3);
+}
diff --git a/frontend/src/metabase/visualizations/components/legend/LegendItemDot.styled.tsx b/frontend/src/metabase/visualizations/components/legend/LegendItemDot.styled.tsx
deleted file mode 100644
index 6ef404cb4bc..00000000000
--- a/frontend/src/metabase/visualizations/components/legend/LegendItemDot.styled.tsx
+++ /dev/null
@@ -1,43 +0,0 @@
-// eslint-disable-next-line eslint-js/no-restricted-imports
-import styled from "@emotion/styled";
-
-export const OuterCircle = styled.div`
- position: absolute;
- top: 0;
- left: 0;
- border-radius: 50%;
- background-color: var(--mb-color-border-neutral);
- transition: all 0.2s;
-`;
-
-export const InnerCircle = styled.div<{ isVisible: boolean }>`
- position: absolute;
- top: 0;
- left: 0;
- border-radius: 50%;
- color-adjust: exact;
- background-color: ${(props) =>
- props.isVisible ? props.color : "var(--mb-color-background_page-primary)"};
- border: 2px solid
- ${(props) =>
- props.isVisible ? props.color : "var(--mb-color-text-disabled)"};
- transition: all 0.2s;
-`;
-
-export const Root = styled.div`
- position: relative;
-`;
-
-export const RootButton = styled.button`
- position: relative;
- cursor: pointer;
-
- &:hover {
- ${InnerCircle} {
- transform: scale(0.8);
- }
- ${OuterCircle} {
- transform: scale(1.3);
- }
- }
-`;
diff --git a/frontend/src/metabase/visualizations/components/legend/LegendItemDot.tsx b/frontend/src/metabase/visualizations/components/legend/LegendItemDot.tsx
index 1533632eead..753e274f8cc 100644
--- a/frontend/src/metabase/visualizations/components/legend/LegendItemDot.tsx
+++ b/frontend/src/metabase/visualizations/components/legend/LegendItemDot.tsx
@@ -1,17 +1,13 @@
-import { type Ref, forwardRef } from "react";
+import cx from "classnames";
+import { type CSSProperties, type Ref, forwardRef } from "react";
import { t } from "ttag";
-import {
- InnerCircle,
- OuterCircle,
- Root,
- RootButton,
-} from "./LegendItemDot.styled";
+import S from "./LegendItemDot.module.css";
interface LegendItemDotProps {
isVisible: boolean;
color: string;
- size?: string; // px
+ size?: string;
onClick?: (event: React.MouseEvent) => void;
}
@@ -19,7 +15,7 @@ export const LegendItemDot = forwardRef<
HTMLButtonElement | HTMLDivElement,
LegendItemDotProps
>(function LegendItemDot(
- { isVisible = true, color, size = "8px", onClick },
+ { isVisible = true, color, size = "0.5rem", onClick },
ref,
) {
const sizeStyle = {
@@ -27,31 +23,45 @@ export const LegendItemDot = forwardRef<
width: size,
height: size,
};
+ const rootStyle: CSSProperties & { "--legend-dot-color": string } = {
+ ...sizeStyle,
+ "--legend-dot-color": color,
+ };
+
+ const circles = (
+ <>
+ <span className={cx(S.circle, S.outerCircle)} style={sizeStyle} />
+ <span
+ className={cx(S.circle, S.innerCircle, { [S.visible]: isVisible })}
+ style={sizeStyle}
+ />
+ </>
+ );
if (onClick) {
return (
- <RootButton
+ <button
+ className={S.rootButton}
aria-label={isVisible ? t`Hide series` : t`Show series`}
onClick={onClick}
- style={sizeStyle}
- // Unjustified type cast. FIXME
+ style={rootStyle}
+ // the forwarded ref matches the rendered element: a button when clickable
ref={ref as Ref<HTMLButtonElement>}
>
- <OuterCircle style={sizeStyle} />
- <InnerCircle color={color} isVisible={isVisible} style={sizeStyle} />
- </RootButton>
+ {circles}
+ </button>
);
}
return (
- <Root
+ <div
+ className={S.root}
data-testid="legend-item-dot"
- style={sizeStyle}
- // Unjustified type cast. FIXME
+ style={rootStyle}
+ // the forwarded ref matches the rendered element: a div when not clickable
ref={ref as Ref<HTMLDivElement>}
>
- <OuterCircle style={sizeStyle} />
- <InnerCircle color={color} isVisible={isVisible} style={sizeStyle} />
- </Root>
+ {circles}
+ </div>
);
});
diff --git a/frontend/src/metabase/visualizations/components/legend/LegendLayout.module.css b/frontend/src/metabase/visualizations/components/legend/LegendLayout.module.css
new file mode 100644
index 00000000000..e7cf17c56f0
--- /dev/null
+++ b/frontend/src/metabase/visualizations/components/legend/LegendLayout.module.css
@@ -0,0 +1,27 @@
+.root {
+ display: flex;
+ flex: 1 1 auto;
+ min-width: 0;
+ min-height: 0;
+}
+
+.main {
+ display: flex;
+ flex: 1 1 auto;
+ flex-direction: column;
+ min-width: 0;
+ min-height: 0;
+}
+
+.chart {
+ display: flex;
+ flex: 1 0 auto;
+ flex-direction: column;
+ min-height: 0;
+}
+
+.verticalLegend {
+ /* the column stretches to the chart height but must never grow it */
+ contain: size;
+ overflow: hidden;
+}
diff --git a/frontend/src/metabase/visualizations/components/legend/LegendLayout.stories.tsx b/frontend/src/metabase/visualizations/components/legend/LegendLayout.stories.tsx
new file mode 100644
index 00000000000..72c84f949a4
--- /dev/null
+++ b/frontend/src/metabase/visualizations/components/legend/LegendLayout.stories.tsx
@@ -0,0 +1,165 @@
+import type { StoryObj } from "@storybook/react";
+
+import { Box, Text } from "metabase/ui";
+import { measureTextWidth } from "metabase/utils/measure-text";
+
+import type { LegendItemData } from "./LegendItem";
+import { LegendLayout } from "./LegendLayout";
+import { MIN_LEGEND_CARD_HEIGHT, MIN_LEGEND_CARD_WIDTH } from "./layout";
+
+export default {
+ title: "viz/Legend/LegendLayout",
+ component: LegendLayout,
+};
+
+const COLORS = ["#509EE3", "#88BF4D", "#A989C5", "#EF8C8C", "#F9D45C"];
+
+const createItems = (names: string[]): LegendItemData[] =>
+ names.map((name, index) => ({
+ key: name,
+ name,
+ color: COLORS[index % COLORS.length],
+ }));
+
+const SHORT_NAMES = ["Doohickey", "Gadget", "Gizmo", "Widget"];
+const MANY_NAMES = Array.from({ length: 20 }, (_, i) => `Series ${i + 1}`);
+const LONG_NAMES = [
+ "A very long series name that never fits",
+ "Another very long series name that never fits",
+ "Yet another very long series name that never fits",
+ "Short",
+];
+
+interface CardProps {
+ names: string[];
+ width: number;
+ height: number;
+ isQueryBuilder?: boolean;
+ alwaysVisible?: boolean;
+}
+
+// vertical padding of the card wrapper below; real charts measure their
+// viewport, so the stories pass the equivalent height for exact row fitting
+const CARD_VERTICAL_PADDING = 16;
+
+const Card = ({
+ names,
+ width,
+ height,
+ isQueryBuilder,
+ alwaysVisible,
+}: CardProps) => (
+ <Box
+ w={width}
+ h={height}
+ p="0.5rem 1rem"
+ bd="1px solid var(--mb-color-border)"
+ style={{ borderRadius: "0.75rem", display: "flex" }}
+ >
+ <LegendLayout
+ items={createItems(names)}
+ hasLegend
+ width={width}
+ height={height}
+ chartHeight={height - CARD_VERTICAL_PADDING}
+ isQueryBuilder={isQueryBuilder}
+ alwaysVisible={alwaysVisible}
+ fontFamily="Lato"
+ measureText={measureTextWidth}
+ >
+ <Box
+ flex="1 1 auto"
+ bg="background_page-secondary"
+ style={{
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "center",
+ }}
+ >
+ <Text c="text-secondary">chart</Text>
+ </Box>
+ </LegendLayout>
+ </Box>
+);
+
+export const Horizontal: StoryObj = {
+ render: () => <Card names={SHORT_NAMES} width={600} height={300} />,
+};
+
+// the smallest card that still shows a legend (the unit tests cover the
+// exact 420x200 boundary)
+export const MinimumCardSize: StoryObj = {
+ render: () => (
+ <Card
+ names={SHORT_NAMES}
+ width={MIN_LEGEND_CARD_WIDTH}
+ height={MIN_LEGEND_CARD_HEIGHT}
+ />
+ ),
+};
+
+export const HiddenOnSmallCard: StoryObj = {
+ render: () => <Card names={SHORT_NAMES} width={360} height={180} />,
+};
+
+export const Vertical: StoryObj = {
+ render: () => (
+ <Card names={MANY_NAMES.slice(0, 12)} width={600} height={300} />
+ ),
+};
+
+export const VerticalOverflow: StoryObj = {
+ render: () => <Card names={MANY_NAMES} width={600} height={300} />,
+};
+
+export const VerticalTruncated: StoryObj = {
+ render: () => (
+ <Card
+ names={[...LONG_NAMES.slice(0, 2), ...SHORT_NAMES]}
+ width={600}
+ height={300}
+ />
+ ),
+};
+
+// more than half of the names are truncated, so the legend is dropped
+export const HiddenWhenMostlyTruncated: StoryObj = {
+ render: () => <Card names={LONG_NAMES} width={600} height={300} />,
+};
+
+export const LargeCardHorizontal: StoryObj = {
+ render: () => <Card names={SHORT_NAMES} width={700} height={420} />,
+};
+
+export const LargeCardVertical: StoryObj = {
+ render: () => (
+ <Card names={MANY_NAMES.slice(0, 10)} width={700} height={420} />
+ ),
+};
+
+export const LargeCardVerticalOverflow: StoryObj = {
+ render: () => <Card names={MANY_NAMES} width={700} height={420} />,
+};
+
+export const VisualizerSmallCanvasAlwaysVisible: StoryObj = {
+ render: () => (
+ <Card
+ names={MANY_NAMES.slice(0, 8)}
+ width={360}
+ height={220}
+ alwaysVisible
+ />
+ ),
+};
+
+export const QueryBuilderHorizontal: StoryObj = {
+ render: () => (
+ <Card names={SHORT_NAMES} width={1000} height={500} isQueryBuilder />
+ ),
+};
+
+export const QueryBuilderVertical: StoryObj = {
+ render: () => (
+ <Card names={MANY_NAMES} width={571} height={600} isQueryBuilder />
+ ),
+};
diff --git a/frontend/src/metabase/visualizations/components/legend/LegendLayout.styled.tsx b/frontend/src/metabase/visualizations/components/legend/LegendLayout.styled.tsx
deleted file mode 100644
index c0fe4197233..00000000000
--- a/frontend/src/metabase/visualizations/components/legend/LegendLayout.styled.tsx
+++ /dev/null
@@ -1,33 +0,0 @@
-// eslint-disable-next-line eslint-js/no-restricted-imports
-import styled from "@emotion/styled";
-
-export const LegendLayoutRoot = styled.div<{ isVertical: boolean }>`
- display: flex;
- flex: 1 1 auto;
- flex-direction: ${({ isVertical }) => (isVertical ? "row" : "column")};
- min-width: 0;
- min-height: 0;
-`;
-
-export const MainContainer = styled.div`
- display: flex;
- flex: 1 0 auto;
- flex-direction: column;
-`;
-
-export const LegendContainer = styled.div<{
- isVertical: boolean;
- isQueryBuilder: boolean;
-}>`
- display: ${({ isVertical }) => (isVertical ? "block" : "flex")};
- max-width: ${({ isVertical }) => (isVertical ? "min(25%, 20rem)" : "")};
- margin-right: ${({ isVertical, isQueryBuilder }) =>
- isVertical ? (isQueryBuilder ? "2.5rem" : "0.5rem") : ""};
- margin-bottom: ${({ isVertical }) => (isVertical ? "" : "0.5rem")};
-`;
-
-export const ChartContainer = styled.div`
- display: flex;
- flex: 1 0 auto;
- flex-direction: column;
-`;
diff --git a/frontend/src/metabase/visualizations/components/legend/LegendLayout.tsx b/frontend/src/metabase/visualizations/components/legend/LegendLayout.tsx
index 24effb50e3f..5ca46fbe8e8 100644
--- a/frontend/src/metabase/visualizations/components/legend/LegendLayout.tsx
+++ b/frontend/src/metabase/visualizations/components/legend/LegendLayout.tsx
@@ -1,22 +1,15 @@
-import type { ReactNode } from "react";
+import cx from "classnames";
+import { type ReactNode, useMemo } from "react";
-import { isNotNull } from "metabase/utils/types";
+import { Box, Flex } from "metabase/ui";
+import type { TextWidthMeasurer } from "metabase/utils/measure-text";
import type { HoveredObject } from "metabase/viz-core";
import { Legend } from "./Legend";
import { LegendActions } from "./LegendActions";
import type { LegendItemData } from "./LegendItem";
-import {
- ChartContainer,
- LegendContainer,
- LegendLayoutRoot,
- MainContainer,
-} from "./LegendLayout.styled";
-
-const MIN_ITEM_WIDTH = 100;
-const MIN_ITEM_HEIGHT = 25;
-const MIN_ITEM_HEIGHT_LARGE = 31;
-const MIN_LEGEND_WIDTH = 400;
+import S from "./LegendLayout.module.css";
+import { LEGEND_SIZES, getLegendLayout, getLegendSize } from "./layout";
interface LegendLayoutProps {
className?: string;
@@ -24,10 +17,15 @@ interface LegendLayoutProps {
hovered?: HoveredObject | null;
width?: number;
height?: number;
- hasLegend?: boolean;
+ chartHeight?: number;
+ indent?: number;
+ hasLegend: boolean;
+ alwaysVisible?: boolean;
actionButtons?: ReactNode;
isFullscreen?: boolean;
isQueryBuilder?: boolean;
+ fontFamily: string;
+ measureText: TextWidthMeasurer;
children?: ReactNode;
onHoverChange?: (data?: HoveredObject | null) => void;
onSelectSeries?: (
@@ -45,64 +43,98 @@ export const LegendLayout = ({
hovered,
width = 0,
height = 0,
+ chartHeight,
+ indent = 0,
hasLegend,
+ alwaysVisible,
actionButtons,
isFullscreen,
isQueryBuilder,
+ fontFamily,
+ measureText,
children,
onHoverChange,
onSelectSeries,
onToggleSeriesVisibility,
isReversed,
}: LegendLayoutProps) => {
- const hasDimensions =
- isNotNull(width) && isNotNull(height) && width > 0 && height > 0;
- const itemHeight = !isFullscreen ? MIN_ITEM_HEIGHT : MIN_ITEM_HEIGHT_LARGE;
- const maxXItems = Math.floor(width / MIN_ITEM_WIDTH);
- const maxYItems = Math.floor(height / itemHeight);
- const maxYLabels = Math.max(maxYItems - 1, 0);
- const minYLabels = items.length > maxYItems ? maxYLabels : items.length;
-
- const isNarrow = width < MIN_LEGEND_WIDTH;
+ const hasDimensions = width > 0 && height > 0;
+ const size = getLegendSize({ width, height, isQueryBuilder, isFullscreen });
- const isVertical = maxXItems < items.length;
- const isHorizontal = !isVertical;
+ const layout = useMemo(
+ () =>
+ getLegendLayout({
+ items,
+ width,
+ height,
+ chartHeight,
+ horizontalWidth: width - Math.abs(indent),
+ size,
+ fontFamily,
+ measureText,
+ alwaysVisible,
+ }),
+ [
+ items,
+ width,
+ height,
+ chartHeight,
+ indent,
+ size,
+ fontFamily,
+ measureText,
+ alwaysVisible,
+ ],
+ );
- const isVisible = hasDimensions && hasLegend && !(isVertical && isNarrow);
- const visibleLength = isVertical ? minYLabels : items.length;
+ const isVisible = hasDimensions && hasLegend && layout.type !== "hidden";
+ const { horizontalGap, verticalGap } = LEGEND_SIZES[size];
- const legend = (
- <LegendContainer
- isVertical={!!isVertical}
- isQueryBuilder={!!isQueryBuilder}
- >
- <Legend
- items={items}
- hovered={hovered}
- visibleLength={visibleLength}
- isVertical={isVertical}
- onHoverChange={onHoverChange}
- onSelectSeries={onSelectSeries}
- onToggleSeriesVisibility={onToggleSeriesVisibility}
- isQueryBuilder={isQueryBuilder}
- isReversed={isReversed}
- />
- {!isVertical && actionButtons && (
- <LegendActions>{actionButtons}</LegendActions>
- )}
- </LegendContainer>
- );
+ const legendProps = {
+ items,
+ hovered,
+ size,
+ onHoverChange,
+ onSelectSeries,
+ onToggleSeriesVisibility,
+ isReversed,
+ };
return (
- <LegendLayoutRoot className={className} isVertical={isVertical}>
- {isVisible && isHorizontal && legend}
- <MainContainer>
- {isVertical && actionButtons && (
- <LegendActions>{actionButtons}</LegendActions>
+ <div className={cx(S.root, className)}>
+ <div className={S.main}>
+ {actionButtons && <LegendActions>{actionButtons}</LegendActions>}
+ {hasDimensions && <div className={S.chart}>{children}</div>}
+ {isVisible && layout.type === "horizontal" && (
+ <Flex
+ justify="center"
+ flex="0 0 auto"
+ miw={0}
+ mt={horizontalGap}
+ ml={Math.max(indent, 0)}
+ mr={Math.max(-indent, 0)}
+ data-testid="legend-horizontal"
+ >
+ <Legend {...legendProps} />
+ </Flex>
)}
- {hasDimensions && <ChartContainer>{children}</ChartContainer>}
- </MainContainer>
- {isVisible && isVertical && legend}
- </LegendLayoutRoot>
+ </div>
+ {isVisible && layout.type === "vertical" && (
+ <Box
+ className={S.verticalLegend}
+ flex="0 0 auto"
+ miw={0}
+ ml={verticalGap}
+ style={{ width: layout.width }}
+ data-testid="legend-vertical"
+ >
+ <Legend
+ {...legendProps}
+ visibleLength={layout.visibleCount}
+ isVertical
+ />
+ </Box>
+ )}
+ </div>
);
};
diff --git a/frontend/src/metabase/visualizations/components/legend/LegendLayout.unit.spec.tsx b/frontend/src/metabase/visualizations/components/legend/LegendLayout.unit.spec.tsx
new file mode 100644
index 00000000000..bd8e59af795
--- /dev/null
+++ b/frontend/src/metabase/visualizations/components/legend/LegendLayout.unit.spec.tsx
@@ -0,0 +1,110 @@
+import userEvent from "@testing-library/user-event";
+
+import { render, screen, within } from "__support__/ui";
+
+import type { LegendItemData } from "./LegendItem";
+import { LegendLayout } from "./LegendLayout";
+
+const CHAR_WIDTH = 6;
+
+const measureText = (text: string) => text.length * CHAR_WIDTH;
+
+const createItems = (names: string[]): LegendItemData[] =>
+ names.map((name) => ({ key: name, name, color: "red" }));
+
+interface SetupOpts {
+ names: string[];
+ width?: number;
+ height?: number;
+ isQueryBuilder?: boolean;
+ actionButtons?: React.ReactNode;
+}
+
+const setup = ({
+ names,
+ width = 600,
+ height = 300,
+ isQueryBuilder,
+ actionButtons,
+}: SetupOpts) => {
+ render(
+ <LegendLayout
+ items={createItems(names)}
+ hasLegend
+ width={width}
+ height={height}
+ isQueryBuilder={isQueryBuilder}
+ actionButtons={actionButtons}
+ fontFamily="Lato"
+ measureText={measureText}
+ >
+ <div data-testid="chart" />
+ </LegendLayout>,
+ );
+};
+
+describe("LegendLayout", () => {
+ it("should render the chart without a legend on cards smaller than the minimum size", () => {
+ setup({ names: ["a", "b"], width: 400, height: 150 });
+
+ expect(screen.getByTestId("chart")).toBeInTheDocument();
+ expect(screen.queryByLabelText("Legend")).not.toBeInTheDocument();
+ });
+
+ it("should render a horizontal legend below the chart when the items fit", () => {
+ setup({ names: ["first", "second"] });
+
+ const legend = screen.getByTestId("legend-horizontal");
+ expect(within(legend).getAllByTestId("legend-item")).toHaveLength(2);
+ expect(screen.queryByTestId("legend-vertical")).not.toBeInTheDocument();
+ expect(
+ screen.getByTestId("chart").compareDocumentPosition(legend) &
+ Node.DOCUMENT_POSITION_FOLLOWING,
+ ).toBeTruthy();
+ });
+
+ it("should render a vertical legend next to the chart when the items overflow the row", () => {
+ const names = Array.from({ length: 10 }, (_, i) => `series ${i}`);
+ setup({ names, width: 420, height: 400 });
+
+ const legend = screen.getByTestId("legend-vertical");
+ expect(within(legend).getAllByTestId("legend-item")).toHaveLength(10);
+ expect(legend).toHaveStyle({ width: "66px" });
+ expect(screen.queryByText(/more/)).not.toBeInTheDocument();
+ });
+
+ it("should show the hidden items behind a '+ N more' popover when rows overflow", async () => {
+ const names = Array.from({ length: 20 }, (_, i) => `series ${i}`);
+ setup({ names, width: 420, height: 200 });
+
+ const legend = screen.getByTestId("legend-vertical");
+ expect(within(legend).getAllByTestId("legend-item")).toHaveLength(7);
+
+ await userEvent.click(screen.getByText("+ 13 more"));
+
+ const popover = await screen.findByRole("dialog");
+ expect(within(popover).getAllByTestId("legend-item")).toHaveLength(13);
+ expect(within(popover).getByText("series 19")).toBeInTheDocument();
+ });
+
+ it("should hide the legend when more than half of the items would be truncated", () => {
+ setup({ names: ["a".repeat(40), "b".repeat(40), "c".repeat(40), "d"] });
+
+ expect(screen.getByTestId("chart")).toBeInTheDocument();
+ expect(screen.queryByLabelText("Legend")).not.toBeInTheDocument();
+ });
+
+ it("should keep the action buttons above the chart", () => {
+ setup({
+ names: ["first", "second"],
+ actionButtons: <button>action</button>,
+ });
+
+ expect(
+ screen
+ .getByText("action")
+ .compareDocumentPosition(screen.getByTestId("chart")) &
+ Node.DOCUMENT_POSITION_FOLLOWING,
+ ).toBeTruthy();
+ });
+});
diff --git a/frontend/src/metabase/visualizations/components/legend/layout.ts b/frontend/src/metabase/visualizations/components/legend/layout.ts
new file mode 100644
index 00000000000..c84856a4cab
--- /dev/null
+++ b/frontend/src/metabase/visualizations/components/legend/layout.ts
@@ -0,0 +1,200 @@
+import { c } from "ttag";
+
+import type { TextWidthMeasurer } from "metabase/utils/measure-text";
+
+import type { LegendItemData } from "./LegendItem";
+
+export type LegendSize = "sm" | "lg" | "md";
+
+interface LegendSizeConfig {
+ typography: "sm" | "md";
+ fontSize: number;
+ lineHeight: number;
+ dotSize: number;
+ dotGap: number;
+ itemGap: number;
+ rowGap: number;
+ horizontalGap: number;
+ verticalGap: number;
+ maxVerticalWidth: number;
+ horizontalPadding: number;
+ verticalPadding: number;
+}
+
+export const LEGEND_SIZES = {
+ sm: {
+ typography: "sm",
+ fontSize: 12,
+ lineHeight: 1.15,
+ dotSize: 8,
+ dotGap: 6,
+ itemGap: 12,
+ rowGap: 8,
+ horizontalGap: 12,
+ verticalGap: 24,
+ maxVerticalWidth: 200,
+ horizontalPadding: 32,
+ verticalPadding: 16,
+ },
+ lg: {
+ typography: "sm",
+ fontSize: 12,
+ lineHeight: 1.15,
+ dotSize: 8,
+ dotGap: 6,
+ itemGap: 12,
+ rowGap: 12,
+ horizontalGap: 16,
+ verticalGap: 40,
+ maxVerticalWidth: 200,
+ horizontalPadding: 80,
+ verticalPadding: 76,
+ },
+ md: {
+ typography: "md",
+ fontSize: 14,
+ lineHeight: 1.22,
+ dotSize: 14,
+ dotGap: 8,
+ itemGap: 16,
+ rowGap: 16,
+ horizontalGap: 24,
+ verticalGap: 64,
+ maxVerticalWidth: 256,
+ horizontalPadding: 48,
+ verticalPadding: 32,
+ },
+} as const satisfies Record<LegendSize, LegendSizeConfig>;
+
+// mirrors the large card tier in visualizations/CartesianChart/sizing.ts
+const LARGE_CARD_MIN_WIDTH = 640;
+const LARGE_CARD_MIN_HEIGHT = 360;
+
+interface GetLegendSizeOptions {
+ width: number;
+ height: number;
+ isQueryBuilder?: boolean;
+ isFullscreen?: boolean;
+}
+
+export const getLegendSize = ({
+ width,
+ height,
+ isQueryBuilder,
+ isFullscreen,
+}: GetLegendSizeOptions): LegendSize => {
+ if (isQueryBuilder || isFullscreen) {
+ return "md";
+ }
+ return width >= LARGE_CARD_MIN_WIDTH && height >= LARGE_CARD_MIN_HEIGHT
+ ? "lg"
+ : "sm";
+};
+
+export const LEGEND_FONT_WEIGHT = 400;
+// room for the focus outline of the legend items
+export const LEGEND_PADDING = 2;
+export const MIN_LEGEND_CARD_WIDTH = 420;
+export const MIN_LEGEND_CARD_HEIGHT = 200;
+const MAX_VERTICAL_WIDTH_RATIO = 0.25;
+const MAX_TRUNCATED_ITEMS_RATIO = 0.5;
+export type LegendLayoutResult =
+ | { type: "hidden" }
+ | { type: "horizontal" }
+ | { type: "vertical"; width: number; visibleCount: number };
+
+interface GetLegendLayoutOptions {
+ items: LegendItemData[];
+ width: number;
+ height: number;
+ chartHeight?: number;
+ horizontalWidth?: number;
+ size: LegendSize;
+ fontFamily: string;
+ measureText: TextWidthMeasurer;
+ alwaysVisible?: boolean;
+}
+
+const sum = (values: number[]) => values.reduce((total, v) => total + v, 0);
+
+export const getOverflowLabel = (count: number) =>
+ c("{0} is the number of hidden legend items").t`+ ${count} more`;
+
+export function getLegendLayout({
+ items,
+ width,
+ height,
+ chartHeight,
+ horizontalWidth = width,
+ size,
+ fontFamily,
+ measureText,
+ alwaysVisible = false,
+}: GetLegendLayoutOptions): LegendLayoutResult {
+ const isCardTooSmall =
+ width < MIN_LEGEND_CARD_WIDTH || height < MIN_LEGEND_CARD_HEIGHT;
+ if (items.length === 0 || (isCardTooSmall && !alwaysVisible)) {
+ return { type: "hidden" };
+ }
+
+ const config = LEGEND_SIZES[size];
+ const font = {
+ size: config.fontSize,
+ weight: LEGEND_FONT_WEIGHT,
+ family: fontFamily,
+ };
+ const labelWidths = items.map((item) => measureText(item.name, font));
+ const itemWidths = labelWidths.map(
+ (labelWidth) => config.dotSize + config.dotGap + labelWidth,
+ );
+
+ const availableWidth = width - config.horizontalPadding;
+ const availableHorizontalWidth = Math.min(
+ availableWidth,
+ horizontalWidth - LEGEND_PADDING * 2,
+ );
+ const itemsWidth = sum(itemWidths) + config.itemGap * (items.length - 1);
+ if (itemsWidth <= availableHorizontalWidth) {
+ return { type: "horizontal" };
+ }
+
+ const legendWidth = Math.min(
+ Math.max(...itemWidths),
+ availableWidth * MAX_VERTICAL_WIDTH_RATIO,
+ config.maxVerticalWidth,
+ );
+ const labelWidth = legendWidth - (config.dotSize + config.dotGap);
+ const truncatedCount = labelWidths.filter((w) => w > labelWidth).length;
+ const isMostlyTruncated =
+ truncatedCount > items.length * MAX_TRUNCATED_ITEMS_RATIO;
+ if (isMostlyTruncated && !alwaysVisible) {
+ return { type: "hidden" };
+ }
+
+ const availableHeight =
+ (chartHeight ?? height - config.verticalPadding) - LEGEND_PADDING * 2;
+ const rowPitch = config.fontSize * config.lineHeight + config.rowGap;
+ const maxRows = Math.floor((availableHeight + config.rowGap) / rowPitch);
+ // the last row is reserved for the "+ N more" label when items overflow
+ const visibleCount =
+ items.length <= maxRows
+ ? items.length
+ : Math.max(maxRows - 1, alwaysVisible ? 1 : 0);
+ if (visibleCount === 0) {
+ return { type: "hidden" };
+ }
+
+ const overflowCount = items.length - visibleCount;
+ const overflowLabelWidth =
+ overflowCount > 0 ? measureText(getOverflowLabel(overflowCount), font) : 0;
+ const columnWidth = Math.max(
+ legendWidth,
+ Math.min(overflowLabelWidth, config.maxVerticalWidth),
+ );
+
+ return {
+ type: "vertical",
+ width: Math.ceil(columnWidth) + LEGEND_PADDING * 2,
+ visibleCount,
+ };
+}
diff --git a/frontend/src/metabase/visualizations/components/legend/layout.unit.spec.ts b/frontend/src/metabase/visualizations/components/legend/layout.unit.spec.ts
new file mode 100644
index 00000000000..d4249f7a2d0
--- /dev/null
+++ b/frontend/src/metabase/visualizations/components/legend/layout.unit.spec.ts
@@ -0,0 +1,265 @@
+import type { LegendItemData } from "./LegendItem";
+import {
+ LEGEND_PADDING,
+ LEGEND_SIZES,
+ type LegendSize,
+ getLegendLayout,
+ getLegendSize,
+} from "./layout";
+
+const CHAR_WIDTH = 6;
+
+const measureText = (text: string) => text.length * CHAR_WIDTH;
+
+const createItems = (names: string[]): LegendItemData[] =>
+ names.map((name) => ({ key: name, name, color: "red" }));
+
+interface LayoutOpts {
+ width?: number;
+ height?: number;
+ size?: LegendSize;
+ horizontalWidth?: number;
+}
+
+const layout = (
+ names: string[],
+ { width = 600, height = 300, size = "sm", horizontalWidth }: LayoutOpts = {},
+) =>
+ getLegendLayout({
+ items: createItems(names),
+ width,
+ height,
+ size,
+ horizontalWidth,
+ fontFamily: "Lato",
+ measureText,
+ });
+
+describe("getLegendLayout", () => {
+ it("should hide the legend when there are no items", () => {
+ expect(layout([])).toEqual({ type: "hidden" });
+ });
+
+ it("should hide the legend on cards smaller than 420×200", () => {
+ expect(layout(["a", "b"], { width: 419, height: 300 })).toEqual({
+ type: "hidden",
+ });
+ expect(layout(["a", "b"], { width: 600, height: 199 })).toEqual({
+ type: "hidden",
+ });
+ expect(layout(["a", "b"], { width: 420, height: 200 })).toEqual({
+ type: "horizontal",
+ });
+ });
+
+ it("should lay items out horizontally when they fit in one row", () => {
+ // item = 8 + 6 + 5 * 6 = 44, two items + 12 gap = 100, card 420 - 32 = 388
+ expect(layout(["12345", "12345"], { width: 420 })).toEqual({
+ type: "horizontal",
+ });
+ });
+
+ it("should switch to the vertical layout when the row overflows", () => {
+ const names = Array.from({ length: 10 }, (_, i) => `series ${i}`);
+ // item = 8 + 6 + 8 * 6 = 62, 10 items + 9 * 12 gap = 728 > 388
+ expect(layout(names, { width: 420, height: 400 })).toEqual({
+ type: "vertical",
+ width: 66,
+ visibleCount: 10,
+ });
+ });
+
+ it("should switch to the vertical layout when the items do not fit within the indented legend width", () => {
+ const names = ["first", "other", "third", "fourth", "fifth"];
+
+ expect(layout(names, { width: 420 })).toEqual({ type: "horizontal" });
+ expect(
+ layout(names, {
+ width: 420,
+ horizontalWidth: 232,
+ }),
+ ).toMatchObject({ type: "vertical", visibleCount: 5 });
+ });
+
+ it("should cap the vertical legend width at 25% of the available width", () => {
+ const names = ["a".repeat(40), ...Array(6).fill("12345")];
+ // longest item = 254 > 25% of (600 - 32) = 142 < 200
+ expect(layout(names, { width: 600 })).toMatchObject({
+ type: "vertical",
+ width: 146,
+ });
+ });
+
+ it("should cap the vertical legend width at the size's maximum", () => {
+ const names = ["a".repeat(40), "b".repeat(40), ...Array(10).fill("12345")];
+ // 25% of (900 - 32) = 217 > 200
+ expect(layout(names, { width: 900 })).toMatchObject({
+ type: "vertical",
+ width: LEGEND_SIZES.sm.maxVerticalWidth + LEGEND_PADDING * 2,
+ });
+ // 25% of (1200 - 48) = 288 > 256
+ expect(layout(names, { width: 1200, size: "md" })).toMatchObject({
+ type: "vertical",
+ width: LEGEND_SIZES.md.maxVerticalWidth + LEGEND_PADDING * 2,
+ });
+ });
+
+ it("should keep the vertical legend when at most half of the items are truncated", () => {
+ // 25% of 568 = 142, label room = 128 → 22 chars fit
+ const names = [
+ "a".repeat(40),
+ "b".repeat(40),
+ "c".repeat(10),
+ "d".repeat(10),
+ ];
+ expect(layout(names, { width: 600 })).toMatchObject({
+ type: "vertical",
+ visibleCount: 4,
+ });
+ });
+
+ it("should hide the legend when more than half of the items are truncated", () => {
+ const names = [
+ "a".repeat(40),
+ "b".repeat(40),
+ "c".repeat(40),
+ "d".repeat(10),
+ ];
+ expect(layout(names, { width: 600 })).toEqual({ type: "hidden" });
+ });
+
+ it("should reserve the last row for the overflow label when rows do not fit", () => {
+ const names = Array.from({ length: 20 }, (_, i) => `series ${i}`);
+ // (200 - 16 + 8) / (14 + 8) = 8 rows, 7 items + "+ 13 more"
+ expect(layout(names, { width: 420, height: 200 })).toEqual({
+ type: "vertical",
+ width: 72,
+ visibleCount: 7,
+ });
+ });
+
+ it("should fit rows into the measured chart height when it is known", () => {
+ const names = Array.from({ length: 20 }, (_, i) => `series ${i}`);
+ // (100 + 8) / (14 + 8) = 4 rows, 3 items + "+ 17 more"
+ expect(
+ getLegendLayout({
+ items: createItems(names),
+ width: 420,
+ height: 300,
+ chartHeight: 100,
+ size: "sm",
+ fontFamily: "Lato",
+ measureText,
+ }),
+ ).toEqual({ type: "vertical", width: 72, visibleCount: 3 });
+ });
+
+ it("should use the larger metrics for the md size", () => {
+ const names = ["12345", "12345", "12345", "12345"];
+ // sm: item = 8 + 6 + 30 = 44, 4 items + 3 * 12 = 212 <= 388
+ expect(layout(names, { width: 420 })).toEqual({ type: "horizontal" });
+ // md: item = 14 + 8 + 30 = 52, 4 items + 3 * 16 = 256 <= 372
+ expect(layout(names, { width: 420, size: "md" })).toEqual({
+ type: "horizontal",
+ });
+ // md: 8 items = 416 + 112 = 528 > 372
+ expect(layout([...names, ...names], { width: 420, size: "md" })).toEqual({
+ type: "vertical",
+ width: 56,
+ visibleCount: 8,
+ });
+ });
+});
+
+describe("getLegendLayout overflow label", () => {
+ it("should widen the column to fit the '+ N more' label", () => {
+ const names = Array.from({ length: 20 }, () => "ab");
+ // item = 8 + 6 + 12 = 26 < "+ 13 more" = 9 * 6 = 54
+ expect(
+ getLegendLayout({
+ items: names.map((name, i) => ({ key: `${i}`, name, color: "red" })),
+ width: 420,
+ height: 200,
+ size: "sm",
+ fontFamily: "Lato",
+ measureText,
+ }),
+ ).toEqual({ type: "vertical", width: 58, visibleCount: 7 });
+ });
+});
+
+describe("getLegendLayout truncation at the rendered width", () => {
+ it("should hide the legend when all names are truncated by the 25% squeeze, even if they would fit a wider card", () => {
+ // labels 180 fit the 200px cap but not the squeezed 142px column
+ const names = Array.from({ length: 4 }, (_, i) => `${i}`.padEnd(30, "a"));
+ expect(layout(names, { width: 600 })).toEqual({ type: "hidden" });
+ });
+});
+
+describe("getLegendLayout alwaysVisible", () => {
+ const opts = {
+ size: "sm" as const,
+ fontFamily: "Lato",
+ measureText,
+ alwaysVisible: true,
+ };
+
+ it("should show the legend on cards below the minimum size", () => {
+ expect(
+ getLegendLayout({
+ items: createItems(["a", "b"]),
+ width: 300,
+ height: 150,
+ ...opts,
+ }),
+ ).toEqual({ type: "horizontal" });
+ });
+
+ it("should show at least one row even when nothing fits", () => {
+ const names = Array.from({ length: 8 }, () => "a".repeat(40));
+ expect(
+ getLegendLayout({
+ items: createItems(names),
+ width: 300,
+ height: 40,
+ chartHeight: 10,
+ ...opts,
+ }),
+ ).toMatchObject({ type: "vertical", visibleCount: 1 });
+ });
+});
+
+describe("getLegendSize", () => {
+ it("should pick lg for large dashboard cards and sm otherwise", () => {
+ expect(getLegendSize({ width: 640, height: 360 })).toBe("lg");
+ expect(getLegendSize({ width: 639, height: 360 })).toBe("sm");
+ expect(getLegendSize({ width: 640, height: 359 })).toBe("sm");
+ });
+
+ it("should always pick md in the query builder and fullscreen", () => {
+ expect(
+ getLegendSize({ width: 300, height: 200, isQueryBuilder: true }),
+ ).toBe("md");
+ expect(
+ getLegendSize({ width: 2000, height: 900, isFullscreen: true }),
+ ).toBe("md");
+ });
+});
+
+describe("getLegendLayout lg size", () => {
+ it("should use the roomier lg metrics for row fitting", () => {
+ const names = Array.from({ length: 20 }, (_, i) => `series ${i}`);
+ // (200 + 12) / (13.8 + 12) = 8 rows, 7 items + the overflow label
+ expect(
+ getLegendLayout({
+ items: createItems(names),
+ width: 700,
+ height: 400,
+ chartHeight: 200,
+ size: "lg",
+ fontFamily: "Lato",
+ measureText,
+ }),
+ ).toMatchObject({ type: "vertical", visibleCount: 7 });
+ });
+});
diff --git a/frontend/src/metabase/visualizations/components/settings/ChartNestedSettingSeriesSingle.unit.spec.tsx b/frontend/src/metabase/visualizations/components/settings/ChartNestedSettingSeriesSingle.unit.spec.tsx
index e419b6125a6..4a0af9c9a55 100644
--- a/frontend/src/metabase/visualizations/components/settings/ChartNestedSettingSeriesSingle.unit.spec.tsx
+++ b/frontend/src/metabase/visualizations/components/settings/ChartNestedSettingSeriesSingle.unit.spec.tsx
@@ -9,6 +9,7 @@ import { QuestionChartSettings } from "metabase/visualizations/components/ChartS
import { registerVisualizations } from "metabase/visualizations/register";
import type { ComputedVisualizationSettings } from "metabase/viz-core";
import type { Series } from "metabase-types/api";
+import { createMockInsight } from "metabase-types/api/mocks";
registerVisualizations();
@@ -88,6 +89,7 @@ function getTrendlineSeries(settings: ComputedVisualizationSettings): Series {
type: "question",
},
data: {
+ insights: [{ col: "count" }],
rows: [
["2022-04-01T00:00:00+02:00", 1],
["2022-05-01T00:00:00+02:00", 2],
@@ -125,6 +127,7 @@ function getTrendlineSeries(settings: ComputedVisualizationSettings): Series {
type: "question",
},
data: {
+ insights: [{ col: "sum" }],
rows: [
["2022-04-01T00:00:00+02:00", 3],
["2022-05-01T00:00:00+02:00", 4],
@@ -199,8 +202,8 @@ describe("ChartNestedSettingSeriesSingle", () => {
expect(
within(
screen.getByTestId("chart-settings-widget-series_settings"),
- ).getByTestId("chart-settings-widget-show_series_values"),
- ).toHaveAttribute("hidden");
+ ).queryByTestId("chart-settings-widget-show_series_values"),
+ ).not.toBeInTheDocument();
});
it("should render the `Show values for this series` switch when stackable.stack_type is null (metabase#58552)", async () => {
@@ -253,8 +256,43 @@ describe("ChartNestedSettingSeriesSingle", () => {
expect(
within(
screen.getByTestId("chart-settings-widget-series_settings"),
- ).getByTestId("chart-settings-widget-show_series_trendline"),
- ).toHaveAttribute("hidden");
+ ).queryByTestId("chart-settings-widget-show_series_trendline"),
+ ).not.toBeInTheDocument();
+ });
+
+ it("should not render the `Show trend line for this series` switch when the chart has multiple dimensions", async () => {
+ const [breakoutSeries] = getSeries();
+ setup({
+ series: [
+ {
+ ...breakoutSeries,
+ card: {
+ ...breakoutSeries.card,
+ visualization_settings: {
+ ...breakoutSeries.card.visualization_settings,
+ "graph.show_trendline": true,
+ },
+ },
+ data: {
+ ...breakoutSeries.data,
+ insights: [createMockInsight({ col: "count" })],
+ },
+ },
+ ],
+ });
+
+ const expandButtons = screen.getAllByRole("img", { name: /ellipsis/i });
+ fireEvent.click(expandButtons[1]);
+
+ await waitFor(() => {
+ screen.getByTestId("chart-settings-widget-series_settings");
+ });
+
+ expect(
+ within(
+ screen.getByTestId("chart-settings-widget-series_settings"),
+ ).queryByTestId("chart-settings-widget-show_series_trendline"),
+ ).not.toBeInTheDocument();
});
it("should not render the `Show trend line for this series` switch for a single series", async () => {
@@ -272,7 +310,7 @@ describe("ChartNestedSettingSeriesSingle", () => {
expect(
within(
screen.getByTestId("chart-settings-widget-series_settings"),
- ).getByTestId("chart-settings-widget-show_series_trendline"),
- ).toHaveAttribute("hidden");
+ ).queryByTestId("chart-settings-widget-show_series_trendline"),
+ ).not.toBeInTheDocument();
});
});
diff --git a/frontend/src/metabase/visualizations/components/settings/ChartSettingColorPicker/ChartSettingColorPicker.module.css b/frontend/src/metabase/visualizations/components/settings/ChartSettingColorPicker/ChartSettingColorPicker.module.css
new file mode 100644
index 00000000000..c1f87e0ae7e
--- /dev/null
+++ b/frontend/src/metabase/visualizations/components/settings/ChartSettingColorPicker/ChartSettingColorPicker.module.css
@@ -0,0 +1,5 @@
+.bordered {
+ padding: var(--mantine-spacing-md) var(--mantine-spacing-lg);
+ border: 1px solid var(--mb-color-border-neutral);
+ border-radius: var(--mantine-radius-sm);
+}
diff --git a/frontend/src/metabase/visualizations/components/settings/ChartSettingColorPicker/ChartSettingColorPicker.tsx b/frontend/src/metabase/visualizations/components/settings/ChartSettingColorPicker/ChartSettingColorPicker.tsx
index f94a56fac16..98113662078 100644
--- a/frontend/src/metabase/visualizations/components/settings/ChartSettingColorPicker/ChartSettingColorPicker.tsx
+++ b/frontend/src/metabase/visualizations/components/settings/ChartSettingColorPicker/ChartSettingColorPicker.tsx
@@ -4,21 +4,30 @@ import type { PillSize } from "metabase/common/components/ColorPill";
import { ColorSelector } from "metabase/common/components/ColorSelector";
import CS from "metabase/css/core/index.css";
import { isEmbeddingSdk } from "metabase/embedding-sdk/config";
-import { Box } from "metabase/ui";
+import { Box, Title } from "metabase/ui";
import { getNamedAccentColors } from "metabase/ui/colors/groups";
import type { AccentColorOptions } from "metabase/ui/colors/types";
+import S from "./ChartSettingColorPicker.module.css";
+
interface ChartSettingColorPickerProps {
className?: string;
value: string;
title?: string;
pillSize?: PillSize;
+ bordered?: boolean;
/**
* Reports the palette color name of the picked color to onChange. Off by
* default because the settings widget framework treats the second onChange
* argument as a Question override.
*/
forwardColorName?: boolean;
+ /**
+ * Must be false when the picker is rendered inside a parent Mantine popover,
+ * where a portaled color dropdown registers as an outside click and closes
+ * the parent before the selection is applied.
+ */
+ withinPortal?: boolean;
onChange?: (hexValue: string, colorName?: string) => void;
accentColorOptions?: AccentColorOptions;
}
@@ -28,7 +37,10 @@ export const ChartSettingColorPicker = ({
value,
title,
pillSize,
+ bordered,
forwardColorName,
+ // the SDK renders chart settings inside a parent Mantine popover
+ withinPortal = !isEmbeddingSdk(),
onChange,
accentColorOptions = {
main: true,
@@ -38,12 +50,15 @@ export const ChartSettingColorPicker = ({
gray: true,
},
}: ChartSettingColorPickerProps) => {
- // For the SDK the ColorSelector is rendered inside a parent Mantine popover,
- // so as a nested popover it should not be rendered within a portal
- const withinPortal = !isEmbeddingSdk();
-
return (
- <Box className={cx(CS.flex, CS.alignCenter, className)}>
+ <Box
+ className={cx(
+ CS.flex,
+ CS.alignCenter,
+ { [S.bordered]: bordered },
+ className,
+ )}
+ >
<ColorSelector
value={value}
colors={getNamedAccentColors(accentColorOptions)}
@@ -53,7 +68,11 @@ export const ChartSettingColorPicker = ({
}
pillSize={pillSize}
/>
- {title && <h4 className={CS.ml1}>{title}</h4>}
+ {title && (
+ <Title order={4} fz="md" ml={bordered ? "lg" : "sm"}>
+ {title}
+ </Title>
+ )}
</Box>
);
};
diff --git a/frontend/src/metabase/visualizations/components/settings/ChartSettingNestedSettings.tsx b/frontend/src/metabase/visualizations/components/settings/ChartSettingNestedSettings.tsx
index 13e89e7534c..7a0caace5b4 100644
--- a/frontend/src/metabase/visualizations/components/settings/ChartSettingNestedSettings.tsx
+++ b/frontend/src/metabase/visualizations/components/settings/ChartSettingNestedSettings.tsx
@@ -144,14 +144,16 @@ export const chartSettingNestedSettings = <T,>(
extra,
);
- return widgets.map((widget) => ({
- ...widget,
- style: {
- ...widget.style,
- marginLeft: 0,
- marginRight: 0,
- },
- }));
+ return widgets
+ .filter((widget) => !widget.hidden)
+ .map((widget) => ({
+ ...widget,
+ style: {
+ ...widget.style,
+ marginLeft: 0,
+ marginRight: 0,
+ },
+ }));
};
render() {
diff --git a/frontend/src/metabase/visualizations/components/settings/GraphTrendLineSettings.unit.spec.tsx b/frontend/src/metabase/visualizations/components/settings/GraphTrendLineSettings.unit.spec.tsx
new file mode 100644
index 00000000000..66f079eca22
--- /dev/null
+++ b/frontend/src/metabase/visualizations/components/settings/GraphTrendLineSettings.unit.spec.tsx
@@ -0,0 +1,140 @@
+import userEvent from "@testing-library/user-event";
+
+import { renderWithProviders, screen, within } from "__support__/ui";
+import { QuestionChartSettings } from "metabase/visualizations/components/ChartSettings";
+import { registerVisualizations } from "metabase/visualizations/register";
+import type { Series, VisualizationSettings } from "metabase-types/api";
+import {
+ createMockColumn,
+ createMockDatasetData,
+ createMockInsight,
+ createMockSingleSeries,
+} from "metabase-types/api/mocks";
+
+registerVisualizations();
+
+const CUSTOM_COLOR = "#88BF4D";
+
+// the card name differs from the metric key so a write under the wrong key
+// would be caught
+const getSeries = (visualizationSettings: VisualizationSettings): Series => [
+ createMockSingleSeries(
+ {
+ name: "Orders over time",
+ display: "line",
+ visualization_settings: {
+ "graph.dimensions": ["CREATED_AT"],
+ "graph.metrics": ["count"],
+ "graph.show_trendline": true,
+ ...visualizationSettings,
+ },
+ },
+ {
+ data: createMockDatasetData({
+ rows: [
+ ["2024-01-01T00:00:00Z", 1],
+ ["2024-02-01T00:00:00Z", 2],
+ ],
+ cols: [
+ createMockColumn({
+ name: "CREATED_AT",
+ display_name: "Created At",
+ base_type: "type/DateTime",
+ effective_type: "type/DateTime",
+ unit: "month",
+ }),
+ createMockColumn({
+ name: "count",
+ display_name: "Count",
+ base_type: "type/BigInteger",
+ effective_type: "type/BigInteger",
+ source: "aggregation",
+ }),
+ ],
+ insights: [createMockInsight({ col: "count" })],
+ }),
+ },
+ ),
+];
+
+const getStyleWidget = () =>
+ screen.getByTestId("chart-settings-widget-graph.trendline_style");
+
+const getColorWidget = () =>
+ screen.getByTestId("chart-settings-widget-graph.trendline_color");
+
+const getDashedOption = () =>
+ within(getStyleWidget()).getByRole("button", { name: /line_style_dashed/i });
+
+describe("graph trend line settings for a single series", () => {
+ describe("in the query builder", () => {
+ const setup = (visualizationSettings: VisualizationSettings = {}) => {
+ const onChange = jest.fn();
+ renderWithProviders(
+ <QuestionChartSettings
+ series={getSeries(visualizationSettings)}
+ onChange={onChange}
+ initial={{ section: "Display" }}
+ />,
+ );
+ return { onChange };
+ };
+
+ it("should write the style into the series settings under the metric key", async () => {
+ const { onChange } = setup();
+
+ await userEvent.click(
+ within(getStyleWidget()).getByRole("img", {
+ name: /line_style_dashed/i,
+ }),
+ );
+
+ const [settings] = onChange.mock.lastCall ?? [];
+ expect(settings).toMatchObject({
+ series_settings: { count: { "trendline.style": "dashed" } },
+ });
+ expect(Object.keys(settings.series_settings)).toEqual(["count"]);
+ expect(settings).not.toHaveProperty("graph.trendline_style");
+ });
+
+ it("should write the color into the series settings and keep its other settings", async () => {
+ const { onChange } = setup({
+ series_settings: { count: { "trendline.style": "dashed" } },
+ });
+
+ await userEvent.click(within(getColorWidget()).getByLabelText(/^#/));
+ await userEvent.click(
+ within(screen.getByTestId("color-selector-popover")).getByLabelText(
+ CUSTOM_COLOR,
+ ),
+ );
+
+ const [settings] = onChange.mock.lastCall ?? [];
+ expect(settings).toMatchObject({
+ series_settings: {
+ count: {
+ "trendline.style": "dashed",
+ "trendline.color": CUSTOM_COLOR,
+ },
+ },
+ });
+ expect(settings).not.toHaveProperty("graph.trendline_color");
+ });
+
+ it("should show the values stored for the series", () => {
+ setup({
+ series_settings: {
+ count: {
+ "trendline.color": CUSTOM_COLOR,
+ "trendline.style": "dashed",
+ },
+ },
+ });
+
+ expect(
+ within(getColorWidget()).getByLabelText(CUSTOM_COLOR),
+ ).toBeInTheDocument();
+ expect(getDashedOption()).toHaveAttribute("data-variant", "filled");
+ });
+ });
+});
diff --git a/frontend/src/metabase/visualizations/echarts/cartesian/option/tooltip.tsx b/frontend/src/metabase/visualizations/echarts/cartesian/option/tooltip.tsx
index c296bf3fcc0..0f5ce39b2df 100644
--- a/frontend/src/metabase/visualizations/echarts/cartesian/option/tooltip.tsx
+++ b/frontend/src/metabase/visualizations/echarts/cartesian/option/tooltip.tsx
@@ -7,8 +7,8 @@ import {
type ComputedVisualizationSettings,
type DataKey,
EChartsTooltip,
- GOAL_LINE_SERIES_ID,
getTooltipBaseOption,
+ isGoalLineSeriesId,
} from "metabase/viz-core";
import type { CardDisplayType } from "metabase-types/api";
@@ -62,7 +62,7 @@ export const getTooltipOption = (
const { dataIndex, seriesId } = params;
- if (seriesId === GOAL_LINE_SERIES_ID) {
+ if (isGoalLineSeriesId(seriesId)) {
return "";
}
diff --git a/frontend/src/metabase/visualizations/hooks/use-browser-rendering-context.ts b/frontend/src/metabase/visualizations/hooks/use-browser-rendering-context.ts
index c4364528390..1b00529500e 100644
--- a/frontend/src/metabase/visualizations/hooks/use-browser-rendering-context.ts
+++ b/frontend/src/metabase/visualizations/hooks/use-browser-rendering-context.ts
@@ -10,19 +10,21 @@ import {
} from "metabase/utils/measure-text";
import {
type RenderingContext,
+ getCartesianChartSize,
getVisualizationTheme,
} from "metabase/viz-core";
interface RenderingOptions {
fontFamily: string;
isDashboard?: boolean;
- isFullscreen?: boolean;
+ containerSize?: { width: number; height: number };
}
export const useBrowserRenderingContext = (
options: RenderingOptions,
): RenderingContext => {
- const { fontFamily, isDashboard } = options;
+ const { fontFamily, isDashboard, containerSize } = options;
+ const cartesianSize = getCartesianChartSize(containerSize);
const palette = usePalette();
const theme = useMantineTheme();
@@ -31,6 +33,7 @@ export const useBrowserRenderingContext = (
const style = getVisualizationTheme({
theme: theme.other,
isDashboard,
+ cartesianSize,
});
return {
@@ -39,7 +42,8 @@ export const useBrowserRenderingContext = (
measureTextHeight,
fontFamily: getFontFamilyValue(fontFamily),
colorScheme: theme.other?.colorScheme ?? "light",
+ cartesianSize,
theme: style,
};
- }, [fontFamily, palette, theme, isDashboard]);
+ }, [fontFamily, palette, theme, isDashboard, cartesianSize]);
};
diff --git a/frontend/src/metabase/visualizations/hooks/use-browser-rendering-context.unit.spec.tsx b/frontend/src/metabase/visualizations/hooks/use-browser-rendering-context.unit.spec.tsx
new file mode 100644
index 00000000000..72358091689
--- /dev/null
+++ b/frontend/src/metabase/visualizations/hooks/use-browser-rendering-context.unit.spec.tsx
@@ -0,0 +1,219 @@
+import { renderHookWithProviders } from "__support__/ui";
+
+import { useBrowserRenderingContext } from "./use-browser-rendering-context";
+
+type RenderingOptions = Parameters<typeof useBrowserRenderingContext>[0];
+
+function setup(options: Partial<RenderingOptions> = {}) {
+ return renderHookWithProviders(useBrowserRenderingContext, {
+ initialProps: { fontFamily: "Lato", ...options },
+ });
+}
+
+describe("useBrowserRenderingContext", () => {
+ it.each([
+ {
+ width: 0,
+ height: 0,
+ size: "small",
+ fontSize: 12,
+ marginX: 10,
+ marginY: 12,
+ axisTitle: { fontSize: 11, fontWeight: 700, marginX: 8, marginY: 16 },
+ },
+ {
+ width: 299,
+ height: 700,
+ size: "small",
+ fontSize: 12,
+ marginX: 10,
+ marginY: 12,
+ axisTitle: { fontSize: 11, fontWeight: 700, marginX: 8, marginY: 16 },
+ },
+ {
+ width: 1100,
+ height: 199,
+ size: "small",
+ fontSize: 12,
+ marginX: 10,
+ marginY: 12,
+ axisTitle: { fontSize: 11, fontWeight: 700, marginX: 8, marginY: 16 },
+ },
+ {
+ width: 300,
+ height: 200,
+ size: "medium",
+ fontSize: 12,
+ marginX: 10,
+ marginY: 12,
+ axisTitle: { fontSize: 12, fontWeight: 700, marginX: 12, marginY: 16 },
+ },
+ {
+ width: 639,
+ height: 700,
+ size: "medium",
+ fontSize: 12,
+ marginX: 10,
+ marginY: 12,
+ axisTitle: { fontSize: 12, fontWeight: 700, marginX: 12, marginY: 16 },
+ },
+ {
+ width: 1100,
+ height: 359,
+ size: "medium",
+ fontSize: 12,
+ marginX: 10,
+ marginY: 12,
+ axisTitle: { fontSize: 12, fontWeight: 700, marginX: 12, marginY: 16 },
+ },
+ {
+ width: 640,
+ height: 360,
+ size: "large",
+ fontSize: 12,
+ marginX: 10,
+ marginY: 16,
+ axisTitle: { fontSize: 12, fontWeight: 700, marginX: 24, marginY: 24 },
+ },
+ {
+ width: 899,
+ height: 700,
+ size: "large",
+ fontSize: 12,
+ marginX: 10,
+ marginY: 16,
+ axisTitle: { fontSize: 12, fontWeight: 700, marginX: 24, marginY: 24 },
+ },
+ {
+ width: 1100,
+ height: 479,
+ size: "large",
+ fontSize: 12,
+ marginX: 10,
+ marginY: 16,
+ axisTitle: { fontSize: 12, fontWeight: 700, marginX: 24, marginY: 24 },
+ },
+ {
+ width: 900,
+ height: 480,
+ size: "fullscreen",
+ fontSize: 14,
+ marginX: 14,
+ marginY: 24,
+ axisTitle: { fontSize: 14, fontWeight: 700, marginX: 40, marginY: 40 },
+ },
+ {
+ width: 1270,
+ height: 486,
+ size: "fullscreen",
+ fontSize: 14,
+ marginX: 14,
+ marginY: 24,
+ axisTitle: { fontSize: 14, fontWeight: 700, marginX: 40, marginY: 40 },
+ },
+ ])(
+ "uses $size styling for a $width by $height container",
+ ({ width, height, size, fontSize, marginX, marginY, axisTitle }) => {
+ const { result } = setup({ containerSize: { width, height } });
+
+ expect(result.current.cartesianSize).toBe(size);
+ expect(result.current.theme.cartesian.ticks).toEqual({
+ fontSize,
+ marginX,
+ marginY,
+ });
+ expect(result.current.theme.cartesian.axisTitle).toEqual(axisTitle);
+ expect(result.current.theme.cartesian.label.fontSize).toBe(13);
+ },
+ );
+
+ it.each([false, true])(
+ "uses the same size policy with isDashboard=%s",
+ (isDashboard) => {
+ const { result } = setup({
+ isDashboard,
+ containerSize: { width: 800, height: 400 },
+ });
+
+ expect(result.current.cartesianSize).toBe("large");
+ expect(result.current.theme.cartesian.ticks).toEqual({
+ fontSize: 12,
+ marginX: 10,
+ marginY: 16,
+ });
+ },
+ );
+
+ it("keeps the default rendering style when dimensions are not supplied", () => {
+ const { result } = setup();
+
+ expect(result.current.cartesianSize).toBe("fullscreen");
+ expect(result.current.theme.cartesian.ticks).toEqual({
+ fontSize: 14,
+ marginX: 14,
+ marginY: 24,
+ });
+ });
+
+ it("updates presentation when either dimension crosses a breakpoint", () => {
+ const { result, rerender } = setup({
+ containerSize: { width: 639, height: 480 },
+ });
+
+ expect(result.current.cartesianSize).toBe("medium");
+
+ rerender({
+ fontFamily: "Lato",
+ containerSize: { width: 640, height: 480 },
+ });
+ expect(result.current.cartesianSize).toBe("large");
+ expect(result.current.theme.cartesian.ticks.marginY).toBe(16);
+
+ rerender({
+ fontFamily: "Lato",
+ containerSize: { width: 900, height: 480 },
+ });
+ expect(result.current.cartesianSize).toBe("fullscreen");
+ expect(result.current.theme.cartesian.ticks.fontSize).toBe(14);
+
+ rerender({
+ fontFamily: "Lato",
+ containerSize: { width: 900, height: 479 },
+ });
+ expect(result.current.cartesianSize).toBe("large");
+ expect(result.current.theme.cartesian.ticks.fontSize).toBe(12);
+ });
+
+ it.each([
+ {
+ size: "small",
+ before: { width: 100, height: 100 },
+ after: { width: 250, height: 180 },
+ },
+ {
+ size: "medium",
+ before: { width: 300, height: 200 },
+ after: { width: 600, height: 350 },
+ },
+ {
+ size: "large",
+ before: { width: 640, height: 360 },
+ after: { width: 890, height: 470 },
+ },
+ {
+ size: "fullscreen",
+ before: { width: 900, height: 480 },
+ after: { width: 1500, height: 900 },
+ },
+ ])(
+ "reuses the context while resizing within the $size tier",
+ ({ before, after }) => {
+ const { result, rerender } = setup({ containerSize: before });
+ const previousContext = result.current;
+
+ rerender({ fontFamily: "Lato", containerSize: after });
+
+ expect(result.current).toBe(previousContext);
+ },
+ );
+});
diff --git a/frontend/src/metabase/visualizations/types/visualization.ts b/frontend/src/metabase/visualizations/types/visualization.ts
index 710c9cec401..df5a73007c1 100644
--- a/frontend/src/metabase/visualizations/types/visualization.ts
+++ b/frontend/src/metabase/visualizations/types/visualization.ts
@@ -58,7 +58,6 @@ export interface VisualizationProps {
rawSeries: RawSeries;
visualizerRawSeries?: RawSeries;
settings: ComputedVisualizationSettings;
- autoAdjustSettings?: boolean;
hiddenSeries?: Set<string>;
headerIcon?: IconProps | null;
errorIcon?: IconName | null;
diff --git a/frontend/src/metabase/visualizations/visualizations/BoxPlot/BoxPlot.tsx b/frontend/src/metabase/visualizations/visualizations/BoxPlot/BoxPlot.tsx
index 7f2654a5381..72173b88e3e 100644
--- a/frontend/src/metabase/visualizations/visualizations/BoxPlot/BoxPlot.tsx
+++ b/frontend/src/metabase/visualizations/visualizations/BoxPlot/BoxPlot.tsx
@@ -22,8 +22,8 @@ import {
getBoxPlotOption,
getBoxPlotTooltipOption,
getChartLayout,
- getDashboardAdjustedSettings,
getLegendItems,
+ getSizeAdjustedSettings,
useClickedStateTooltipSync,
useCloseTooltipOnScroll,
} from "metabase/viz-core";
@@ -34,16 +34,17 @@ import { useBoxPlotEvents } from "./events";
function BoxPlotInner({
rawSeries,
settings: originalSettings,
- autoAdjustSettings,
+ isVisualizer,
fontFamily,
card,
width,
height,
isDashboard,
- isVisualizer,
isEditing,
isQueryBuilder,
isFullscreen,
+ isMobile,
+ gridSize,
hovered,
clicked,
showTitle,
@@ -71,17 +72,20 @@ function BoxPlotInner({
const settings = useMemo(
() =>
- autoAdjustSettings
- ? getDashboardAdjustedSettings({
- settings: originalSettings,
- height,
- width,
- })
- : originalSettings,
- [originalSettings, height, width, autoAdjustSettings],
+ getSizeAdjustedSettings({
+ settings: originalSettings,
+ height,
+ width,
+ gridSize: isMobile ? undefined : gridSize, // mobile doesn't use the grid layout
+ }),
+ [originalSettings, height, width, isMobile, gridSize],
);
- const renderingContext = useBrowserRenderingContext({ fontFamily });
+ const renderingContext = useBrowserRenderingContext({
+ fontFamily,
+ isDashboard,
+ containerSize: { width, height },
+ });
const showWarning = useCallback(
(warning: string) => onRender?.({ warnings: [warning] }),
@@ -95,8 +99,15 @@ function BoxPlotInner({
settings,
Array.from(hiddenSeries),
showWarning,
+ renderingContext.cartesianSize,
),
- [rawSeriesWithRemappings, settings, hiddenSeries, showWarning],
+ [
+ rawSeriesWithRemappings,
+ settings,
+ hiddenSeries,
+ showWarning,
+ renderingContext.cartesianSize,
+ ],
);
const description = settings["card.description"];
@@ -217,15 +228,20 @@ function BoxPlotInner({
<CartesianChartLegendLayout
isReversed={settings["legend.is_reversed"]}
hasLegend={hasLegend}
+ alwaysVisible={isVisualizer}
items={legendItems}
actionButtons={!showTitle ? actionButtons : undefined}
hovered={hovered}
isFullscreen={isFullscreen}
isQueryBuilder={isQueryBuilder}
+ fontFamily={renderingContext.fontFamily}
+ measureText={renderingContext.measureText}
onToggleSeriesVisibility={handleToggleSeriesVisibility}
onHoverChange={onHoverChange}
width={width}
height={height}
+ chartHeight={chartSize.height || undefined}
+ indent={cartesianLayout.padding.left - cartesianLayout.padding.right}
>
<ResponsiveEChartsRenderer
key={hasValidOption ? "chart" : "measuring"}
diff --git a/frontend/src/metabase/visualizations/visualizations/BoxPlot/BoxPlotResponsive.stories.tsx b/frontend/src/metabase/visualizations/visualizations/BoxPlot/BoxPlotResponsive.stories.tsx
new file mode 100644
index 00000000000..3429c10cf0b
--- /dev/null
+++ b/frontend/src/metabase/visualizations/visualizations/BoxPlot/BoxPlotResponsive.stories.tsx
@@ -0,0 +1,96 @@
+import type { Meta, StoryObj } from "@storybook/react";
+
+import {
+ VisualizationWrapper,
+ createWaitForResizeToStopDecorator,
+} from "__support__/storybook";
+import { Box } from "metabase/ui";
+import Visualization from "metabase/visualizations/components/Visualization";
+import { registerVisualization } from "metabase/viz-core";
+import type { RawSeries, VisualizationSettings } from "metabase-types/api";
+import {
+ createMockCard,
+ createMockColumn,
+ createMockDatasetData,
+} from "metabase-types/api/mocks";
+
+import { BoxPlot } from "./BoxPlot";
+
+registerVisualization(BoxPlot);
+
+function ResponsiveBoxPlot({
+ width,
+ height,
+ settings = {},
+}: {
+ width: number;
+ height: number;
+ settings?: VisualizationSettings;
+}) {
+ const rawSeries: RawSeries = [
+ {
+ card: createMockCard({
+ display: "boxplot",
+ visualization_settings: {
+ "graph.dimensions": ["category"],
+ "graph.metrics": ["value"],
+ "graph.show_values": true,
+ "boxplot.show_values_mode": "all",
+ "boxplot.points_mode": "outliers",
+ "graph.y_axis.auto_range": true,
+ ...settings,
+ },
+ }),
+ data: createMockDatasetData({
+ cols: [
+ createMockColumn({
+ name: "category",
+ display_name: "Category",
+ base_type: "type/Text",
+ }),
+ createMockColumn({
+ name: "value",
+ display_name: "Value",
+ base_type: "type/Integer",
+ }),
+ ],
+ rows: ["Alpha", "Beta", "Gamma"].flatMap((category, index) =>
+ [1000, 2000, 2500, 3000, 4000, 15000].map((value) => [
+ category,
+ value * (index + 1),
+ ]),
+ ),
+ }),
+ },
+ ];
+ return (
+ <VisualizationWrapper>
+ <Box w={width} h={height}>
+ <Visualization rawSeries={rawSeries} width={width} height={height} />
+ </Box>
+ </VisualizationWrapper>
+ );
+}
+
+const meta = {
+ title: "Viz/BoxPlot/Responsive axes",
+ component: ResponsiveBoxPlot,
+ decorators: [createWaitForResizeToStopDecorator()],
+ args: { width: 500, height: 300 },
+} satisfies Meta<typeof ResponsiveBoxPlot>;
+export default meta;
+type Story = StoryObj<typeof meta>;
+
+export const Small: Story = {};
+export const Medium: Story = { args: { width: 700, height: 420 } };
+export const Large: Story = { args: { width: 960, height: 550 } };
+export const ExplicitSettings: Story = {
+ args: {
+ settings: {
+ "graph.label_value_formatting": "full",
+ "graph.y_axis.split_number": 4,
+ "graph.show_goal": true,
+ "graph.goal_value": 60000,
+ },
+ },
+};
diff --git a/frontend/src/metabase/visualizations/visualizations/BoxPlot/events.ts b/frontend/src/metabase/visualizations/visualizations/BoxPlot/events.ts
index 11487ccebc0..f04988b0c26 100644
--- a/frontend/src/metabase/visualizations/visualizations/BoxPlot/events.ts
+++ b/frontend/src/metabase/visualizations/visualizations/BoxPlot/events.ts
@@ -6,6 +6,7 @@ import type {
OnChangeCardAndRun,
VisualizationProps,
} from "metabase/visualizations/types";
+import { getGoalLineHoverData } from "metabase/visualizations/visualizations/CartesianChart/events";
import {
type BoxPlotChartModel,
type ComputedVisualizationSettings,
@@ -15,6 +16,7 @@ import {
extractSeriesDataKeyFromName,
getBoxPlotClickData,
isBoxPlotSeriesEvent,
+ isGoalLineSeriesId,
} from "metabase/viz-core";
import type { CardId, RawSeries } from "metabase-types/api";
@@ -156,6 +158,19 @@ export function useBoxPlotEvents({
eventName: "mousemove",
query: "series",
handler: (event: EChartsSeriesMouseEvent) => {
+ if (isGoalLineSeriesId(event.seriesId)) {
+ chartRef.current?.getZr().setCursorStyle("default");
+
+ const eventData = getGoalLineHoverData(
+ settings,
+ event.event.event.target,
+ chartModel.leftAxisModel?.formatGoal,
+ );
+
+ onHoverChange?.(eventData);
+ return;
+ }
+
if (!isBoxPlotSeriesEvent(event)) {
return;
}
@@ -173,7 +188,7 @@ export function useBoxPlotEvents({
handler: handleClick,
},
],
- [handleClick, chartModel, hovered, onHoverChange],
+ [chartRef, handleClick, chartModel, hovered, onHoverChange, settings],
);
return { eventHandlers };
diff --git a/frontend/src/metabase/visualizations/visualizations/CartesianChart/CartesianChart.tsx b/frontend/src/metabase/visualizations/visualizations/CartesianChart/CartesianChart.tsx
index 62a10d84eb0..cb84eedafec 100644
--- a/frontend/src/metabase/visualizations/visualizations/CartesianChart/CartesianChart.tsx
+++ b/frontend/src/metabase/visualizations/visualizations/CartesianChart/CartesianChart.tsx
@@ -32,10 +32,7 @@ import { TimelineEventsBand } from "./TimelineEventsBand";
import { useChartDebug } from "./use-chart-debug";
import { useModelsAndOption } from "./use-models-and-option";
import { useTimelineEventsHover } from "./use-timeline-events-hover";
-import {
- getDashboardAdjustedSettings,
- getHoveredFromHighlighted,
-} from "./utils";
+import { getHoveredFromHighlighted, getSizeAdjustedSettings } from "./utils";
function CartesianChartInner(props: VisualizationProps) {
const containerRef = useRef<HTMLDivElement>(null);
@@ -50,7 +47,6 @@ function CartesianChartInner(props: VisualizationProps) {
hideLegend,
rawSeries,
settings: originalSettings,
- autoAdjustSettings = false,
card,
getHref,
width: outerWidth,
@@ -64,6 +60,8 @@ function CartesianChartInner(props: VisualizationProps) {
isQueryBuilder,
isVisualizerCard,
isFullscreen,
+ isMobile,
+ gridSize,
onChangeCardAndRun,
onHoverChange,
canToggleSeriesVisibility,
@@ -77,14 +75,13 @@ function CartesianChartInner(props: VisualizationProps) {
const settings = useMemo(
() =>
- autoAdjustSettings
- ? getDashboardAdjustedSettings?.({
- settings: originalSettings,
- height: outerHeight,
- width: outerWidth,
- })
- : originalSettings,
- [originalSettings, outerHeight, outerWidth, autoAdjustSettings],
+ getSizeAdjustedSettings({
+ settings: originalSettings,
+ height: outerHeight,
+ width: outerWidth,
+ gridSize: isMobile ? undefined : gridSize, // mobile doesn't use the grid layout
+ }),
+ [originalSettings, outerHeight, outerWidth, isMobile, gridSize],
);
const { timelineEvents } = useTimelineEvents({ ...props, settings });
@@ -108,6 +105,7 @@ function CartesianChartInner(props: VisualizationProps) {
timelineEvents,
},
containerRef,
+ { width: outerWidth, height: outerHeight },
);
useChartDebug({ isQueryBuilder, rawSeries, option, chartModel });
@@ -242,11 +240,14 @@ function CartesianChartInner(props: VisualizationProps) {
<CartesianChartLegendLayout
isReversed={settings["legend.is_reversed"]}
hasLegend={hasLegend}
+ alwaysVisible={isVisualizer}
items={legendItems}
actionButtons={!showTitle ? actionButtons : undefined}
hovered={hovered}
isFullscreen={isFullscreen}
isQueryBuilder={isQueryBuilder}
+ fontFamily={renderingContext.fontFamily}
+ measureText={renderingContext.measureText}
onSelectSeries={onSelectSeries}
onToggleSeriesVisibility={
canToggleSeriesVisibility ? handleToggleSeriesVisibility : undefined
@@ -254,6 +255,8 @@ function CartesianChartInner(props: VisualizationProps) {
onHoverChange={onHoverChange}
width={outerWidth}
height={outerHeight}
+ chartHeight={chartSize.height || undefined}
+ indent={chartLayout.padding.left - chartLayout.padding.right}
>
<ResponsiveEChartsRenderer
ref={containerRef}
diff --git a/frontend/src/metabase/visualizations/visualizations/CartesianChart/CartesianPresentation.stories.tsx b/frontend/src/metabase/visualizations/visualizations/CartesianChart/CartesianPresentation.stories.tsx
new file mode 100644
index 00000000000..9fcc5d38e58
--- /dev/null
+++ b/frontend/src/metabase/visualizations/visualizations/CartesianChart/CartesianPresentation.stories.tsx
@@ -0,0 +1,125 @@
+import type { Meta, StoryObj } from "@storybook/react";
+
+import {
+ SdkVisualizationWrapper,
+ VisualizationWrapper,
+ createWaitForResizeToStopDecorator,
+} from "__support__/storybook";
+import type { MetabaseTheme } from "metabase/embedding-sdk/theme";
+import { Box, Stack, Text } from "metabase/ui";
+import Visualization from "metabase/visualizations/components/Visualization";
+import { BarChart } from "metabase/visualizations/visualizations/BarChart";
+import { registerVisualization } from "metabase/viz-core";
+import type { RawSeries } from "metabase-types/api";
+import {
+ createMockCard,
+ createMockColumn,
+ createMockDatasetData,
+} from "metabase-types/api/mocks";
+
+registerVisualization(BarChart);
+
+const series: RawSeries = [
+ {
+ card: createMockCard({
+ display: "bar",
+ visualization_settings: {
+ "graph.dimensions": ["category"],
+ "graph.metrics": ["total"],
+ },
+ }),
+ data: createMockDatasetData({
+ cols: [
+ createMockColumn({
+ name: "category",
+ display_name: "Category",
+ base_type: "type/Text",
+ }),
+ createMockColumn({
+ name: "total",
+ display_name: "Total",
+ base_type: "type/Integer",
+ }),
+ ],
+ rows: [
+ ["Alpha", 1200],
+ ["Beta", 2400],
+ ["Gamma", 3600],
+ ],
+ }),
+ },
+];
+
+function ChartContexts({ width, height }: { width: number; height: number }) {
+ return (
+ <VisualizationWrapper>
+ <Stack gap="md" w={width}>
+ {["question", "dashboard", "document"].map((context) => (
+ <Box key={context}>
+ <Text>
+ {context} ({width} × {height})
+ </Text>
+ <Box w={width} h={height}>
+ <Visualization
+ rawSeries={series}
+ width={width}
+ height={height}
+ isDashboard={context === "dashboard"}
+ isDocument={context === "document"}
+ />
+ </Box>
+ </Box>
+ ))}
+ </Stack>
+ </VisualizationWrapper>
+ );
+}
+
+const meta = {
+ title: "Viz/Cartesian presentation",
+ component: ChartContexts,
+ args: { width: 280, height: 180 },
+ decorators: [createWaitForResizeToStopDecorator()],
+} satisfies Meta<typeof ChartContexts>;
+export default meta;
+
+type Story = StoryObj<typeof meta>;
+
+export const SmallContexts: Story = { args: { width: 280, height: 180 } };
+export const MediumContexts: Story = { args: { width: 440, height: 280 } };
+export const LargeContexts: Story = { args: { width: 700, height: 400 } };
+export const FullscreenContexts: Story = { args: { width: 960, height: 500 } };
+
+function SdkChart({ theme }: { theme: MetabaseTheme }) {
+ return (
+ <SdkVisualizationWrapper theme={theme}>
+ <Box w={640} h={360} bg="background-primary">
+ <Visualization rawSeries={series} width={640} height={360} />
+ </Box>
+ </SdkVisualizationWrapper>
+ );
+}
+
+export const SdkLight: Story = {
+ render: () => <SdkChart theme={{ preset: "light" }} />,
+};
+export const SdkDark: Story = {
+ render: () => <SdkChart theme={{ preset: "dark" }} />,
+};
+export const SdkCustomBorder: Story = {
+ render: () => <SdkChart theme={{ colors: { border: "seagreen" } }} />,
+};
+export const SdkCustomGridlineAndFont: Story = {
+ render: () => (
+ <SdkChart
+ theme={{
+ fontSize: "20px",
+ components: {
+ cartesian: {
+ splitLine: { lineStyle: { color: "var(--mb-color-brand)" } },
+ },
+ },
+ }}
+ />
+ ),
+};
diff --git a/frontend/src/metabase/visualizations/visualizations/CartesianChart/events.ts b/frontend/src/metabase/visualizations/visualizations/CartesianChart/events.ts
index 3f859901e22..1bdb5811af6 100644
--- a/frontend/src/metabase/visualizations/visualizations/CartesianChart/events.ts
+++ b/frontend/src/metabase/visualizations/visualizations/CartesianChart/events.ts
@@ -881,13 +881,10 @@ export const getOtherSeriesTooltipModel = (
export const getGoalLineHoverData = (
settings: ComputedVisualizationSettings,
- event: EChartsSeriesMouseEvent,
+ element: EventTarget | null,
formatGoal?: AxisFormatter,
) => {
- // Unjustified type cast. FIXME
- const element = event.event.event.target as Element;
-
- if (element?.nodeName !== "text") {
+ if (!(element instanceof Element)) {
return null;
}
diff --git a/frontend/src/metabase/visualizations/visualizations/CartesianChart/events.unit.spec.ts b/frontend/src/metabase/visualizations/visualizations/CartesianChart/events.unit.spec.ts
index cceecbe7b2e..d0e6c68ef7b 100644
--- a/frontend/src/metabase/visualizations/visualizations/CartesianChart/events.unit.spec.ts
+++ b/frontend/src/metabase/visualizations/visualizations/CartesianChart/events.unit.spec.ts
@@ -27,6 +27,7 @@ import {
getAdjustedBrushEndEvent,
getBrushClickObject,
getEventDimensions,
+ getGoalLineHoverData,
getSeriesClickData,
getTooltipModel,
normalizeDimensionValue,
@@ -857,3 +858,31 @@ describe("getTooltipModel", () => {
]);
});
});
+
+describe("getGoalLineHoverData", () => {
+ const createMarkerElement = () =>
+ document.createElementNS("http://www.w3.org/2000/svg", "path");
+
+ const settings = createMockVisualizationSettings({
+ "graph.goal_value": 25000,
+ "graph.goal_label": "Goal",
+ });
+
+ it("shows the goal label and formatted value when the marker is hovered", () => {
+ const hoverData = getGoalLineHoverData(
+ settings,
+ createMarkerElement(),
+ (value) => `${value} orders`,
+ );
+
+ expect(hoverData?.data).toEqual([
+ { col: null, key: "Goal", value: "25000 orders" },
+ ]);
+ });
+
+ it("anchors the tooltip to the hovered marker element", () => {
+ const marker = createMarkerElement();
+
+ expect(getGoalLineHoverData(settings, marker)?.element).toBe(marker);
+ });
+});
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 af8aadb0f63..68f77fe072a 100644
--- a/frontend/src/metabase/visualizations/visualizations/CartesianChart/use-chart-events.ts
+++ b/frontend/src/metabase/visualizations/visualizations/CartesianChart/use-chart-events.ts
@@ -23,12 +23,12 @@ import {
type EChartsSeriesBrushEvent,
type EChartsSeriesBrushSelectedEvent,
type EChartsSeriesMouseEvent,
- GOAL_LINE_SERIES_ID,
INDEX_KEY,
type RenderingContext,
buildBrushMirrorGraphics,
buildClearBrushMirrorGraphics,
getVisualizerSeriesCardIndex,
+ isGoalLineSeriesId,
isLineXBrushRange,
useClickedStateTooltipSync,
} from "metabase/viz-core";
@@ -157,10 +157,12 @@ export const useChartEvents = (
return;
}
- if (event.seriesId === GOAL_LINE_SERIES_ID) {
+ if (isGoalLineSeriesId(event.seriesId)) {
+ chartRef.current?.getZr().setCursorStyle("default");
+
const eventData = getGoalLineHoverData(
settings,
- event,
+ event.event.event.target,
chartModel.leftAxisModel?.formatGoal,
);
diff --git a/frontend/src/metabase/visualizations/visualizations/CartesianChart/use-models-and-option.ts b/frontend/src/metabase/visualizations/visualizations/CartesianChart/use-models-and-option.ts
index 2eee798cd5f..3db354197e0 100644
--- a/frontend/src/metabase/visualizations/visualizations/CartesianChart/use-models-and-option.ts
+++ b/frontend/src/metabase/visualizations/visualizations/CartesianChart/use-models-and-option.ts
@@ -35,16 +35,17 @@ export function useModelsAndOption(
timelineEvents,
selectedTimelineEventIds = NO_SELECTED_TIMELINE_EVENT_IDS,
onRender,
- isFullscreen,
- gridSize,
+ isDashboard,
}: VisualizationProps,
containerRef: React.RefObject<HTMLDivElement>,
+ containerSize: Pick<VisualizationProps, "width" | "height">,
) {
const tc = useTranslateContent();
const renderingContext = useBrowserRenderingContext({
fontFamily,
- isFullscreen,
+ isDashboard,
+ containerSize,
});
const seriesToRender = useMemo(
@@ -87,7 +88,6 @@ export function useModelsAndOption(
Array.from(hiddenSeries),
renderingContext,
showWarning,
- gridSize,
);
if (model.dimensionModel.column) {
@@ -103,7 +103,6 @@ export function useModelsAndOption(
hiddenSeries,
renderingContext,
showWarning,
- gridSize,
tc,
]);
diff --git a/frontend/src/metabase/visualizations/visualizations/CartesianChart/utils.ts b/frontend/src/metabase/visualizations/visualizations/CartesianChart/utils.ts
index 56e10db195b..8c45612a620 100644
--- a/frontend/src/metabase/visualizations/visualizations/CartesianChart/utils.ts
+++ b/frontend/src/metabase/visualizations/visualizations/CartesianChart/utils.ts
@@ -10,15 +10,15 @@ import {
type HoveredObject,
type SeriesModel,
X_AXIS_DATA_KEY,
- getDashboardAdjustedSettings,
getDatasetKey,
+ getSizeAdjustedSettings,
} from "metabase/viz-core";
import type { RawSeries } from "metabase-types/api";
import { normalizeDimensionValue } from "./events";
import type { CartesianHoveredObject } from "./types";
-export { getDashboardAdjustedSettings };
+export { getSizeAdjustedSettings };
export const getHoveredSeriesDataKey = (
seriesModels: SeriesModel[],
diff --git a/frontend/src/metabase/visualizations/visualizations/PieChart/PieChart.tsx b/frontend/src/metabase/visualizations/visualizations/PieChart/PieChart.tsx
index 25e1fff700b..847e214c9d6 100644
--- a/frontend/src/metabase/visualizations/visualizations/PieChart/PieChart.tsx
+++ b/frontend/src/metabase/visualizations/visualizations/PieChart/PieChart.tsx
@@ -24,15 +24,8 @@ import { PIE_CHART_DEFINITION } from "./definition";
import { useChartEvents } from "./use-chart-events";
function PieChartComponent(props: VisualizationProps) {
- const {
- fontFamily,
- rawSeries,
- settings,
- onRender,
- isDashboard,
- isDocument,
- isFullscreen,
- } = props;
+ const { fontFamily, rawSeries, settings, onRender, isDashboard, isDocument } =
+ props;
const hoveredIndex = props.hovered?.index;
const hoveredSliceKeyPath = props.hovered?.pieSliceKeyPath;
@@ -52,7 +45,6 @@ function PieChartComponent(props: VisualizationProps) {
const renderingContext = useBrowserRenderingContext({
fontFamily,
isDashboard,
- isFullscreen,
});
const seriesToRender = useMemo(
() => extractRemappings(rawSeries),
diff --git a/frontend/src/metabase/visualizations/visualizations/RowChart/RowChart.tsx b/frontend/src/metabase/visualizations/visualizations/RowChart/RowChart.tsx
index 28cc440e864..42b15a02b6a 100644
--- a/frontend/src/metabase/visualizations/visualizations/RowChart/RowChart.tsx
+++ b/frontend/src/metabase/visualizations/visualizations/RowChart/RowChart.tsx
@@ -15,6 +15,7 @@ import {
import { useRowChartTheme } from "metabase/visualizations/visualizations/RowChart/utils/theme";
import {
type BarData,
+ type ChartGoal,
type GroupedDatum,
type HoveredData,
type RemappingHydratedChartData,
@@ -78,6 +79,7 @@ const RowChartVisualization = ({
actionButtons,
isFullscreen,
isQueryBuilder,
+ isVisualizer,
isDashboard,
onRender,
onHoverChange,
@@ -176,6 +178,24 @@ const RowChartVisualization = ({
});
};
+ const handleGoalHover = (event: React.MouseEvent, goal: ChartGoal | null) => {
+ if (goal == null) {
+ onHoverChange?.(null);
+ return;
+ }
+
+ onHoverChange?.({
+ element: event.currentTarget,
+ data: [
+ {
+ col: null,
+ key: goal.label,
+ value: tickFormatters.xTickFormatter(goal.value),
+ },
+ ],
+ });
+ };
+
const openQuestion = () => {
if (onChangeCardAndRun) {
onChangeCardAndRun({
@@ -249,8 +269,7 @@ const RowChartVisualization = ({
});
}, [fontFamily]);
- const hasBreakout =
- settings["graph.dimensions"] && settings["graph.dimensions"]?.length > 1;
+ const hasBreakout = (settings["graph.dimensions"]?.length ?? 0) > 1;
const hasLegend = !hideLegend && (series.length > 1 || hasBreakout);
return (
@@ -270,12 +289,15 @@ const RowChartVisualization = ({
width={outerWidth}
height={outerHeight}
hasLegend={hasLegend}
+ alwaysVisible={isVisualizer}
items={legendItems}
actionButtons={!hasTitle ? actionButtons : undefined}
hovered={hovered}
onHoverChange={onHoverChange}
isFullscreen={isFullscreen}
isQueryBuilder={isQueryBuilder}
+ fontFamily={fontFamily}
+ measureText={textMeasurer}
onSelectSeries={handleSelectSeries}
>
<RowChartRenderer
@@ -293,6 +315,7 @@ const RowChartVisualization = ({
hoveredData={hoverData}
onClick={handleClick}
onHover={handleHover}
+ onGoalHover={handleGoalHover}
xLabel={xLabel}
yLabel={yLabel}
xScaleType={settings["graph.y_axis.scale"]}
diff --git a/frontend/src/metabase/visualizations/visualizations/RowChart/utils/theme.ts b/frontend/src/metabase/visualizations/visualizations/RowChart/utils/theme.ts
index 58e927c9dbc..1b344f41729 100644
--- a/frontend/src/metabase/visualizations/visualizations/RowChart/utils/theme.ts
+++ b/frontend/src/metabase/visualizations/visualizations/RowChart/utils/theme.ts
@@ -33,13 +33,20 @@ export const useRowChartTheme = (
},
},
goal: {
- lineStroke: color("text-secondary"),
+ lineStroke: color("icon-primary"),
+ lineShadowStroke: color("background_surface-primary"),
label: {
size: cartesian.goalLine.label.fontSize,
weight: 400,
color: color("text-secondary"),
family: fontFamily,
},
+ marker: {
+ iconColor: color("icon-primary"),
+ backgroundColor: color("background_surface-primary"),
+ hoverBackgroundColor: color("background_surface-primary-hover"),
+ shadowColor: color("shadow-default"),
+ },
},
dataLabels: {
weight: 400,
diff --git a/frontend/src/metabase/viz-core/echarts/boxplot/model/index.ts b/frontend/src/metabase/viz-core/echarts/boxplot/model/index.ts
index b967fc9c7c6..7dd79a07c3e 100644
--- a/frontend/src/metabase/viz-core/echarts/boxplot/model/index.ts
+++ b/frontend/src/metabase/viz-core/echarts/boxplot/model/index.ts
@@ -11,7 +11,11 @@ import {
import type { CartesianChartColumns } from "../../../lib/graph/columns";
import { getCartesianChartColumns } from "../../../lib/graph/columns";
-import type { ComputedVisualizationSettings, Extent } from "../../../types";
+import type {
+ CartesianChartSize,
+ ComputedVisualizationSettings,
+ Extent,
+} from "../../../types";
import {
ECHARTS_CATEGORY_AXIS_NULL_VALUE,
X_AXIS_DATA_KEY,
@@ -42,6 +46,7 @@ import type {
SeriesFormatters,
YAxisModel,
} from "../../cartesian/model/types";
+import { getLabelValueFormatting } from "../../cartesian/model/util";
import type { ShowWarning } from "../../types";
import { computeMultiSeriesBoxPlotData } from "./dataset";
@@ -308,6 +313,8 @@ const createBoxPlotYAxisModel = (
columnByDataKey: Record<string, DatasetColumn>,
seriesExtents: SeriesExtents,
yAxisScaleTransforms: ReturnType<typeof getAxisTransforms>,
+ isCompactFormatting: boolean | undefined,
+ hasResponsiveTicks: boolean,
isSplitRightAxis = false,
): YAxisModel | null => {
if (dataKeys.length === 0) {
@@ -320,7 +327,14 @@ const createBoxPlotYAxisModel = (
dataset,
settings,
columnByDataKey,
- { isSplitRightAxis },
+ {
+ hasResponsiveTicks,
+ isSplitRightAxis,
+ formattingOptions:
+ isCompactFormatting === undefined
+ ? undefined
+ : { compact: isCompactFormatting },
+ },
);
if (yAxisModel) {
@@ -340,6 +354,8 @@ const getBoxPlotYAxesModels = (
settings: ComputedVisualizationSettings,
columnByDataKey: Record<string, DatasetColumn>,
yAxisScaleTransforms: ReturnType<typeof getAxisTransforms>,
+ isCompactFormatting: boolean | undefined,
+ hasResponsiveTicks: boolean,
): BoxPlotYAxesModels => {
const seriesExtents = computeBoxPlotSeriesExtents(dataBySeriesAndXValue);
const [leftAxisSeriesKeys, rightAxisSeriesKeys] = getYAxisSplit(
@@ -375,6 +391,8 @@ const getBoxPlotYAxesModels = (
columnByDataKey,
seriesExtents,
yAxisScaleTransforms,
+ isCompactFormatting,
+ hasResponsiveTicks,
),
rightAxisModel: createBoxPlotYAxisModel(
visibleRightKeys,
@@ -384,6 +402,8 @@ const getBoxPlotYAxesModels = (
columnByDataKey,
seriesExtents,
yAxisScaleTransforms,
+ isCompactFormatting,
+ hasResponsiveTicks,
leftAxisSeriesKeys.size > 0,
),
leftAxisSeriesKeys,
@@ -396,7 +416,14 @@ export const getBoxPlotModel = (
settings: ComputedVisualizationSettings,
hiddenSeries: string[] = [],
showWarning?: ShowWarning,
+ cartesianSize?: CartesianChartSize,
): BoxPlotChartModel => {
+ const hasResponsiveTicks =
+ cartesianSize != null && cartesianSize !== "fullscreen";
+ const labelValueFormatting = getLabelValueFormatting(
+ settings["graph.label_value_formatting"],
+ hasResponsiveTicks,
+ );
const [singleRawSeries] = rawSeries;
const { data } = singleRawSeries;
@@ -447,7 +474,13 @@ export const getBoxPlotModel = (
boxPlotData?.outlierBelowPointsDataset ?? [];
const nonOutlierPointsDataset = boxPlotData?.nonOutlierPointsDataset ?? [];
- const labelSettings = getLabelSettings(settings, seriesModels);
+ const labelSettings = getLabelSettings(
+ {
+ ...settings,
+ "graph.label_value_formatting": labelValueFormatting,
+ },
+ seriesModels,
+ );
const {
leftAxisModel,
@@ -461,6 +494,8 @@ export const getBoxPlotModel = (
settings,
columnByDataKey,
yAxisScaleTransforms,
+ hasResponsiveTicks ? labelValueFormatting === "compact" : undefined,
+ hasResponsiveTicks,
);
const breakoutColumn =
diff --git a/frontend/src/metabase/viz-core/echarts/boxplot/option/index.ts b/frontend/src/metabase/viz-core/echarts/boxplot/option/index.ts
index 9bd58b24c2b..729d5425306 100644
--- a/frontend/src/metabase/viz-core/echarts/boxplot/option/index.ts
+++ b/frontend/src/metabase/viz-core/echarts/boxplot/option/index.ts
@@ -2,6 +2,8 @@ import type { EChartsCoreOption } from "echarts/core";
import type { YAXisOption } from "echarts/types/dist/shared";
import type { OptionSourceData } from "echarts/types/src/util/types";
+import { isNotNull } from "metabase/utils/types";
+
import type {
ComputedVisualizationSettings,
RenderingContext,
@@ -16,6 +18,7 @@ import {
getGoalLineParams,
getGoalLineSeriesOption,
} from "../../cartesian/option/goal-line";
+import { applyResponsiveYAxisTicks } from "../../cartesian/option/responsive-axis";
import { BOXPLOT_STATS } from "../constants";
import type { BoxPlotLayoutModel } from "../layout/types";
import type { BoxPlotChartModel } from "../model/types";
@@ -163,7 +166,12 @@ export const getBoxPlotOption = (
sideLabelOverflow.rightYAxisOffset,
);
- const yAxis = [leftYAxis, rightYAxis].filter(Boolean);
+ const yAxis = applyResponsiveYAxisTicks(
+ [leftYAxis, rightYAxis].filter(isNotNull),
+ chartModel,
+ { ...layoutModel, padding: adjustedPadding },
+ settings,
+ );
const boxDimensions = [
X_AXIS_DATA_KEY,
diff --git a/frontend/src/metabase/viz-core/echarts/boxplot/option/index.unit.spec.ts b/frontend/src/metabase/viz-core/echarts/boxplot/option/index.unit.spec.ts
new file mode 100644
index 00000000000..d12aac8e2ca
--- /dev/null
+++ b/frontend/src/metabase/viz-core/echarts/boxplot/option/index.unit.spec.ts
@@ -0,0 +1,283 @@
+import { DEFAULT_METABASE_COMPONENT_THEME } from "metabase/ui";
+import type { RawSeries } from "metabase-types/api";
+import {
+ createMockCard,
+ createMockColumn,
+ createMockDatasetData,
+ createMockVisualizationSettings,
+} from "metabase-types/api/mocks";
+
+import { getVisualizationTheme } from "../../../shared/utils/theme";
+import type {
+ CartesianChartSize,
+ ComputedVisualizationSettings,
+ RenderingContext,
+} from "../../../types";
+import { getChartLayout } from "../../cartesian/layout";
+import { getBoxPlotLayoutModel } from "../layout";
+import { getBoxPlotModel } from "../model";
+
+import { getBoxPlotOption } from "./index";
+
+const category = createMockColumn({ name: "category", base_type: "type/Text" });
+const metric = createMockColumn({
+ name: "value",
+ display_name: "Value",
+ base_type: "type/Integer",
+});
+const otherMetric = createMockColumn({
+ name: "other",
+ display_name: "Other",
+ base_type: "type/Integer",
+});
+const rawSeries: RawSeries = [
+ {
+ card: createMockCard({ id: 1, display: "boxplot" }),
+ data: createMockDatasetData({
+ cols: [category, metric, otherMetric],
+ rows: [1000, 2000, 2500, 3000, 4000, 15000].map((value) => [
+ "A",
+ value,
+ value * 10,
+ ]),
+ }),
+ },
+];
+
+function setup({
+ cartesianSize = "small",
+ settings: overrides = {},
+ staticViz = false,
+ height = 450,
+}: {
+ cartesianSize?: CartesianChartSize;
+ settings?: ComputedVisualizationSettings;
+ staticViz?: boolean;
+ height?: number;
+} = {}) {
+ const settings = createMockVisualizationSettings({
+ "graph.dimensions": ["category"],
+ "graph.metrics": ["value"],
+ "graph.y_axis.scale": "linear",
+ "graph.y_axis.axis_enabled": true,
+ "graph.x_axis.axis_enabled": true,
+ "graph.y_axis.auto_range": true,
+ "graph.label_value_formatting": "compact",
+ "graph.show_values": true,
+ "graph.label_value_frequency": "all",
+ "boxplot.show_values_mode": "all",
+ "boxplot.whisker_type": "tukey",
+ "boxplot.points_mode": "outliers",
+ "boxplot.show_mean": true,
+ ...overrides,
+ });
+ const renderingContext: RenderingContext = {
+ fontFamily: "Lato",
+ getColor: () => "#333333",
+ measureText: (text) => text.length * 8,
+ measureTextHeight: () => 13,
+ cartesianSize: staticViz ? undefined : cartesianSize,
+ theme: getVisualizationTheme({
+ theme: DEFAULT_METABASE_COMPONENT_THEME,
+ cartesianSize: staticViz ? undefined : cartesianSize,
+ }),
+ };
+ const model = getBoxPlotModel(
+ rawSeries,
+ settings,
+ [],
+ undefined,
+ renderingContext.cartesianSize,
+ );
+ const baseLayout = getChartLayout(
+ { ...model, dataset: model.boxDataset },
+ settings,
+ false,
+ 600,
+ height,
+ renderingContext,
+ );
+ const layout = getBoxPlotLayoutModel({
+ chartModel: model,
+ cartesianLayout: baseLayout,
+ settings,
+ chartWidth: 600,
+ renderingContext,
+ });
+ const option = getBoxPlotOption(
+ model,
+ layout,
+ settings,
+ false,
+ renderingContext,
+ );
+ return { model, layout, settings, option, renderingContext };
+}
+
+describe("responsive BoxPlot presentation", () => {
+ it.each(["small", "medium", "large", "fullscreen"] as const)(
+ "uses the %s size policy for axes and data labels",
+ (cartesianSize) => {
+ const { model } = setup({ cartesianSize });
+ const responsive = cartesianSize !== "fullscreen";
+ expect(model.leftAxisModel?.formatter(1000)).toBe(
+ responsive ? "1.0k" : "1,000",
+ );
+ expect(
+ model.seriesLabelsFormatters[model.seriesModels[0].dataKey]?.(1000),
+ ).toBe("1.0k");
+ expect(model.leftAxisModel?.formatGoal(1000)).toBe("1,000");
+ },
+ );
+
+ it("keeps native fullscreen-axis formatting when data labels are hidden", () => {
+ const { model } = setup({
+ cartesianSize: "fullscreen",
+ settings: { "graph.show_values": false },
+ });
+
+ expect(model.leftAxisModel?.formatter(1000)).toBe("1,000");
+ });
+
+ it("preserves native tick density on fullscreen boxplots", () => {
+ const { option } = setup({ cartesianSize: "fullscreen" });
+ expect(option).toMatchObject({
+ yAxis: [
+ {
+ axisTick: expect.not.objectContaining({
+ customValues: expect.any(Array),
+ }),
+ },
+ ],
+ });
+ });
+
+ it.each([
+ { formatting: "full", expected: "1,000" },
+ { formatting: "compact", expected: "1.0k" },
+ ] as const)(
+ "preserves explicit $formatting formatting",
+ ({ formatting, expected }) => {
+ const { model } = setup({
+ settings: { "graph.label_value_formatting": formatting },
+ });
+ expect(model.leftAxisModel?.formatter(1000)).toBe(expected);
+ expect(
+ model.seriesLabelsFormatters[model.seriesModels[0].dataKey]?.(1000),
+ ).toBe(expected);
+ },
+ );
+
+ it("preserves statistics and the existing static export axes", () => {
+ const browser = setup();
+ const exported = setup({ staticViz: true });
+ expect(browser.model.boxDataset).toEqual(exported.model.boxDataset);
+ expect(browser.model.dataBySeriesAndXValue).toEqual(
+ exported.model.dataBySeriesAndXValue,
+ );
+ expect(browser.model.outlierAbovePointsDataset).toEqual(
+ exported.model.outlierAbovePointsDataset,
+ );
+ expect(exported.model.leftAxisModel?.formatter(1000)).toBe("1,000");
+ expect(exported.option).toMatchObject({
+ yAxis: [
+ {
+ axisTick: expect.not.objectContaining({
+ customValues: expect.any(Array),
+ }),
+ },
+ ],
+ });
+ });
+
+ it("uses the final adjusted plot height after reserving label overflow", () => {
+ const { model, layout, settings, renderingContext } = setup();
+ expect(layout.labelOverflow.top).toBeGreaterThan(0);
+ const adjustedPadding = {
+ ...layout.adjustedPadding,
+ top: layout.outerHeight - layout.adjustedPadding.bottom - 199,
+ };
+ const option = getBoxPlotOption(
+ model,
+ { ...layout, adjustedPadding },
+ settings,
+ false,
+ renderingContext,
+ );
+ expect(option).toMatchObject({
+ grid: { top: adjustedPadding.top },
+ yAxis: [
+ {
+ axisLabel: { customValues: [0, 15000] },
+ axisTick: { customValues: [0, 7500, 15000] },
+ },
+ ],
+ });
+ });
+
+ it("includes outliers and a goal beyond the whiskers in the responsive range", () => {
+ const { model, option } = setup({
+ settings: {
+ "graph.show_goal": true,
+ "graph.goal_value": 20000,
+ },
+ });
+ expect(model.leftAxisModel?.extent[1]).toBe(15000);
+ expect(option).toMatchObject({
+ yAxis: [
+ {
+ axisTick: {
+ customValues: expect.arrayContaining([20000]),
+ },
+ },
+ ],
+ });
+ });
+
+ it("preserves explicit tick counts and bounds", () => {
+ const { option } = setup({
+ settings: {
+ "graph.y_axis.split_number": 7,
+ "graph.y_axis.min": 500,
+ "graph.y_axis.max": 18000,
+ "graph.y_axis.auto_range": false,
+ },
+ });
+ expect(option).toMatchObject({
+ yAxis: [
+ {
+ splitNumber: 7,
+ min: 500,
+ max: 18000,
+ axisTick: expect.not.objectContaining({
+ customValues: expect.any(Array),
+ }),
+ },
+ ],
+ });
+ });
+
+ it("keeps both responsive axes on their own statistical ranges", () => {
+ const { option, model } = setup({
+ settings: {
+ "graph.metrics": ["value", "other"],
+ series: (key) => ({
+ axis: key.card._seriesKey === "value" ? "left" : "right",
+ }),
+ "graph.y_axis.auto_split": false,
+ },
+ });
+ expect(model.leftAxisModel?.extent[1]).toBe(15000);
+ expect(model.rightAxisModel?.extent[1]).toBe(150000);
+ expect(option.yAxis).toHaveLength(2);
+ expect(option).toMatchObject({
+ yAxis: [
+ { axisTick: { customValues: expect.arrayContaining([15000]) } },
+ {
+ axisTick: { customValues: expect.arrayContaining([150000]) },
+ splitLine: { lineStyle: { opacity: 0 } },
+ },
+ ],
+ });
+ });
+});
diff --git a/frontend/src/metabase/viz-core/echarts/cartesian/constants/style.ts b/frontend/src/metabase/viz-core/echarts/cartesian/constants/style.ts
index 3199a2fd852..becf2bc5e23 100644
--- a/frontend/src/metabase/viz-core/echarts/cartesian/constants/style.ts
+++ b/frontend/src/metabase/viz-core/echarts/cartesian/constants/style.ts
@@ -34,21 +34,16 @@ export const CHART_STYLE = {
barWidth: 0.8,
histogramBarWidth: 0.995,
},
- axisTicksMarginX: 5,
- axisTicksMarginY: 10,
axisTicks: {
weight: 400,
},
+ hiddenYAxisWidth: 12,
seriesLabels: {
weight: 700,
size: 13,
offset: 4,
stackedPadding: 2,
},
- axisName: {
- weight: 400,
- },
- axisNameMargin: 12,
padding: {
x: 8,
y: 12,
@@ -66,6 +61,14 @@ export const CHART_STYLE = {
size: 13,
weight: 400,
},
+ marker: {
+ outerRingRadius: 4.42,
+ innerRingRadius: 1.42,
+ ringWidth: 1.15,
+ backgroundRadius: 8,
+ shadowSpread: 1,
+ hitAreaRadius: 8,
+ },
},
opacity: {
blur: 0.3,
diff --git a/frontend/src/metabase/viz-core/echarts/cartesian/layout/index.ts b/frontend/src/metabase/viz-core/echarts/cartesian/layout/index.ts
index 277be58d0df..15cd39db8ef 100644
--- a/frontend/src/metabase/viz-core/echarts/cartesian/layout/index.ts
+++ b/frontend/src/metabase/viz-core/echarts/cartesian/layout/index.ts
@@ -138,20 +138,20 @@ const getLogScaleTickValues = (
return tickValues;
};
-const getYAxisTicksWidth = (
+const getYAxisWidth = (
axisModel: YAxisModel,
yAxisScaleTransforms: NumericAxisScaleTransforms,
settings: ComputedVisualizationSettings,
{ measureText, fontFamily, theme }: RenderingContext,
): number => {
if (!settings["graph.y_axis.axis_enabled"]) {
- return 0;
+ return CHART_STYLE.hiddenYAxisWidth;
}
const fontStyle = {
...CHART_STYLE.axisTicks,
family: fontFamily,
- size: theme.cartesian.label.fontSize,
+ size: theme.cartesian.ticks.fontSize,
};
const [min, max] = getYAxisExtentToMeasure(
@@ -211,7 +211,7 @@ const getYAxisTicksWidth = (
return measureText(formattedValue, fontStyle);
});
- return Math.max(...measuredValues);
+ return Math.max(...measuredValues) + theme.cartesian.ticks.marginY;
};
const getXAxisTicksWidth = (
@@ -221,7 +221,7 @@ const getXAxisTicksWidth = (
{ theme, measureText, fontFamily }: RenderingContext,
xTickWidthCap: number,
) => {
- const { fontSize } = theme.cartesian.label;
+ const { fontSize } = theme.cartesian.ticks;
if (!axisEnabledSetting || dataset.length === 0) {
return { firstXTickWidth: 0, lastXTickWidth: 0 };
@@ -272,7 +272,7 @@ const getXAxisTicksHeight = (
axisEnabledSetting: ComputedVisualizationSettings["graph.x_axis.axis_enabled"],
{ theme }: RenderingContext,
) => {
- const { fontSize } = theme.cartesian.label;
+ const { fontSize } = theme.cartesian.ticks;
if (!axisEnabledSetting) {
return 0;
@@ -294,7 +294,7 @@ const getXAxisTicksHeight = (
`Unexpected "graph.x_axis.axis_enabled" value ${axisEnabledSetting}`,
);
- return fontSize + CHART_STYLE.axisNameMargin;
+ return fontSize + theme.cartesian.axisTitle.marginX;
};
const X_LABEL_HEIGHT_RATIO_THRESHOLD = 0.7; // x-axis labels cannot be taller than 70% of chart height
@@ -309,7 +309,7 @@ const getAutoAxisEnabledSetting = (
renderingContext: RenderingContext,
): ComputedVisualizationSettings["graph.x_axis.axis_enabled"] => {
const { xAxisModel } = input;
- const { fontSize } = renderingContext.theme.cartesian.label;
+ const { fontSize } = renderingContext.theme.cartesian.ticks;
const shouldAutoSelectSetting =
settings["graph.x_axis.axis_enabled"] === true &&
@@ -373,7 +373,7 @@ const getXTicksToMeasure = (
renderingContext: RenderingContext,
) => {
const { xAxisModel } = input;
- const { fontSize } = renderingContext.theme.cartesian.label;
+ const { fontSize } = renderingContext.theme.cartesian.ticks;
const dataset = getDataset(input);
if (isNumericAxis(xAxisModel) || isTimeSeriesAxis(xAxisModel)) {
@@ -408,7 +408,7 @@ const getMaxXTickWidth = (
renderingContext,
);
- const { fontSize } = renderingContext.theme.cartesian.label;
+ const { fontSize } = renderingContext.theme.cartesian.ticks;
const fontStyle = {
...CHART_STYLE.axisTicks,
size: fontSize,
@@ -444,23 +444,21 @@ const getTicksDimensions = (
};
if (leftAxisModel) {
- ticksDimensions.yTicksWidthLeft =
- getYAxisTicksWidth(
- leftAxisModel,
- yAxisScaleTransforms,
- settings,
- renderingContext,
- ) + CHART_STYLE.axisTicksMarginY;
+ ticksDimensions.yTicksWidthLeft = getYAxisWidth(
+ leftAxisModel,
+ yAxisScaleTransforms,
+ settings,
+ renderingContext,
+ );
}
if (rightAxisModel) {
- ticksDimensions.yTicksWidthRight =
- getYAxisTicksWidth(
- rightAxisModel,
- yAxisScaleTransforms,
- settings,
- renderingContext,
- ) + CHART_STYLE.axisTicksMarginY;
+ ticksDimensions.yTicksWidthRight = getYAxisWidth(
+ rightAxisModel,
+ yAxisScaleTransforms,
+ settings,
+ renderingContext,
+ );
}
const currentBoundaryWidth =
@@ -511,15 +509,15 @@ const getTicksDimensions = (
getXAxisTicksHeight(maxXTickWidth, axisEnabledSetting, renderingContext) +
(isTimeSeries && hasTimelineEvents
? CHART_STYLE.timelineEvents.height
- : CHART_STYLE.axisTicksMarginX);
+ : renderingContext.theme.cartesian.ticks.marginX);
ticksDimensions.getXTickWidth = (text: string) => {
if (axisEnabledSetting === "rotate-90") {
- return renderingContext.theme.cartesian.label.fontSize;
+ return renderingContext.theme.cartesian.ticks.fontSize;
}
const width = renderingContext.measureText(text, {
...CHART_STYLE.axisTicks,
- size: renderingContext.theme.cartesian.label.fontSize,
+ size: renderingContext.theme.cartesian.ticks.fontSize,
family: renderingContext.fontFamily,
});
if (axisEnabledSetting === "rotate-45") {
@@ -654,11 +652,14 @@ export const getCartesianChartPadding = (
chartWidth: number,
renderingContext: RenderingContext,
): Padding => {
- const { leftAxisModel, rightAxisModel } = input;
- const { fontSize } = renderingContext.theme.cartesian.label;
-
- const axisNameFontSize = fontSize;
- const seriesLabelFontSize = fontSize;
+ const { xAxisModel, leftAxisModel, rightAxisModel } = input;
+ const { fontSize: seriesLabelFontSize } =
+ renderingContext.theme.cartesian.label;
+ const {
+ fontSize: axisTitleFontSize,
+ marginX,
+ marginY,
+ } = renderingContext.theme.cartesian.axisTitle;
const padding: Padding = {
top: CHART_STYLE.padding.y,
@@ -669,11 +670,13 @@ export const getCartesianChartPadding = (
// 1. Top Padding
+ const hasGoalLabel =
+ renderingContext.isStatic &&
+ settings["graph.show_goal"] &&
+ !!settings["graph.goal_label"];
+
// Prevent data labels from being rendered outside the chart
- if (
- settings["graph.show_values"] ||
- (settings["graph.show_goal"] && settings["graph.goal_label"])
- ) {
+ if (settings["graph.show_values"] || hasGoalLabel) {
padding.top += seriesLabelFontSize + CHART_STYLE.seriesLabels.offset;
}
@@ -681,14 +684,13 @@ export const getCartesianChartPadding = (
padding.bottom += ticksDimensions.xTicksHeight;
- const hasXAxisName = settings["graph.x_axis.labels_enabled"];
- if (hasXAxisName) {
- padding.bottom += axisNameFontSize / 2 + CHART_STYLE.axisNameMargin;
+ if (xAxisModel.label) {
+ padding.bottom += axisTitleFontSize / 2 + marginX;
}
// 3. Side (Left and Right) Padding
- const yAxisNameTotalWidth = axisNameFontSize + CHART_STYLE.axisNameMargin;
+ const yAxisNameTotalWidth = axisTitleFontSize + marginY;
padding.left += ticksDimensions.yTicksWidthLeft;
if (leftAxisModel?.label) {
@@ -700,6 +702,16 @@ export const getCartesianChartPadding = (
padding.right += yAxisNameTotalWidth;
}
+ const hasGoalMarker =
+ settings["graph.show_goal"] &&
+ settings["graph.goal_value"] != null &&
+ !renderingContext.isStatic; // Static renders show a label instead.
+
+ if (hasGoalMarker) {
+ const { backgroundRadius, shadowSpread } = CHART_STYLE.goalLine.marker;
+ padding.right = Math.max(padding.right, backgroundRadius + shadowSpread);
+ }
+
const { firstTickOverflow, lastTickOverflow } = getTicksOverflow(
input,
settings,
@@ -749,7 +761,7 @@ const areHorizontalXAxisTicksOverlapping = (
formatter: AxisFormatter,
{ theme, measureText, fontFamily }: RenderingContext,
) => {
- const { fontSize } = theme.cartesian.label;
+ const { fontSize } = theme.cartesian.ticks;
const fontStyle = {
...CHART_STYLE.axisTicks,
@@ -956,7 +968,7 @@ const computeSplitPanelLayout = (
const panelAxisModels = input.splitPanelYAxisModels ?? [];
const panelCount = panelAxisModels.length;
const yAxisTickWidths: number[] = panelAxisModels.map((axisModel) =>
- getYAxisTicksWidth(
+ getYAxisWidth(
axisModel,
input.yAxisScaleTransforms,
settings,
@@ -965,9 +977,7 @@ const computeSplitPanelLayout = (
);
const maxYTicksWidth =
- yAxisTickWidths.length > 0
- ? Math.max(...yAxisTickWidths) + CHART_STYLE.axisTicksMarginY
- : 0;
+ yAxisTickWidths.length > 0 ? Math.max(...yAxisTickWidths) : 0;
const singleAxisInput: ChartLayoutInput = {
...input,
diff --git a/frontend/src/metabase/viz-core/echarts/cartesian/layout/index.unit.spec.ts b/frontend/src/metabase/viz-core/echarts/cartesian/layout/index.unit.spec.ts
index 36edb3c2dbb..f99f9252db1 100644
--- a/frontend/src/metabase/viz-core/echarts/cartesian/layout/index.unit.spec.ts
+++ b/frontend/src/metabase/viz-core/echarts/cartesian/layout/index.unit.spec.ts
@@ -1,12 +1,22 @@
+import {
+ createMockCartesianChartModel,
+ createMockSeriesModel,
+} from "__support__/echarts";
+import { DEFAULT_METABASE_COMPONENT_THEME } from "metabase/ui";
import {
createMockColumn,
createMockVisualizationSettings,
} from "metabase-types/api/mocks";
-import { DEFAULT_VISUALIZATION_THEME } from "../../../shared/utils/theme";
+import {
+ DEFAULT_VISUALIZATION_THEME,
+ getVisualizationTheme,
+} from "../../../shared/utils/theme";
import type { RenderingContext } from "../../../types";
+import { X_AXIS_DATA_KEY } from "../constants/dataset";
import { CHART_STYLE } from "../constants/style";
import type { XAxisModel, YAxisModel } from "../model/types";
+import { buildAxes } from "../option/axis";
import { type ChartLayoutInput, getChartLayout } from ".";
@@ -81,6 +91,184 @@ const getChartContext = (): RenderingContext => {
};
describe("getChartLayout", () => {
+ it.each([
+ {
+ name: "fullscreen",
+ options: {},
+ fontSize: 14,
+ marginX: 14,
+ marginY: 24,
+ axisTitleFontSize: 14,
+ },
+ {
+ name: "small",
+ options: { cartesianSize: "small" as const },
+ fontSize: 12,
+ marginX: 10,
+ marginY: 12,
+ axisTitleFontSize: 11,
+ },
+ {
+ name: "medium",
+ options: { cartesianSize: "medium" as const },
+ fontSize: 12,
+ marginX: 10,
+ marginY: 12,
+ axisTitleFontSize: 12,
+ },
+ {
+ name: "large",
+ options: { cartesianSize: "large" as const },
+ fontSize: 12,
+ marginX: 10,
+ marginY: 16,
+ axisTitleFontSize: 12,
+ },
+ ])(
+ "measures and renders $name ticks with matching styles",
+ ({ options, fontSize, marginX, marginY, axisTitleFontSize }) => {
+ const chartContext = {
+ ...getChartContext(),
+ theme: getVisualizationTheme({
+ theme: DEFAULT_METABASE_COMPONENT_THEME,
+ ...options,
+ }),
+ };
+ const chartModel = createMockCartesianChartModel({
+ ...input,
+ rightAxisModel: yAxisModel,
+ transformedDataset: [
+ { [X_AXIS_DATA_KEY]: "Alpha", price: 1200 },
+ { [X_AXIS_DATA_KEY]: "Beta", price: 1500 },
+ { [X_AXIS_DATA_KEY]: "Gamma", price: 1800 },
+ ],
+ });
+ const chartSettings = createMockVisualizationSettings({
+ ...currencySettings,
+ "graph.x_axis.axis_enabled": true,
+ });
+ const chartLayout = getChartLayout(
+ chartModel,
+ chartSettings,
+ false,
+ 640,
+ 360,
+ chartContext,
+ );
+ const axes = buildAxes(
+ chartModel,
+ chartLayout,
+ chartSettings,
+ false,
+ chartContext,
+ );
+
+ expect(chartContext.measureText).toHaveBeenCalledWith(
+ "Alpha",
+ expect.objectContaining({ size: fontSize }),
+ );
+ expect(chartContext.measureText).toHaveBeenCalledWith(
+ "$720.00",
+ expect.objectContaining({ size: fontSize }),
+ );
+ expect(chartLayout.ticksDimensions.xTicksHeight).toBe(fontSize + marginX);
+ expect(chartLayout.ticksDimensions.yTicksWidthLeft).toBe(
+ WIDEST_MEASURED_TICK_WIDTH + marginY,
+ );
+ expect(chartLayout.ticksDimensions.yTicksWidthRight).toBe(
+ WIDEST_MEASURED_TICK_WIDTH + marginY,
+ );
+ expect(axes.xAxis.axisLabel).toMatchObject({ fontSize, margin: marginX });
+ expect(axes.yAxis).toHaveLength(2);
+ for (const axis of axes.yAxis) {
+ expect(axis.axisLabel).toMatchObject({ fontSize, margin: marginY });
+ expect(axis.nameTextStyle?.fontSize).toBe(axisTitleFontSize);
+ expect(axis.nameTextStyle?.fontWeight).toBe(700);
+ }
+ },
+ );
+
+ describe.each([
+ { name: "fullscreen", options: {} },
+ { name: "small", options: { cartesianSize: "small" as const } },
+ { name: "medium", options: { cartesianSize: "medium" as const } },
+ { name: "large", options: { cartesianSize: "large" as const } },
+ ])("hidden $name axes", ({ options }) => {
+ it.each([false, true])(
+ "preserves existing space with split panels %s",
+ (isSplitPanels) => {
+ const chartContext = {
+ ...getChartContext(),
+ theme: getVisualizationTheme({
+ theme: DEFAULT_METABASE_COMPONENT_THEME,
+ ...options,
+ }),
+ };
+ const chartLayout = getChartLayout(
+ {
+ ...input,
+ rightAxisModel: yAxisModel,
+ seriesModels: [createMockSeriesModel(), createMockSeriesModel()],
+ splitPanelYAxisModels: [yAxisModel, yAxisModel],
+ },
+ createMockVisualizationSettings({
+ ...settings,
+ "graph.y_axis.axis_enabled": false,
+ "graph.split_panels": isSplitPanels,
+ }),
+ false,
+ 640,
+ 360,
+ chartContext,
+ );
+
+ expect(chartLayout.ticksDimensions.yTicksWidthLeft).toBe(12);
+ expect(chartLayout.ticksDimensions.yTicksWidthRight).toBe(
+ isSplitPanels ? 0 : 12,
+ );
+ },
+ );
+ });
+
+ it("does not reserve padding for empty x- or y-axis titles", () => {
+ const chartContext = getChartContext();
+ const {
+ fontSize: axisTitleFontSize,
+ marginX,
+ marginY,
+ } = chartContext.theme.cartesian.axisTitle;
+ const chartSettings = createMockVisualizationSettings({
+ ...settings,
+ "graph.x_axis.labels_enabled": true,
+ "graph.y_axis.labels_enabled": true,
+ });
+
+ const getLayout = (xLabel: string, yLabel: string) =>
+ getChartLayout(
+ {
+ ...input,
+ xAxisModel: { ...xAxisModel, label: xLabel },
+ leftAxisModel: { ...yAxisModel, label: yLabel },
+ },
+ chartSettings,
+ false,
+ 640,
+ 360,
+ chartContext,
+ );
+
+ const empty = getLayout("", "");
+ const titled = getLayout("Created At", "Count");
+
+ expect(empty.padding.bottom).toBe(CHART_STYLE.padding.y);
+ expect(titled.padding.bottom).toBe(
+ empty.padding.bottom + axisTitleFontSize / 2 + marginX,
+ );
+ expect(titled.padding.left).toBe(
+ empty.padding.left + axisTitleFontSize + marginY,
+ );
+ });
+
it("measures actual y-axis tick labels for a zero-pinned axis (#74568)", () => {
const chartContext = getChartContext();
@@ -98,12 +286,10 @@ describe("getChartLayout", () => {
expect.anything(),
);
expect(chartLayout.ticksDimensions.yTicksWidthLeft).toBe(
- WIDEST_MEASURED_TICK_WIDTH + CHART_STYLE.axisTicksMarginY,
+ WIDEST_MEASURED_TICK_WIDTH + 24,
);
expect(chartLayout.ticksDimensions.yTicksWidthLeft).not.toBe(
- WIDEST_MEASURED_TICK_WIDTH +
- CHART_STYLE.axisTicksMarginY +
- CHART_STYLE.padding.x,
+ WIDEST_MEASURED_TICK_WIDTH + 24 + CHART_STYLE.padding.x,
);
});
});
diff --git a/frontend/src/metabase/viz-core/echarts/cartesian/model/axis.ts b/frontend/src/metabase/viz-core/echarts/cartesian/model/axis.ts
index 34d60e81568..f91a2367566 100644
--- a/frontend/src/metabase/viz-core/echarts/cartesian/model/axis.ts
+++ b/frontend/src/metabase/viz-core/echarts/cartesian/model/axis.ts
@@ -20,11 +20,7 @@ import { isAbsoluteDateTimeUnit } from "metabase-types/guards/date-time";
import { computeNumericDataInterval } from "../../../lib/numeric";
import { getLineAreaBarComparisonSettings } from "../../../lib/settings";
-import type {
- ComputedVisualizationSettings,
- Extent,
- VisualizationGridSize,
-} from "../../../types";
+import type { ComputedVisualizationSettings, Extent } from "../../../types";
import type { ShowWarning } from "../../types";
import {
ECHARTS_CATEGORY_AXIS_NULL_VALUE,
@@ -60,6 +56,9 @@ import type {
} from "./types";
import { getFormattingOptionsWithoutScaling } from "./util";
+// Default to 5 ticks for consistent behavior between single and multiple series
+const DEFAULT_Y_AXIS_SPLIT_NUMBER = 5;
+
const uniqueCards = (seriesModels: SeriesModel[]) =>
_.uniq(seriesModels.map(({ cardId }) => cardId)).length;
@@ -520,7 +519,7 @@ interface YAxisModelOptions {
stackModels?: StackModel[];
stackType?: StackType;
formattingOptions?: ColumnSettings;
- gridSize?: VisualizationGridSize;
+ hasResponsiveTicks?: boolean;
showLabel?: boolean;
isSplitRightAxis?: boolean;
}
@@ -537,7 +536,7 @@ export function getYAxisModel(
stackModels = [],
stackType = null,
formattingOptions,
- gridSize,
+ hasResponsiveTicks = false,
showLabel = true,
isSplitRightAxis = false,
} = options;
@@ -579,12 +578,11 @@ export function getYAxisModel(
formatter,
formatGoal,
isNormalized: stackType === "normalized",
+ hasResponsiveTicks,
splitNumber:
settings["graph.y_axis.split_number"] > 0
? settings["graph.y_axis.split_number"]
- : gridSize?.height && gridSize.height <= 5
- ? 2 // Use fewer ticks for small dashboard charts
- : 5, // Default to 5 ticks for consistent behavior between single and multiple series
+ : DEFAULT_Y_AXIS_SPLIT_NUMBER,
};
}
@@ -597,7 +595,7 @@ export function getYAxesModels(
isAutoSplitSupported: boolean,
stackModels: StackModel[],
isCompactFormatting: boolean,
- gridSize?: VisualizationGridSize,
+ hasResponsiveTicks = false,
) {
const [leftAxisSeriesKeysSet, rightAxisSeriesKeysSet] = getYAxisSplit(
seriesModels,
@@ -640,7 +638,7 @@ export function getYAxesModels(
stackModels: leftStackModels,
stackType: settings["stackable.stack_type"] ?? null,
formattingOptions: { compact: isCompactFormatting },
- gridSize,
+ hasResponsiveTicks,
},
);
@@ -657,7 +655,7 @@ export function getYAxesModels(
? null
: (settings["stackable.stack_type"] ?? null),
formattingOptions: { compact: isCompactFormatting },
- gridSize,
+ hasResponsiveTicks,
// A right axis alone uses the left label. Legend visibility must not
// change which label it uses.
isSplitRightAxis: leftAxisSeriesKeysSet.size > 0,
@@ -676,7 +674,7 @@ export function getYAxesModels(
columnByDataKey,
{
formattingOptions: { compact: isCompactFormatting },
- gridSize,
+ hasResponsiveTicks,
showLabel: false,
},
),
diff --git a/frontend/src/metabase/viz-core/echarts/cartesian/model/index.ts b/frontend/src/metabase/viz-core/echarts/cartesian/model/index.ts
index 7cd1c8b238f..b393830b1a3 100644
--- a/frontend/src/metabase/viz-core/echarts/cartesian/model/index.ts
+++ b/frontend/src/metabase/viz-core/echarts/cartesian/model/index.ts
@@ -11,7 +11,6 @@ import { getAreDimensionsAndMetricsValid } from "../../../shared/settings/cartes
import type {
ComputedVisualizationSettings,
RenderingContext,
- VisualizationGridSize,
} from "../../../types";
import type { ShowWarning } from "../../types";
import { OTHER_DATA_KEY } from "../constants/dataset";
@@ -39,6 +38,7 @@ import { getStackModels } from "./stack";
import { getAxisTransforms } from "./transforms";
import { getTrendLines } from "./trend-line";
import type { CartesianChartModel } from "./types";
+import { getLabelValueFormatting } from "./util";
// HACK: when multiple cards (datasets) are combined on a single dashboard card
// the settings prop of the visualization contains only one set of metrics and dimensions
@@ -147,8 +147,10 @@ export const getCartesianChartModel = (
hiddenSeries: string[],
renderingContext: RenderingContext,
showWarning?: ShowWarning,
- gridSize?: VisualizationGridSize,
): CartesianChartModel => {
+ const hasResponsiveTicks =
+ renderingContext.cartesianSize != null &&
+ renderingContext.cartesianSize !== "fullscreen";
const cardsColumns = getCardsColumns(rawSeries, settings);
const columnByDataKey = getCardsColumnByDataKeyMap(rawSeries, cardsColumns);
const dimensionModel = getDimensionModel(rawSeries, cardsColumns);
@@ -196,7 +198,13 @@ export const getCartesianChartModel = (
seriesLabelsFormatters,
stackedLabelsFormatters,
isCompactFormatting,
- } = getFormatters(seriesModels, stackModels, scaledDataset, settings);
+ } = getFormatters(seriesModels, stackModels, scaledDataset, {
+ ...settings,
+ "graph.label_value_formatting": getLabelValueFormatting(
+ settings["graph.label_value_formatting"],
+ hasResponsiveTicks,
+ ),
+ });
const dataDensity = getComboChartDataDensity(
seriesModels,
@@ -218,7 +226,7 @@ export const getCartesianChartModel = (
true,
stackModels,
isCompactFormatting,
- gridSize,
+ hasResponsiveTicks,
);
const trendLinesModel = getTrendLines(
diff --git a/frontend/src/metabase/viz-core/echarts/cartesian/model/index.unit.spec.ts b/frontend/src/metabase/viz-core/echarts/cartesian/model/index.unit.spec.ts
index fb4a6a24a2b..3afba826573 100644
--- a/frontend/src/metabase/viz-core/echarts/cartesian/model/index.unit.spec.ts
+++ b/frontend/src/metabase/viz-core/echarts/cartesian/model/index.unit.spec.ts
@@ -1,13 +1,162 @@
-import type { SingleSeries } from "metabase-types/api";
+import type { DatasetColumn, SingleSeries } from "metabase-types/api";
import {
createMockCard,
createMockColumn,
createMockDatasetData,
+ createMockVisualizationSettings,
} from "metabase-types/api/mocks";
-import type { ComputedVisualizationSettings } from "../../../types";
+import { DEFAULT_VISUALIZATION_THEME } from "../../../shared/utils/theme";
+import type {
+ CartesianChartSize,
+ ComputedVisualizationSettings,
+ RenderingContext,
+} from "../../../types";
+import { getScatterPlotModel } from "../scatter/model";
+import { getWaterfallChartModel } from "../waterfall/model";
-import { getCardsReferencedColumns } from "./index";
+import { getCardsReferencedColumns, getCartesianChartModel } from "./index";
+
+describe.each([
+ { display: "bar", getModel: getCartesianChartModel },
+ { display: "scatter", getModel: getScatterPlotModel },
+ { display: "waterfall", getModel: getWaterfallChartModel },
+] as const)("$display chart label formatting", ({ display, getModel }) => {
+ const renderingContext: RenderingContext = {
+ getColor: (name) => name,
+ measureText: () => 10,
+ measureTextHeight: () => 10,
+ fontFamily: "",
+ theme: DEFAULT_VISUALIZATION_THEME,
+ };
+
+ const buildModel = (
+ formatting: "auto" | "compact" | "full" | undefined,
+ cartesianSize?: CartesianChartSize,
+ showValues = false,
+ extraSettings: Partial<ComputedVisualizationSettings> = {},
+ ) => {
+ const dimensionColumn = createMockColumn({
+ name: "bucket",
+ base_type: "type/Integer",
+ });
+ const metricColumn = createMockColumn({
+ name: "count",
+ base_type: "type/Integer",
+ semantic_type: "type/Quantity",
+ });
+
+ return getModel(
+ [
+ {
+ card: createMockCard({ id: 1, display }),
+ data: createMockDatasetData({
+ cols: [dimensionColumn, metricColumn],
+ rows: [
+ [1, 1000],
+ [2, 2000],
+ ],
+ }),
+ },
+ ],
+ createMockVisualizationSettings({
+ "graph.dimensions": [dimensionColumn.name],
+ "graph.metrics": [metricColumn.name],
+ "graph.x_axis.scale": "ordinal",
+ "graph.y_axis.scale": "linear",
+ "graph.label_value_formatting": formatting,
+ "graph.show_values": showValues,
+ column: (column: DatasetColumn) => ({ column }),
+ series: () => ({ display, show_series_values: true }),
+ ...extraSettings,
+ }),
+ [],
+ { ...renderingContext, cartesianSize },
+ );
+ };
+
+ it.each(["auto", "compact", undefined] as const)(
+ "uses compact axis labels on small charts with %s formatting",
+ (formatting) => {
+ const model = buildModel(formatting, "small");
+
+ expect(model.leftAxisModel?.formatter(1000)).toBe("1.0k");
+ expect(model.leftAxisModel?.formatGoal(1000)).toBe("1,000");
+ },
+ );
+
+ it.each(["small", "medium", "large", "fullscreen", undefined] as const)(
+ "derives responsive ticks and default formatting from the %s size tier",
+ (cartesianSize) => {
+ const model = buildModel("auto", cartesianSize);
+ const isResponsive =
+ cartesianSize === "small" ||
+ cartesianSize === "medium" ||
+ cartesianSize === "large";
+
+ expect(model.leftAxisModel?.hasResponsiveTicks).toBe(isResponsive);
+ expect(model.leftAxisModel?.formatter(1000)).toBe(
+ isResponsive ? "1.0k" : "1,000",
+ );
+ },
+ );
+
+ it("preserves explicit full formatting on small charts", () => {
+ const model = buildModel("full", "small", true);
+
+ expect(model.leftAxisModel?.formatter(1000)).toBe("1,000");
+ });
+
+ it.each([false, true])(
+ "preserves automatic formatting on large charts with show values set to %s",
+ (showValues) => {
+ const model = buildModel("auto", undefined, showValues);
+
+ expect(model.leftAxisModel?.formatter(1000)).toBe("1,000");
+ },
+ );
+
+ it("preserves explicit compact formatting on large charts", () => {
+ const model = buildModel("compact", "large");
+
+ expect(model.leftAxisModel?.formatter(1000)).toBe("1.0k");
+ });
+
+ if (display !== "scatter") {
+ it.each([
+ { formatting: "auto", expected: "1.0k" },
+ { formatting: "compact", expected: "1.0k" },
+ { formatting: "full", expected: "1,000" },
+ ] as const)(
+ "uses $formatting formatting for small chart data labels",
+ ({ formatting, expected }) => {
+ const model = buildModel(formatting, "small", true);
+ const formatter =
+ "waterfallLabelFormatter" in model
+ ? model.waterfallLabelFormatter
+ : model.seriesLabelsFormatters[model.seriesModels[0].dataKey];
+
+ expect(formatter?.(1000)).toBe(expected);
+ },
+ );
+ }
+
+ if (display === "bar") {
+ it("uses compact small chart stack totals with automatic formatting", () => {
+ const model = buildModel("auto", "small", true, {
+ "stackable.stack_type": "stacked",
+ "graph.show_stack_values": "total",
+ });
+
+ const formatter =
+ "stackedLabelsFormatters" in model
+ ? model.stackedLabelsFormatters.bar
+ : undefined;
+
+ expect(formatter?.(1000)).toBe("1.0k");
+ });
+ }
+});
describe("getCardsReferencedColumns", () => {
const dimensionA = createMockColumn({
diff --git a/frontend/src/metabase/viz-core/echarts/cartesian/model/trend-line.ts b/frontend/src/metabase/viz-core/echarts/cartesian/model/trend-line.ts
index 6dc5aef785c..161c074b8e9 100644
--- a/frontend/src/metabase/viz-core/echarts/cartesian/model/trend-line.ts
+++ b/frontend/src/metabase/viz-core/echarts/cartesian/model/trend-line.ts
@@ -1,5 +1,6 @@
import Color from "color";
+import { deriveChartShadeColor } from "metabase/ui/colors/accents";
import { checkNumber, isNotNull } from "metabase/utils/types";
import type { RawSeries } from "metabase-types/api";
@@ -13,6 +14,7 @@ import { msToDays, tryGetDate } from "../utils/timeseries";
import { getScaledMinAndMax } from "./axis";
import {
+ getDatasetExtents,
getKeyBasedDatasetTransform,
getNormalizedDatasetTransform,
scaleDataset,
@@ -34,6 +36,33 @@ type TrendFn = (days: number) => number;
const getTrendKeyForSeries = (dataKey: DataKey) => `${dataKey}_trend`;
+const getTrendLineColor = (
+ seriesModel: SeriesModel,
+ customColor: string | undefined,
+ renderingContext: RenderingContext,
+) => {
+ if (customColor != null) {
+ return renderingContext.getColor(customColor);
+ }
+
+ return deriveChartShadeColor(
+ Color(renderingContext.getColor(seriesModel.color)).hex(),
+ );
+};
+
+const getTrendLineCustomization = (
+ seriesModel: SeriesModel,
+ settings: ComputedVisualizationSettings,
+) => {
+ const seriesSettings = settings.series?.(
+ seriesModel.legacySeriesSettingsObjectKey,
+ );
+ return {
+ customColor: seriesSettings?.["trendline.color"],
+ style: seriesSettings?.["trendline.style"] ?? "solid",
+ };
+};
+
const getSeriesModelsWithTrends = (
rawSeries: RawSeries,
seriesModels: SeriesModel[],
@@ -167,17 +196,23 @@ export const getTrendLines = (
});
const trendSeriesModels: TrendLineSeriesModel[] = seriesModelsWithTrends.map(
- ([seriesModel]) => ({
- dataKey: getTrendKeyForSeries(seriesModel.dataKey),
- sourceDataKey: seriesModel.dataKey,
- name: `${seriesModel.name}; trend line`, // not used in UI
- color: Color(renderingContext.getColor(seriesModel.color))
- .lighten(0.25)
- .hex(),
- visible: true,
- column: seriesModel.column,
- columnIndex: seriesModel.columnIndex,
- }),
+ ([seriesModel]) => {
+ const { customColor, style } = getTrendLineCustomization(
+ seriesModel,
+ settings,
+ );
+
+ return {
+ dataKey: getTrendKeyForSeries(seriesModel.dataKey),
+ sourceDataKey: seriesModel.dataKey,
+ name: `${seriesModel.name}; trend line`, // not used in UI
+ color: getTrendLineColor(seriesModel, customColor, renderingContext),
+ style,
+ visible: true,
+ column: seriesModel.column,
+ columnIndex: seriesModel.columnIndex,
+ };
+ },
);
const dataKeys = trendSeriesModels.map((seriesModel) => seriesModel.dataKey);
@@ -209,5 +244,6 @@ export const getTrendLines = (
return {
dataset: transformedDataset,
seriesModels: trendSeriesModels,
+ extents: getDatasetExtents(dataKeys, transformedDataset),
};
};
diff --git a/frontend/src/metabase/viz-core/echarts/cartesian/model/trend-line.unit.spec.ts b/frontend/src/metabase/viz-core/echarts/cartesian/model/trend-line.unit.spec.ts
new file mode 100644
index 00000000000..5890ee545b6
--- /dev/null
+++ b/frontend/src/metabase/viz-core/echarts/cartesian/model/trend-line.unit.spec.ts
@@ -0,0 +1,168 @@
+import { createMockSeriesModel } from "__support__/echarts";
+import { deriveChartShadeColor } from "metabase/ui/colors/accents";
+import type { RawSeries, SeriesSettings } from "metabase-types/api";
+import {
+ createMockColumn,
+ createMockDatasetData,
+ createMockInsight,
+ createMockSingleSeries,
+} from "metabase-types/api/mocks";
+
+import { DEFAULT_VISUALIZATION_THEME } from "../../../shared/utils/theme";
+import type {
+ ComputedVisualizationSettings,
+ RenderingContext,
+} from "../../../types";
+import { X_AXIS_DATA_KEY } from "../constants/dataset";
+
+import { getTrendLines } from "./trend-line";
+import type { ChartDataset, NumericAxisScaleTransforms } from "./types";
+
+const renderingContext: RenderingContext = {
+ getColor: (name) => name,
+ measureText: () => 0,
+ measureTextHeight: () => 0,
+ fontFamily: "",
+ theme: DEFAULT_VISUALIZATION_THEME,
+};
+
+const yAxisScaleTransforms: NumericAxisScaleTransforms = {
+ toEChartsAxisValue: (value) => Number(value),
+ fromEChartsAxisValue: (value) => value,
+};
+
+const SERIES_COLORS: Record<string, string> = {
+ count: "#509EE3",
+ avg: "#88BF4D",
+};
+
+const setup = ({
+ seriesSettings = {},
+ metrics = ["count", "avg"],
+}: {
+ seriesSettings?: Record<string, SeriesSettings>;
+ metrics?: string[];
+} = {}) => {
+ const rawSeries: RawSeries = [
+ createMockSingleSeries(
+ {
+ visualization_settings: {
+ "graph.show_trendline": true,
+ },
+ },
+ {
+ data: createMockDatasetData({
+ cols: [
+ createMockColumn({ name: "month" }),
+ ...metrics.map((name) => createMockColumn({ name })),
+ ],
+ insights: metrics.map((name) =>
+ createMockInsight({ col: name, slope: 1, offset: 0 }),
+ ),
+ }),
+ },
+ ),
+ ];
+
+ const seriesModels = metrics.map((name) =>
+ createMockSeriesModel({
+ dataKey: name,
+ cardId: 1,
+ column: createMockColumn({ name }),
+ color: SERIES_COLORS[name],
+ }),
+ );
+
+ const chartDataset: ChartDataset = [
+ { [X_AXIS_DATA_KEY]: "2024-01-01", count: 1, avg: 2 },
+ { [X_AXIS_DATA_KEY]: "2024-02-01", count: 2, avg: 4 },
+ ];
+
+ const settings: ComputedVisualizationSettings = {
+ "graph.show_trendline": true,
+ "graph.y_axis.auto_range": true,
+ series: (key) => seriesSettings[key.card._seriesKey ?? ""] ?? {},
+ };
+
+ return getTrendLines(
+ rawSeries,
+ [null, null],
+ yAxisScaleTransforms,
+ seriesModels,
+ chartDataset,
+ settings,
+ [],
+ renderingContext,
+ );
+};
+
+describe("getTrendLines", () => {
+ const CUSTOM_COLOR = "#ED6E6E";
+
+ it("should use the darker variant of each series color by default", () => {
+ const trendLinesModel = setup();
+
+ expect(trendLinesModel?.seriesModels.map((series) => series.color)).toEqual(
+ [deriveChartShadeColor("#509EE3"), deriveChartShadeColor("#88BF4D")],
+ );
+ });
+
+ it("should default to a solid line", () => {
+ expect(
+ setup({ metrics: ["count"] })?.seriesModels.map((series) => series.style),
+ ).toEqual(["solid"]);
+ expect(setup()?.seriesModels.map((series) => series.style)).toEqual([
+ "solid",
+ "solid",
+ ]);
+ });
+
+ it("should use the series color and style for a single series", () => {
+ const trendLinesModel = setup({
+ metrics: ["count"],
+ seriesSettings: {
+ count: { "trendline.color": CUSTOM_COLOR, "trendline.style": "dashed" },
+ },
+ });
+
+ expect(trendLinesModel?.seriesModels.map((series) => series.color)).toEqual(
+ [CUSTOM_COLOR],
+ );
+ expect(trendLinesModel?.seriesModels.map((series) => series.style)).toEqual(
+ ["dashed"],
+ );
+ });
+
+ it("should use per-series color and style with multiple series", () => {
+ const trendLinesModel = setup({
+ seriesSettings: {
+ count: { "trendline.color": CUSTOM_COLOR, "trendline.style": "dotted" },
+ },
+ });
+
+ expect(trendLinesModel?.seriesModels.map((series) => series.color)).toEqual(
+ [CUSTOM_COLOR, deriveChartShadeColor("#88BF4D")],
+ );
+ expect(trendLinesModel?.seriesModels.map((series) => series.style)).toEqual(
+ ["dotted", "solid"],
+ );
+ });
+
+ it("should keep a series customization when the chart gains or loses series", () => {
+ const seriesSettings = {
+ count: { "trendline.color": CUSTOM_COLOR, "trendline.style": "dotted" },
+ } as const;
+
+ const single = setup({ metrics: ["count"], seriesSettings });
+ const multiple = setup({ metrics: ["count", "avg"], seriesSettings });
+
+ expect(single?.seriesModels[0]).toMatchObject({
+ color: CUSTOM_COLOR,
+ style: "dotted",
+ });
+ expect(multiple?.seriesModels[0]).toMatchObject({
+ color: CUSTOM_COLOR,
+ style: "dotted",
+ });
+ });
+});
diff --git a/frontend/src/metabase/viz-core/echarts/cartesian/model/types.ts b/frontend/src/metabase/viz-core/echarts/cartesian/model/types.ts
index e5642264bce..8bce72c4de6 100644
--- a/frontend/src/metabase/viz-core/echarts/cartesian/model/types.ts
+++ b/frontend/src/metabase/viz-core/echarts/cartesian/model/types.ts
@@ -6,6 +6,7 @@ import type {
CardId,
DatasetColumn,
DateTimeAbsoluteUnit,
+ LineStyle,
RowValue,
VisualizationSettingKey,
} from "metabase-types/api";
@@ -74,6 +75,7 @@ export type ScatterSeriesModel = (RegularSeriesModel | BreakoutSeriesModel) & {
export type TrendLineSeriesModel = BaseSeriesModel & {
sourceDataKey: DataKey;
+ style: LineStyle;
};
export type SeriesModel =
@@ -185,12 +187,14 @@ export type YAxisModel = {
formatter: AxisFormatter;
formatGoal: AxisFormatter;
splitNumber?: number;
+ hasResponsiveTicks?: boolean;
isNormalized?: boolean;
};
export type TrendLinesModel = {
dataset: ChartDataset;
seriesModels: TrendLineSeriesModel[];
+ extents: SeriesExtents;
};
export type YAxisSide = "left" | "right";
diff --git a/frontend/src/metabase/viz-core/echarts/cartesian/model/util.ts b/frontend/src/metabase/viz-core/echarts/cartesian/model/util.ts
index 7ddcf557f10..4534b26b24f 100644
--- a/frontend/src/metabase/viz-core/echarts/cartesian/model/util.ts
+++ b/frontend/src/metabase/viz-core/echarts/cartesian/model/util.ts
@@ -23,6 +23,20 @@ export function getFormattingOptionsWithoutScaling(options: ColumnSettings) {
return { ...options, scale: undefined };
}
+export function getLabelValueFormatting(
+ formatting: "auto" | "compact" | "full" | undefined,
+ useCompactFormatting: boolean,
+) {
+ if (
+ useCompactFormatting &&
+ (formatting === undefined || formatting === "auto")
+ ) {
+ return "compact";
+ }
+
+ return formatting;
+}
+
export function getColumnScaling(
column: RemappingHydratedDatasetColumn,
settings: ComputedVisualizationSettings,
diff --git a/frontend/src/metabase/viz-core/echarts/cartesian/option/axis.ts b/frontend/src/metabase/viz-core/echarts/cartesian/option/axis.ts
index 6ad1bab97b5..febb95d9d8d 100644
--- a/frontend/src/metabase/viz-core/echarts/cartesian/option/axis.ts
+++ b/frontend/src/metabase/viz-core/echarts/cartesian/option/axis.ts
@@ -8,6 +8,7 @@ import type { DatasetColumn } from "metabase-types/api";
import type {
ComputedVisualizationSettings,
RenderingContext,
+ VisualizationTheme,
} from "../../../types";
import { CHART_STYLE } from "../constants/style";
import type { ChartLayout } from "../layout/types";
@@ -27,8 +28,18 @@ import { getPaddedAxisLabel } from "./utils";
const NORMALIZED_RANGE = { min: 0, max: 1 };
-export const getAxisNameGap = (ticksWidth: number): number => {
- return ticksWidth + CHART_STYLE.axisNameMargin;
+export const getXAxisNameGap = (
+ ticksHeight: number,
+ theme: VisualizationTheme,
+): number => {
+ return ticksHeight + theme.cartesian.axisTitle.marginX;
+};
+
+export const getYAxisNameGap = (
+ ticksWidth: number,
+ theme: VisualizationTheme,
+): number => {
+ return ticksWidth + theme.cartesian.axisTitle.marginY;
};
const getCustomAxisRange = (
@@ -79,8 +90,8 @@ export const getAxisNameDefaultOption = (
nameRotate: rotate,
nameTextStyle: {
color: getColor("text-primary"),
- fontSize: theme.cartesian.label.fontSize,
- fontWeight: CHART_STYLE.axisName.weight,
+ fontSize: theme.cartesian.axisTitle.fontSize,
+ fontWeight: theme.cartesian.axisTitle.fontWeight,
fontFamily,
},
});
@@ -93,7 +104,7 @@ export const getTicksDefaultOption = ({
return {
hideOverlap: true,
color: getColor("text-primary"),
- fontSize: theme.cartesian.label.fontSize,
+ fontSize: theme.cartesian.ticks.fontSize,
fontWeight: CHART_STYLE.axisTicks.weight,
fontFamily,
};
@@ -116,7 +127,7 @@ const getHistogramTicksOptions = (
chartLayout: ChartLayout,
{ theme }: RenderingContext,
) => {
- const { fontSize } = theme.cartesian.label;
+ const { fontSize } = theme.cartesian.ticks;
if (settings["graph.x_axis.scale"] !== "histogram") {
return {};
@@ -130,7 +141,7 @@ const getHistogramTicksOptions = (
return {
...options,
padding: [0, topOffset, 0, 0],
- margin: -histogramDimensionWidth / 2 + CHART_STYLE.axisTicksMarginX,
+ margin: -histogramDimensionWidth / 2 + theme.cartesian.ticks.marginX,
};
} else if (settings["graph.x_axis.axis_enabled"] === "rotate-90") {
const rightOffset = histogramDimensionWidth / 2 - fontSize / 2;
@@ -160,9 +171,11 @@ const getCommonDimensionAxisOptions = (
settings: ComputedVisualizationSettings,
renderingContext: RenderingContext,
) => {
- const nameGap = getAxisNameGap(chartLayout.ticksDimensions.xTicksHeight);
+ const nameGap = getXAxisNameGap(
+ chartLayout.ticksDimensions.xTicksHeight,
+ renderingContext.theme,
+ );
const { getColor } = renderingContext;
- const isSplitPanels = chartLayout.panelHeight != null;
return {
...getAxisNameDefaultOption(
renderingContext,
@@ -182,9 +195,7 @@ const getCommonDimensionAxisOptions = (
axisLine: {
show: !!settings["graph.x_axis.axis_enabled"],
lineStyle: {
- color: getColor(
- isSplitPanels ? "border-neutral-strong" : "border-neutral",
- ),
+ color: getColor("chart-axis"),
},
},
};
@@ -253,7 +264,7 @@ export const buildNumericDimensionAxis = (
type: "value",
scale: true,
axisLabel: {
- margin: CHART_STYLE.axisTicksMarginX,
+ margin: renderingContext.theme.cartesian.ticks.marginX,
...getDimensionTicksDefaultOption(settings, renderingContext),
formatter: (rawValue: number) => {
if (isPadded && (rawValue < min || rawValue > max)) {
@@ -289,7 +300,7 @@ export const buildTimeSeriesDimensionAxis = (
axisLabel: {
margin: hasTimelineEvents
? CHART_STYLE.timelineEvents.height
- : CHART_STYLE.axisTicksMarginX,
+ : renderingContext.theme.cartesian.ticks.marginX,
...getDimensionTicksDefaultOption(settings, renderingContext),
formatter: (rawValue: number) => {
const value = xAxisModel.fromEChartsAxisValue(rawValue);
@@ -330,7 +341,7 @@ export const buildCategoricalDimensionAxis = (
...getCommonDimensionAxisOptions(chartLayout, settings, renderingContext),
type: "category",
axisLabel: {
- margin: CHART_STYLE.axisTicksMarginX,
+ margin: renderingContext.theme.cartesian.ticks.marginX,
...getDimensionTicksDefaultOption(settings, renderingContext),
...getHistogramTicksOptions(
datasetLength,
@@ -367,9 +378,22 @@ export const buildMetricAxis = (
renderingContext: RenderingContext,
): YAXisOption => {
const shouldFlipAxisName = position === "right";
- const nameGap = getAxisNameGap(ticksWidth);
+ const nameGap = getYAxisNameGap(ticksWidth, renderingContext.theme);
const range = getYAxisRange(axisModel, yAxisScaleTransforms, settings);
+ const rangeMin = "min" in range ? range.min : undefined;
+ // When the axis starts at or above zero the x-axis line sits on the bottom
+ // gridline, and stacking the two translucent lines renders darker than the
+ // other gridlines, so we skip the duplicated min gridline.
+ const hasXAxisLineAtMin =
+ !!settings["graph.x_axis.axis_enabled"] &&
+ axisModel.extent[0] >= 0 &&
+ (rangeMin == null || rangeMin === 0);
+ const lineStyle = {
+ type: "solid" as const,
+ opacity: hasSplitLine ? 1 : 0,
+ ...renderingContext.theme.cartesian.splitLine.lineStyle,
+ };
const {
type: _omitType,
@@ -391,13 +415,7 @@ export const buildMetricAxis = (
...range,
...axisNameOptions,
splitLine: settings["graph.y_axis.axis_enabled"]
- ? {
- lineStyle: {
- type: "solid",
- opacity: hasSplitLine ? 1 : 0,
- ...renderingContext.theme.cartesian.splitLine.lineStyle,
- },
- }
+ ? { lineStyle, showMinLine: !hasXAxisLineAtMin }
: undefined,
position,
axisLine: {
@@ -407,7 +425,7 @@ export const buildMetricAxis = (
show: false,
},
axisLabel: {
- margin: CHART_STYLE.axisTicksMarginY,
+ margin: renderingContext.theme.cartesian.ticks.marginY,
show: !!settings["graph.y_axis.axis_enabled"],
...getTicksDefaultOption(renderingContext),
formatter: (rawValue) =>
diff --git a/frontend/src/metabase/viz-core/echarts/cartesian/option/axis.unit.spec.ts b/frontend/src/metabase/viz-core/echarts/cartesian/option/axis.unit.spec.ts
new file mode 100644
index 00000000000..f8f3d61f417
--- /dev/null
+++ b/frontend/src/metabase/viz-core/echarts/cartesian/option/axis.unit.spec.ts
@@ -0,0 +1,192 @@
+import {
+ createMockCartesianChartModel,
+ createMockChartLayout,
+} from "__support__/echarts";
+import {
+ createMockColumn,
+ createMockVisualizationSettings,
+} from "metabase-types/api/mocks";
+
+import { DEFAULT_VISUALIZATION_THEME } from "../../../shared/utils/theme";
+import type { RenderingContext } from "../../../types";
+import { X_AXIS_DATA_KEY } from "../constants/dataset";
+import type { YAxisModel } from "../model/types";
+
+import { buildAxes, createAxisVisibilityOption } from "./axis";
+import { applyResponsiveYAxisTicks } from "./responsive-axis";
+
+const renderingContext: RenderingContext = {
+ getColor: (name) => name,
+ measureText: () => 0,
+ measureTextHeight: () => 0,
+ fontFamily: "Lato",
+ theme: DEFAULT_VISUALIZATION_THEME,
+};
+
+const axisModel: YAxisModel = {
+ seriesKeys: ["count"],
+ extent: [0, 100],
+ column: createMockColumn(),
+ formatter: String,
+ formatGoal: String,
+ splitNumber: 5,
+ hasResponsiveTicks: true,
+};
+
+function setup({
+ height = 199,
+ model = axisModel,
+ settings = createMockVisualizationSettings({
+ "graph.y_axis.axis_enabled": true,
+ }),
+ rightAxisModel = null,
+ chartModelOptions = {},
+ panelHeight,
+}: {
+ height?: number;
+ model?: YAxisModel;
+ settings?: ReturnType<typeof createMockVisualizationSettings>;
+ rightAxisModel?: YAxisModel | null;
+ chartModelOptions?: Parameters<typeof createMockCartesianChartModel>[0];
+ panelHeight?: number;
+} = {}) {
+ const chartModel = createMockCartesianChartModel({
+ leftAxisModel: model,
+ rightAxisModel,
+ ...chartModelOptions,
+ });
+ const chartLayout = createMockChartLayout({
+ outerHeight: height + 40,
+ padding: { top: 10, bottom: 30 },
+ panelHeight,
+ });
+ const axes = buildAxes(
+ chartModel,
+ chartLayout,
+ settings,
+ false,
+ renderingContext,
+ );
+ return {
+ ...axes,
+ yAxis: applyResponsiveYAxisTicks(
+ axes.yAxis,
+ chartModel,
+ chartLayout,
+ settings,
+ ),
+ };
+}
+
+describe("responsive Y-axis ticks", () => {
+ it.each([
+ { height: 199, labels: [0, 100], gridlines: [0, 50, 100] },
+ { height: 200, labels: [0, 50, 100], gridlines: [0, 50, 100] },
+ { height: 299, labels: [0, 50, 100], gridlines: [0, 50, 100] },
+ { height: 300, labels: [0, 50, 100], gridlines: [0, 25, 50, 75, 100] },
+ { height: 399, labels: [0, 50, 100], gridlines: [0, 25, 50, 75, 100] },
+ {
+ height: 400,
+ labels: [0, 25, 50, 75, 100],
+ gridlines: [0, 25, 50, 75, 100],
+ },
+ ])(
+ "uses the tick density for a $height px plot",
+ ({ height, labels, gridlines }) => {
+ const { yAxis } = setup({ height });
+ expect(yAxis[0]).toMatchObject({
+ axisLabel: { customValues: labels },
+ axisTick: { customValues: gridlines },
+ });
+ },
+ );
+
+ it("preserves an explicit tick count on small cards", () => {
+ const { yAxis } = setup({
+ model: { ...axisModel, splitNumber: 7 },
+ settings: createMockVisualizationSettings({
+ "graph.y_axis.split_number": 7,
+ }),
+ });
+ expect(yAxis[0]).toMatchObject({ splitNumber: 7 });
+ expect(yAxis[0].axisTick?.customValues).toBeUndefined();
+ });
+
+ it("preserves native tick density on large charts", () => {
+ const { yAxis } = setup({
+ model: { ...axisModel, hasResponsiveTicks: false },
+ });
+ expect(yAxis[0]).toMatchObject({ splitNumber: 5 });
+ expect(yAxis[0].axisTick?.customValues).toBeUndefined();
+ });
+
+ it("preserves default gridline styling when the Y-axis is disabled", () => {
+ const { yAxis } = setup({
+ settings: createMockVisualizationSettings({
+ "graph.y_axis.axis_enabled": false,
+ }),
+ });
+ expect(yAxis[0].splitLine).toBeUndefined();
+ });
+
+ it("does not draw the right-axis intermediate gridlines over the left axis", () => {
+ const { yAxis } = setup({ rightAxisModel: axisModel });
+ expect(yAxis[0].splitLine?.lineStyle?.opacity).toBe(1);
+ expect(yAxis[1].splitLine?.lineStyle?.opacity).toBe(0);
+ });
+
+ it("toggles both major and intermediate gridlines on hover", () => {
+ expect(
+ createAxisVisibilityOption({ show: true, splitLineVisible: false }),
+ ).toMatchObject({
+ splitLine: { lineStyle: { opacity: 0 } },
+ });
+ });
+
+ it("includes a goal outside the data range without changing the other axis", () => {
+ const { yAxis } = setup({
+ rightAxisModel: axisModel,
+ settings: createMockVisualizationSettings({
+ "graph.y_axis.axis_enabled": true,
+ "graph.y_axis.auto_range": true,
+ "graph.show_goal": true,
+ "graph.goal_value": 400,
+ }),
+ });
+ expect(yAxis[0].axisLabel?.customValues).toEqual([0, 400]);
+ expect(yAxis[1].axisLabel?.customValues).toEqual([0, 100]);
+ });
+
+ it("includes the trend line extent on its matching axis", () => {
+ const { yAxis } = setup({
+ chartModelOptions: {
+ trendLinesModel: {
+ extents: { trend: [400, 400] },
+ dataset: [{ [X_AXIS_DATA_KEY]: 1, trend: 400 }],
+ seriesModels: [
+ {
+ sourceDataKey: "count",
+ dataKey: "trend",
+ name: "Trend",
+ color: "brand",
+ style: "solid",
+ visible: true,
+ column: axisModel.column,
+ columnIndex: 1,
+ },
+ ],
+ },
+ },
+ });
+ expect(yAxis[0].axisLabel?.customValues).toEqual([0, 400]);
+ });
+
+ it("uses the individual panel height for split charts", () => {
+ const { yAxis } = setup({
+ height: 800,
+ panelHeight: 199,
+ chartModelOptions: { splitPanelYAxisModels: [axisModel] },
+ });
+ expect(yAxis[0].axisLabel?.customValues).toEqual([0, 100]);
+ });
+});
diff --git a/frontend/src/metabase/viz-core/echarts/cartesian/option/goal-line.ts b/frontend/src/metabase/viz-core/echarts/cartesian/option/goal-line.ts
index 447914ecfa8..2191334dd6b 100644
--- a/frontend/src/metabase/viz-core/echarts/cartesian/option/goal-line.ts
+++ b/frontend/src/metabase/viz-core/echarts/cartesian/option/goal-line.ts
@@ -11,7 +11,11 @@ import { GOAL_LINE_SERIES_ID, X_AXIS_DATA_KEY } from "../constants/dataset";
import { CHART_STYLE, Z_INDEXES } from "../constants/style";
import type { ChartDataset } from "../model/types";
-export const GOAL_LINE_DASH = [3, 4];
+export const GOAL_LINE_DASH = [2, 2];
+export const GOAL_LINE_WIDTH = 1;
+
+export const isGoalLineSeriesId = (seriesId: string | undefined) =>
+ seriesId?.startsWith(GOAL_LINE_SERIES_ID) ?? false;
function getFirstNonNullXValue(dataset: ChartDataset) {
for (let i = 0; i < dataset.length; i++) {
@@ -52,6 +56,127 @@ export function getGoalLineParams(model: GoalLineParamsSource): GoalLineParams {
};
}
+export function getGoalLineValue(
+ value: number,
+ {
+ isNormalized,
+ toEChartsAxisValue,
+ }: Pick<GoalLineParams, "isNormalized" | "toEChartsAxisValue">,
+) {
+ return toEChartsAxisValue(isNormalized ? value / 100 : value);
+}
+
+function buildGoalLineLabel({
+ labelOnLeft,
+ xStart,
+ xEnd,
+ y,
+ fontSize,
+ settings,
+ renderingContext,
+}: {
+ labelOnLeft: boolean;
+ xStart: number;
+ xEnd: number;
+ y: number;
+ fontSize: number;
+ settings: ComputedVisualizationSettings;
+ renderingContext: RenderingContext;
+}) {
+ return [
+ {
+ type: "text" as const,
+ x: labelOnLeft ? xStart : xEnd,
+ y: y - fontSize - CHART_STYLE.goalLine.label.margin,
+ blur: {
+ style: {
+ opacity: 1,
+ },
+ },
+ style: {
+ align: labelOnLeft ? ("left" as const) : ("right" as const),
+ text: settings["graph.goal_label"] ?? "",
+ fontFamily: renderingContext.fontFamily,
+ fontSize,
+ fontWeight: CHART_STYLE.goalLine.label.weight,
+ fill: renderingContext.getColor("text-secondary"),
+ },
+ },
+ ];
+}
+
+function buildGoalLineMarker({
+ xEnd,
+ y,
+ renderingContext,
+}: {
+ xEnd: number;
+ y: number;
+ renderingContext: RenderingContext;
+}) {
+ const {
+ outerRingRadius,
+ innerRingRadius,
+ ringWidth,
+ backgroundRadius,
+ shadowSpread,
+ hitAreaRadius,
+ } = CHART_STYLE.goalLine.marker;
+ const iconColor = renderingContext.getColor("icon-primary");
+
+ const circle = (
+ r: number,
+ style: { fill: string; stroke?: string; lineWidth?: number },
+ ) => ({
+ type: "circle" as const,
+ shape: { cx: xEnd, cy: y, r },
+ silent: true,
+ blur: {
+ style: {
+ opacity: 1,
+ },
+ },
+ emphasis: {
+ style: { ...style },
+ },
+ style,
+ });
+
+ const shadow = circle(backgroundRadius + shadowSpread, {
+ fill: renderingContext.getColor("shadow-default"),
+ });
+ const background = circle(backgroundRadius, {
+ fill: renderingContext.getColor("background_surface-primary"),
+ });
+ const hoverBackground = {
+ ...circle(backgroundRadius, { fill: "none" }),
+ emphasis: {
+ style: {
+ fill: renderingContext.getColor("background_surface-primary-hover"),
+ },
+ },
+ };
+ const ringStyle = { fill: "none", stroke: iconColor, lineWidth: ringWidth };
+
+ const hitArea = {
+ type: "circle" as const,
+ shape: { cx: xEnd, cy: y, r: hitAreaRadius },
+ style: {
+ fill: iconColor,
+ opacity: 0,
+ },
+ };
+
+ return [
+ shadow,
+ background,
+ hoverBackground,
+ circle(outerRingRadius, ringStyle),
+ circle(innerRingRadius, ringStyle),
+ hitArea,
+ ];
+}
+
export function getGoalLineSeriesOption(
{ dataset, isNormalized, toEChartsAxisValue, labelOnLeft }: GoalLineParams,
settings: ComputedVisualizationSettings,
@@ -61,11 +186,13 @@ export function getGoalLineSeriesOption(
return null;
}
- const value = isNormalized
- ? settings["graph.goal_value"] / 100
- : settings["graph.goal_value"];
-
- const scaleTransformedGoalValue = toEChartsAxisValue(value);
+ const scaleTransformedGoalValue = getGoalLineValue(
+ settings["graph.goal_value"],
+ {
+ isNormalized,
+ toEChartsAxisValue,
+ },
+ );
const { fontSize } = renderingContext.theme.cartesian.goalLine.label;
return {
@@ -83,54 +210,62 @@ export function getGoalLineSeriesOption(
params.coordSys as unknown as EChartsCartesianCoordinateSystem;
const xStart = coordSys.x;
const xEnd = coordSys.width + coordSys.x;
+ // Snapped to the pixel grid so the line and its shadow below stay crisp
+ // instead of being anti-aliased into each other.
+ const lineY = Math.round(y - GOAL_LINE_WIDTH / 2) + GOAL_LINE_WIDTH / 2;
- const line = {
+ const getLine = (offsetY: number, stroke: string) => ({
type: "line" as const,
shape: {
- x1: xStart,
+ x1: Math.round(xStart),
x2: xEnd,
- y1: y,
- y2: y,
+ y1: lineY + offsetY,
+ y2: lineY + offsetY,
},
+ // Only the marker is a hover target, so the line itself is inert.
+ silent: true,
blur: {
style: {
opacity: 1,
},
},
- style: {
- lineWidth: 2,
- stroke: renderingContext.getColor("text-secondary"),
- color: renderingContext.getColor("text-secondary"),
- lineDash: GOAL_LINE_DASH,
- },
- };
-
- const align = labelOnLeft ? ("left" as const) : ("right" as const);
- const labelX = labelOnLeft ? xStart : xEnd;
- const labelY = y - fontSize - CHART_STYLE.goalLine.label.margin;
-
- const label = {
- type: "text" as const,
- x: labelX,
- y: labelY,
- blur: {
+ emphasis: {
style: {
- opacity: 1,
+ stroke,
},
},
style: {
- align,
- text: settings["graph.goal_label"] ?? "",
- fontFamily: renderingContext.fontFamily,
- fontSize,
- fontWeight: CHART_STYLE.goalLine.label.weight,
- fill: renderingContext.getColor("text-secondary"),
+ lineWidth: GOAL_LINE_WIDTH,
+ stroke,
+ color: stroke,
+ lineDash: GOAL_LINE_DASH,
},
- };
+ });
+
+ const line = getLine(0, renderingContext.getColor("icon-primary"));
+ const lineShadow = getLine(
+ GOAL_LINE_WIDTH,
+ renderingContext.getColor("background_surface-primary"),
+ );
+
+ // Static renders have no hover, so they keep the inline label to stay
+ // readable. Interactive charts show the marker and reveal the value on
+ // hover instead.
+ const endDecoration = renderingContext.isStatic
+ ? buildGoalLineLabel({
+ labelOnLeft,
+ xStart,
+ xEnd,
+ y,
+ fontSize,
+ settings,
+ renderingContext,
+ })
+ : buildGoalLineMarker({ xEnd, y: lineY, renderingContext });
return {
type: "group" as const,
- children: [line, label],
+ children: [lineShadow, line, ...endDecoration],
};
},
};
diff --git a/frontend/src/metabase/viz-core/echarts/cartesian/option/goal-line.unit.spec.ts b/frontend/src/metabase/viz-core/echarts/cartesian/option/goal-line.unit.spec.ts
new file mode 100644
index 00000000000..99569ef79c3
--- /dev/null
+++ b/frontend/src/metabase/viz-core/echarts/cartesian/option/goal-line.unit.spec.ts
@@ -0,0 +1,163 @@
+import { CustomChart } from "echarts/charts";
+import { GridComponent } from "echarts/components";
+import * as echarts from "echarts/core";
+import { SVGRenderer } from "echarts/renderers";
+
+import { DEFAULT_VISUALIZATION_THEME } from "../../../shared/utils/theme";
+import type {
+ ComputedVisualizationSettings,
+ RenderingContext,
+} from "../../../types";
+import { GOAL_LINE_SERIES_ID, X_AXIS_DATA_KEY } from "../constants/dataset";
+
+import { type GoalLineParams, getGoalLineSeriesOption } from "./goal-line";
+
+echarts.use([CustomChart, GridComponent, SVGRenderer]);
+
+const CHART_WIDTH = 600;
+const CHART_HEIGHT = 400;
+const GRID_MARGIN = 50;
+const Y_AXIS_MAX = 100;
+const GOAL_LABEL = "Target";
+
+const MARKER_POSITION = {
+ zrX: CHART_WIDTH - GRID_MARGIN,
+ zrY: CHART_HEIGHT / 2,
+};
+const LINE_POSITION = { zrX: CHART_WIDTH / 2, zrY: CHART_HEIGHT / 2 };
+
+const createParams = (opts: Partial<GoalLineParams> = {}): GoalLineParams => ({
+ dataset: [{ [X_AXIS_DATA_KEY]: "a" }],
+ isNormalized: false,
+ toEChartsAxisValue: (value) => Number(value),
+ labelOnLeft: false,
+ ...opts,
+});
+
+const createSettings = (
+ opts: Partial<ComputedVisualizationSettings> = {},
+): ComputedVisualizationSettings => ({
+ "graph.show_goal": true,
+ "graph.goal_value": Y_AXIS_MAX / 2,
+ "graph.goal_label": GOAL_LABEL,
+ ...opts,
+});
+
+const createRenderingContext = (
+ opts: Partial<RenderingContext> = {},
+): RenderingContext => ({
+ getColor: (name) => name,
+ measureText: () => 0,
+ measureTextHeight: () => 0,
+ fontFamily: "Lato",
+ theme: DEFAULT_VISUALIZATION_THEME,
+ ...opts,
+});
+
+interface SetupOpts {
+ params?: Partial<GoalLineParams>;
+ renderingContext?: Partial<RenderingContext>;
+}
+
+const charts: echarts.ECharts[] = [];
+
+const setup = ({ params, renderingContext }: SetupOpts = {}) => {
+ const container = document.createElement("div");
+ document.body.appendChild(container);
+
+ const chart = echarts.init(container, undefined, {
+ renderer: "svg",
+ width: CHART_WIDTH,
+ height: CHART_HEIGHT,
+ });
+ charts.push(chart);
+
+ chart.setOption({
+ animation: false,
+ grid: {
+ left: GRID_MARGIN,
+ right: GRID_MARGIN,
+ top: GRID_MARGIN,
+ bottom: GRID_MARGIN,
+ outerBoundsMode: "none",
+ },
+ xAxis: { type: "category", data: ["a", "b", "c"] },
+ yAxis: { type: "value", min: 0, max: Y_AXIS_MAX },
+ series: [
+ getGoalLineSeriesOption(
+ createParams(params),
+ createSettings(),
+ createRenderingContext(renderingContext),
+ ),
+ ],
+ });
+
+ const onGoalHover = jest.fn();
+ chart.on("mousemove", { seriesId: GOAL_LINE_SERIES_ID }, onGoalHover);
+
+ const hover = (position: { zrX: number; zrY: number }) =>
+ chart.getZr().handler.dispatch("mousemove", position);
+
+ const getGoalLabel = () =>
+ Array.from(container.querySelectorAll("text")).find(
+ (text) => text.textContent === GOAL_LABEL,
+ );
+
+ return { onGoalHover, hover, getGoalLabel };
+};
+
+describe("getGoalLineSeriesOption", () => {
+ afterEach(() => {
+ charts.splice(0).forEach((chart) => chart.dispose());
+ document.body.innerHTML = "";
+ });
+
+ it("returns null when the goal is not enabled", () => {
+ const option = getGoalLineSeriesOption(
+ createParams(),
+ createSettings({ "graph.show_goal": false }),
+ createRenderingContext(),
+ );
+
+ expect(option).toBeNull();
+ });
+
+ it("returns null when the goal has no value", () => {
+ const option = getGoalLineSeriesOption(
+ createParams(),
+ createSettings({ "graph.goal_value": undefined }),
+ createRenderingContext(),
+ );
+
+ expect(option).toBeNull();
+ });
+
+ it("triggers the goal tooltip hover only from the bullseye marker", () => {
+ const { hover, onGoalHover } = setup();
+
+ hover(LINE_POSITION);
+ expect(onGoalHover).not.toHaveBeenCalled();
+
+ hover(MARKER_POSITION);
+ expect(onGoalHover).toHaveBeenCalledTimes(1);
+ });
+
+ describe("static rendering", () => {
+ it("shows the inline label, which interactive charts replace with the marker", () => {
+ const staticChart = setup({ renderingContext: { isStatic: true } });
+ const interactiveChart = setup();
+
+ expect(staticChart.getGoalLabel()).toBeDefined();
+ expect(interactiveChart.getGoalLabel()).toBeUndefined();
+ });
+
+ it("moves the label to the left when a right axis is present", () => {
+ const { getGoalLabel } = setup({
+ params: { labelOnLeft: true },
+ renderingContext: { isStatic: true },
+ });
+
+ expect(getGoalLabel()?.getAttribute("text-anchor")).toBe("start");
+ });
+ });
+});
diff --git a/frontend/src/metabase/viz-core/echarts/cartesian/option/index.ts b/frontend/src/metabase/viz-core/echarts/cartesian/option/index.ts
index 7f29cca0071..3365caf9d39 100644
--- a/frontend/src/metabase/viz-core/echarts/cartesian/option/index.ts
+++ b/frontend/src/metabase/viz-core/echarts/cartesian/option/index.ts
@@ -34,6 +34,7 @@ import type { TimelineEventsModel } from "../timeline-events/types";
import { buildAxes, buildDimensionAxis, buildMetricAxis } from "./axis";
import { getGoalLineParams, getGoalLineSeriesOption } from "./goal-line";
+import { applyResponsiveYAxisTicks } from "./responsive-axis";
import { buildEChartsSeries } from "./series";
import { getTrendLinesOption } from "./trend-line";
import type { EChartsSeriesOption } from "./types";
@@ -304,7 +305,7 @@ export const getCartesianChartOption = (
...splitPanelOverrides,
grid,
xAxis,
- yAxis,
+ yAxis: applyResponsiveYAxisTicks(yAxis, chartModel, chartLayout, settings),
dataset: buildEChartsDataset(chartModel),
series: seriesOption,
};
@@ -489,7 +490,7 @@ export function buildSplitPanelYAxisLabel(
const panelHeight = chartLayout.panelHeight ?? 0;
const totalPanelsHeight =
panelCount * panelHeight + (panelCount - 1) * chartLayout.panelGap;
- const { fontSize } = renderingContext.theme.cartesian.label;
+ const { fontSize, fontWeight } = renderingContext.theme.cartesian.axisTitle;
return [
{
@@ -500,7 +501,7 @@ export function buildSplitPanelYAxisLabel(
text: label,
fill: renderingContext.getColor("text-primary"),
fontSize,
- fontWeight: CHART_STYLE.axisName.weight,
+ fontWeight,
fontFamily: renderingContext.fontFamily,
textAlign: "center",
textVerticalAlign: "middle",
@@ -516,7 +517,6 @@ export function buildPerPanelYAxes(
settings: ComputedVisualizationSettings,
renderingContext: RenderingContext,
): YAXisOption[] {
- const yTicksWidth = chartLayout.ticksDimensions.yTicksWidthLeft;
const panelAxisModels = chartModel.splitPanelYAxisModels ?? [];
return panelAxisModels.map((axisModel, index) => {
@@ -524,7 +524,7 @@ export function buildPerPanelYAxes(
...buildMetricAxis(
axisModel,
chartModel.yAxisScaleTransforms,
- yTicksWidth - CHART_STYLE.axisTicksMarginY,
+ chartLayout.ticksDimensions.yTicksWidthLeft,
settings,
"left",
true,
diff --git a/frontend/src/metabase/viz-core/echarts/cartesian/option/responsive-axis.ts b/frontend/src/metabase/viz-core/echarts/cartesian/option/responsive-axis.ts
new file mode 100644
index 00000000000..13314f4711e
--- /dev/null
+++ b/frontend/src/metabase/viz-core/echarts/cartesian/option/responsive-axis.ts
@@ -0,0 +1,92 @@
+import type { YAXisOption } from "echarts/types/dist/shared";
+
+import { isNotNull } from "metabase/utils/types";
+
+import type { ComputedVisualizationSettings, Extent } from "../../../types";
+import type { ChartLayout } from "../layout/types";
+import type { BaseCartesianChartModel, YAxisModel } from "../model/types";
+
+import { getGoalLineValue } from "./goal-line";
+import { getResponsiveYAxisTicks } from "./y-axis-ticks";
+
+type ChartAxisModels = Pick<
+ BaseCartesianChartModel,
+ | "leftAxisModel"
+ | "rightAxisModel"
+ | "splitPanelYAxisModels"
+ | "trendLinesModel"
+ | "yAxisScaleTransforms"
+>;
+
+function getAxisExtent(
+ axisModel: YAxisModel,
+ chartModel: ChartAxisModels,
+ settings: ComputedVisualizationSettings,
+ hasGoal: boolean,
+): Extent {
+ let [min, max] = axisModel.extent;
+ const includeValue = (value: unknown) => {
+ if (typeof value === "number" && Number.isFinite(value)) {
+ min = Math.min(min, value);
+ max = Math.max(max, value);
+ }
+ };
+
+ if (
+ hasGoal &&
+ settings["graph.show_goal"] &&
+ settings["graph.goal_value"] != null
+ ) {
+ includeValue(
+ getGoalLineValue(settings["graph.goal_value"], {
+ isNormalized: chartModel.leftAxisModel?.isNormalized ?? false,
+ toEChartsAxisValue: chartModel.yAxisScaleTransforms.toEChartsAxisValue,
+ }),
+ );
+ }
+
+ const trendLines = chartModel.trendLinesModel;
+ if (trendLines) {
+ for (const { sourceDataKey, dataKey } of trendLines.seriesModels) {
+ if (axisModel.seriesKeys.includes(sourceDataKey)) {
+ trendLines.extents[dataKey]?.forEach(includeValue);
+ }
+ }
+ }
+ return [min, max];
+}
+
+export function applyResponsiveYAxisTicks(
+ axes: YAXisOption[],
+ chartModel: ChartAxisModels,
+ chartLayout: ChartLayout,
+ settings: ComputedVisualizationSettings,
+): YAXisOption[] {
+ if (settings["graph.y_axis.split_number"] > 0) {
+ return axes;
+ }
+
+ const isSplitPanels = chartLayout.panelHeight != null;
+ const axisModels = isSplitPanels
+ ? (chartModel.splitPanelYAxisModels ?? [])
+ : [chartModel.leftAxisModel, chartModel.rightAxisModel].filter(isNotNull);
+ const height =
+ chartLayout.panelHeight ??
+ chartLayout.outerHeight -
+ chartLayout.padding.top -
+ chartLayout.padding.bottom;
+
+ return axes.map((axis, index) => {
+ const axisModel = axisModels[index];
+ if (!axisModel?.hasResponsiveTicks || axis.type !== "value") {
+ return axis;
+ }
+ const extent = getAxisExtent(
+ axisModel,
+ chartModel,
+ settings,
+ isSplitPanels || index === 0,
+ );
+ return getResponsiveYAxisTicks(extent, axis, height);
+ });
+}
diff --git a/frontend/src/metabase/viz-core/echarts/cartesian/option/trend-line.ts b/frontend/src/metabase/viz-core/echarts/cartesian/option/trend-line.ts
index c510ce2d3fd..db44b11d477 100644
--- a/frontend/src/metabase/viz-core/echarts/cartesian/option/trend-line.ts
+++ b/frontend/src/metabase/viz-core/echarts/cartesian/option/trend-line.ts
@@ -6,7 +6,7 @@ import type { BaseCartesianChartModel } from "../model/types";
import { getSeriesYAxisIndex } from "./utils";
-export const TREND_LINE_DASH = [5, 5];
+export const TREND_LINE_WIDTH = 1.15;
export function getTrendLinesOption(
chartModel: BaseCartesianChartModel,
@@ -25,8 +25,8 @@ export function getTrendLinesOption(
showSymbol: false,
lineStyle: {
color: trendSeries.color,
- type: TREND_LINE_DASH,
- width: 2,
+ type: trendSeries.style,
+ width: TREND_LINE_WIDTH,
},
z: Z_INDEXES.trendLine,
})) ?? []
diff --git a/frontend/src/metabase/viz-core/echarts/cartesian/option/y-axis-ticks.ts b/frontend/src/metabase/viz-core/echarts/cartesian/option/y-axis-ticks.ts
new file mode 100644
index 00000000000..6e6b83dcf8a
--- /dev/null
+++ b/frontend/src/metabase/viz-core/echarts/cartesian/option/y-axis-ticks.ts
@@ -0,0 +1,44 @@
+import { Model, helper } from "echarts/core";
+import type { YAXisOption } from "echarts/types/dist/shared";
+
+import { PLOT_HEIGHT_BREAKPOINTS } from "../../../shared/constants/layout";
+import type { Extent } from "../../../types";
+
+type ValueAxisOption = Extract<YAXisOption, { type?: "value" }>;
+
+/** Lets ECharts include zero after applying boundary gaps, as native axes do. */
+class ValueAxisScaleModel extends Model<ValueAxisOption> {
+ needIncludeZero() {
+ return !this.option.scale;
+ }
+}
+
+/** Uses the final axis options so explicit ticks share ECharts' rendered scale. */
+export function getResponsiveYAxisTicks(
+ extent: Extent,
+ axis: ValueAxisOption,
+ height: number,
+) {
+ const scale = helper.createScale(extent, new ValueAxisScaleModel(axis));
+ const [min, max] = scale.getExtent();
+ const segments = height < PLOT_HEIGHT_BREAKPOINTS.medium ? 2 : 4;
+ const gridlines = Array.from({ length: segments + 1 }, (_, index) =>
+ index === segments ? max : min + ((max - min) * index) / segments,
+ );
+ const labelInterval =
+ height < PLOT_HEIGHT_BREAKPOINTS.small ||
+ (height >= PLOT_HEIGHT_BREAKPOINTS.medium &&
+ height < PLOT_HEIGHT_BREAKPOINTS.large)
+ ? 2
+ : 1;
+
+ return {
+ ...axis,
+ axisTick: { ...axis.axisTick, customValues: gridlines },
+ axisLabel: {
+ ...axis.axisLabel,
+ customValues: gridlines.filter((_, index) => index % labelInterval === 0),
+ },
+ minorSplitLine: { ...axis.minorSplitLine, show: false },
+ };
+}
diff --git a/frontend/src/metabase/viz-core/echarts/cartesian/option/y-axis-ticks.unit.spec.ts b/frontend/src/metabase/viz-core/echarts/cartesian/option/y-axis-ticks.unit.spec.ts
new file mode 100644
index 00000000000..bccba19c0e1
--- /dev/null
+++ b/frontend/src/metabase/viz-core/echarts/cartesian/option/y-axis-ticks.unit.spec.ts
@@ -0,0 +1,113 @@
+import { LineChart } from "echarts/charts";
+import { GridComponent } from "echarts/components";
+import * as echarts from "echarts/core";
+import { SVGRenderer } from "echarts/renderers";
+import type { YAXisOption } from "echarts/types/dist/shared";
+
+import type { Extent } from "../../../types";
+
+import { getResponsiveYAxisTicks } from "./y-axis-ticks";
+
+echarts.use([LineChart, GridComponent, SVGRenderer]);
+
+const scenarios: {
+ name: string;
+ extent: Extent;
+ axis: Extract<YAXisOption, { type?: "value" }>;
+}[] = [
+ { name: "round range", extent: [0, 100], axis: {} },
+ { name: "dense range", extent: [10000, 120000], axis: {} },
+ { name: "mixed signs", extent: [-70, 30], axis: {} },
+ { name: "negative range", extent: [-200, -100], axis: { scale: true } },
+ {
+ name: "negative bar label padding (UXW-5182)",
+ extent: [-99, -90],
+ axis: { boundaryGap: [0.05, 0] },
+ },
+ { name: "constant positive series", extent: [7, 7], axis: {} },
+ { name: "constant negative series", extent: [-3, -3], axis: {} },
+ { name: "constant unpinned series", extent: [7, 7], axis: { scale: true } },
+ { name: "normalized range", extent: [0.1, 0.8], axis: { min: 0, max: 1 } },
+ { name: "manual bounds", extent: [13, 77], axis: { min: 10, max: 90 } },
+];
+
+describe.each(scenarios)(
+ "responsive Y-axis ticks with $name",
+ ({ extent, axis }) => {
+ it.each([
+ [199, 2, 3],
+ [200, 3, 3],
+ [299, 3, 3],
+ [300, 3, 5],
+ [399, 3, 5],
+ [400, 5, 5],
+ ])("renders %ipx density", (height, labelCount, lineCount) => {
+ const baseAxis = {
+ type: "value" as const,
+ splitNumber: 5,
+ axisLabel: { formatter: (value: number) => `Y:${value}` },
+ axisTick: { show: false },
+ splitLine: { lineStyle: { color: "currentColor" } },
+ ...axis,
+ };
+ const responsiveAxis = getResponsiveYAxisTicks(extent, baseAxis, height);
+ const chart = echarts.init(null, undefined, {
+ renderer: "svg",
+ ssr: true,
+ width: 400,
+ height: 500,
+ });
+
+ try {
+ const option = {
+ animation: false,
+ xAxis: { type: "category" as const, data: ["a", "b"], show: false },
+ series: [{ type: "line" as const, data: extent, showSymbol: false }],
+ };
+ chart.setOption({ ...option, yAxis: baseAxis });
+ const originalPixels = extent.map((value) =>
+ chart.convertToPixel({ yAxisIndex: 0 }, value),
+ );
+
+ chart.setOption({ ...option, yAxis: responsiveAxis }, true);
+ const svg = new DOMParser().parseFromString(
+ chart.renderToSVGString(),
+ "image/svg+xml",
+ );
+ const labels = Array.from(svg.querySelectorAll("text")).filter((node) =>
+ node.textContent?.startsWith("Y:"),
+ );
+ const gridlineCount = Array.from(
+ svg.querySelectorAll('path[stroke="currentColor"]'),
+ ).reduce(
+ (count, path) =>
+ count + (path.getAttribute("d")?.match(/M/g)?.length ?? 0),
+ 0,
+ );
+
+ expect(labels).toHaveLength(labelCount);
+ expect(gridlineCount).toBe(lineCount);
+ expect(
+ extent.map((value) => chart.convertToPixel({ yAxisIndex: 0 }, value)),
+ ).toEqual(originalPixels);
+ expect(responsiveAxis.min).toBe(baseAxis.min);
+ expect(responsiveAxis.max).toBe(baseAxis.max);
+ expect(responsiveAxis.splitNumber).toBe(5);
+ } finally {
+ chart.dispose();
+ }
+ });
+ },
+);
+
+it("uses the specified quarter and midpoint ticks for a zero to 100 range", () => {
+ const axis = getResponsiveYAxisTicks(
+ [0, 100],
+ { type: "value", splitNumber: 5 },
+ 300,
+ );
+
+ expect(axis.axisTick?.customValues).toEqual([0, 25, 50, 75, 100]);
+ expect(axis.axisLabel?.customValues).toEqual([0, 50, 100]);
+ expect(axis.minorSplitLine?.show).toBe(false);
+});
diff --git a/frontend/src/metabase/viz-core/echarts/cartesian/scatter/model/index.ts b/frontend/src/metabase/viz-core/echarts/cartesian/scatter/model/index.ts
index dfc1e809346..1688b82bfbc 100644
--- a/frontend/src/metabase/viz-core/echarts/cartesian/scatter/model/index.ts
+++ b/frontend/src/metabase/viz-core/echarts/cartesian/scatter/model/index.ts
@@ -25,6 +25,7 @@ import type {
ScatterPlotModel,
SeriesModel,
} from "../../model/types";
+import { getLabelValueFormatting } from "../../model/util";
import { getScatterPlotDataset } from "./dataset";
@@ -60,6 +61,9 @@ export function getScatterPlotModel(
renderingContext: RenderingContext,
showWarning?: ShowWarning,
): ScatterPlotModel {
+ const hasResponsiveTicks =
+ renderingContext.cartesianSize != null &&
+ renderingContext.cartesianSize !== "fullscreen";
// rawSeries has more than one element when two or more cards are combined on a dashboard
const hasMultipleCards = rawSeries.length > 1;
const cardsColumns = getCardsColumns(rawSeries, settings);
@@ -116,7 +120,11 @@ export function getScatterPlotModel(
columnByDataKey,
false,
[],
- false,
+ getLabelValueFormatting(
+ settings["graph.label_value_formatting"],
+ hasResponsiveTicks,
+ ) === "compact",
+ hasResponsiveTicks,
);
const trendLinesModel = getTrendLines(
diff --git a/frontend/src/metabase/viz-core/echarts/cartesian/scatter/option/index.ts b/frontend/src/metabase/viz-core/echarts/cartesian/scatter/option/index.ts
index 28401fc4366..a115a8c2a03 100644
--- a/frontend/src/metabase/viz-core/echarts/cartesian/scatter/option/index.ts
+++ b/frontend/src/metabase/viz-core/echarts/cartesian/scatter/option/index.ts
@@ -18,6 +18,7 @@ import {
getSharedEChartsOptions,
} from "../../option";
import { buildAxes, buildDimensionAxis } from "../../option/axis";
+import { applyResponsiveYAxisTicks } from "../../option/responsive-axis";
import type { EChartsSeriesOption } from "../../option/types";
import { getSeriesYAxisIndex } from "../../option/utils";
import type { TimelineEventsModel } from "../../timeline-events/types";
@@ -130,7 +131,7 @@ export function getScatterPlotOption(
...splitPanelOverrides,
grid,
xAxis,
- yAxis,
+ yAxis: applyResponsiveYAxisTicks(yAxis, chartModel, chartLayout, settings),
dataset: echartsDataset,
series: seriesOption,
};
diff --git a/frontend/src/metabase/viz-core/echarts/cartesian/waterfall/model/index.ts b/frontend/src/metabase/viz-core/echarts/cartesian/waterfall/model/index.ts
index cb87501dcdc..20a16343724 100644
--- a/frontend/src/metabase/viz-core/echarts/cartesian/waterfall/model/index.ts
+++ b/frontend/src/metabase/viz-core/echarts/cartesian/waterfall/model/index.ts
@@ -23,6 +23,7 @@ import {
} from "../../model/series";
import { getAxisTransforms } from "../../model/transforms";
import type { WaterfallChartModel } from "../../model/types";
+import { getLabelValueFormatting } from "../../model/util";
import { WATERFALL_END_KEY, WATERFALL_TOTAL_KEY } from "../constants";
import { getWaterfallXAxisModel } from "./axis";
@@ -38,6 +39,9 @@ export const getWaterfallChartModel = (
renderingContext: RenderingContext,
showWarning?: ShowWarning,
): WaterfallChartModel => {
+ const hasResponsiveTicks =
+ renderingContext.cartesianSize != null &&
+ renderingContext.cartesianSize !== "fullscreen";
// Waterfall chart support one card only
const [singleRawSeries] = rawSeries;
const { data } = singleRawSeries;
@@ -93,8 +97,15 @@ export const getWaterfallChartModel = (
xAxisModel,
);
+ const labelValueFormatting = getLabelValueFormatting(
+ settings["graph.label_value_formatting"],
+ hasResponsiveTicks,
+ );
const { formatter: waterfallLabelFormatter, isCompact } =
- getWaterfallLabelFormatter(seriesModel, transformedDataset, settings);
+ getWaterfallLabelFormatter(seriesModel, transformedDataset, {
+ ...settings,
+ "graph.label_value_formatting": labelValueFormatting,
+ });
const dataDensity = getWaterfallChartDataDensity(
transformedDataset,
@@ -112,9 +123,9 @@ export const getWaterfallChartModel = (
{ [WATERFALL_END_KEY]: seriesModel.column },
{
formattingOptions: {
- compact:
- settings["graph.label_value_formatting"] === "compact" || isCompact,
+ compact: labelValueFormatting === "compact" || isCompact,
},
+ hasResponsiveTicks,
},
);
diff --git a/frontend/src/metabase/viz-core/echarts/cartesian/waterfall/option/index.ts b/frontend/src/metabase/viz-core/echarts/cartesian/waterfall/option/index.ts
index c3b520ef834..0d2d217a3db 100644
--- a/frontend/src/metabase/viz-core/echarts/cartesian/waterfall/option/index.ts
+++ b/frontend/src/metabase/viz-core/echarts/cartesian/waterfall/option/index.ts
@@ -24,6 +24,7 @@ import {
getGoalLineParams,
getGoalLineSeriesOption,
} from "../../option/goal-line";
+import { applyResponsiveYAxisTicks } from "../../option/responsive-axis";
import {
buildEChartsLabelOptions,
computeContinuousScaleBarWidth,
@@ -249,6 +250,13 @@ export const getWaterfallChartOption = (
].flatMap((option) => option ?? []);
const echartsDataset = [{ source: chartModel.transformedDataset }];
+ const axes = buildAxes(
+ chartModel,
+ chartLayout,
+ settings,
+ hasTimelineEvents,
+ renderingContext,
+ );
return {
...getSharedEChartsOptions(isAnimated, renderingContext),
@@ -258,12 +266,12 @@ export const getWaterfallChartOption = (
},
dataset: echartsDataset,
series: seriesOption,
- ...buildAxes(
+ ...axes,
+ yAxis: applyResponsiveYAxisTicks(
+ axes.yAxis,
chartModel,
chartLayout,
settings,
- hasTimelineEvents,
- renderingContext,
),
};
};
diff --git a/frontend/src/metabase/viz-core/index.ts b/frontend/src/metabase/viz-core/index.ts
index cf515f04977..fc465a21209 100644
--- a/frontend/src/metabase/viz-core/index.ts
+++ b/frontend/src/metabase/viz-core/index.ts
@@ -68,14 +68,17 @@ export type {
} from "./echarts/cartesian/model/types";
export { getFormattingOptionsWithoutScaling } from "./echarts/cartesian/model/util";
export { createAxisVisibilityOption } from "./echarts/cartesian/option/axis";
-export { GOAL_LINE_DASH } from "./echarts/cartesian/option/goal-line";
+export {
+ GOAL_LINE_DASH,
+ isGoalLineSeriesId,
+} from "./echarts/cartesian/option/goal-line";
export {
buildBrushMirrorGraphics,
buildClearBrushMirrorGraphics,
getCartesianChartOption,
getTimelineSelectionSeries,
} from "./echarts/cartesian/option";
-export { TREND_LINE_DASH } from "./echarts/cartesian/option/trend-line";
+export { TREND_LINE_WIDTH } from "./echarts/cartesian/option/trend-line";
export { getScatterPlotModel } from "./echarts/cartesian/scatter/model";
export { getScatterPlotOption } from "./echarts/cartesian/scatter/option";
export {
@@ -423,7 +426,7 @@ export type {
RowChartTheme,
Series,
} from "./shared/components/RowChart/types";
-export { getDashboardAdjustedSettings } from "./shared/settings-adjustments";
+export { getSizeAdjustedSettings } from "./shared/settings-adjustments";
export {
getDefaultDimensionFilter,
getDefaultMetricFilter,
@@ -452,6 +455,7 @@ export type {
export type { HoveredData } from "./shared/types/events";
export type { ChartTicksFormatters } from "./shared/types/format";
export type { ContinuousDomain, Range } from "./shared/types/scale";
+export type { ChartGoal } from "./shared/types/settings";
export { getGroupedDataset, getSeries, trimData } from "./shared/utils/data";
export {
getLabelsMetricColumn,
@@ -467,6 +471,7 @@ export {
export {
DEFAULT_VISUALIZATION_THEME,
getVisualizationTheme,
+ getCartesianChartSize,
} from "./shared/utils/theme";
export type {
PivotedDatasetColumn,
@@ -495,6 +500,7 @@ export type {
TooltipRowModel,
} from "./types/hover";
export type {
+ CartesianChartSize,
Padding,
RenderingContext,
StaticVisualizationProps,
diff --git a/frontend/src/metabase/viz-core/lib/settings/graph.ts b/frontend/src/metabase/viz-core/lib/settings/graph.ts
index cfbe6e65ac8..b80a041a880 100644
--- a/frontend/src/metabase/viz-core/lib/settings/graph.ts
+++ b/frontend/src/metabase/viz-core/lib/settings/graph.ts
@@ -5,8 +5,13 @@ import { color } from "metabase/ui/colors";
import { mergeLazily } from "metabase/utils/merge-lazily";
import { getColumnKey } from "metabase-lib/v1/queries/utils/column-key";
import { isNumeric } from "metabase-lib/v1/types/utils/isa";
-import type { Series, VisualizationDisplay } from "metabase-types/api";
-import { isObjectWithRaw } from "metabase-types/guards";
+import type {
+ Series,
+ SeriesSettings,
+ VisualizationDisplay,
+ VisualizationSettings,
+} from "metabase-types/api";
+import { isLineStyle, isObjectWithRaw } from "metabase-types/guards";
import { getYAxisLabel } from "../../echarts/cartesian/model/axis";
import type { YAxisSeriesNames } from "../../echarts/cartesian/model/types";
@@ -45,6 +50,10 @@ import {
isXAxisScaleValid,
isYAxisUnpinFromZeroValid,
} from "../../shared/settings/cartesian-chart";
+import {
+ SERIES_SETTING_KEY,
+ isTrendLineUnavailable,
+} from "../../shared/settings/series";
import type {
ComputedVisualizationSettings,
SeriesSettingDefinition,
@@ -61,7 +70,7 @@ import { MAX_SERIES, columnsAreValid } from "../utils";
import { trackStackedSeriesEnabled } from "./analytics";
import { columnSettings } from "./column";
-import { seriesSetting } from "./series";
+import { keyForSingleSeries, seriesSetting } from "./series";
import { getOptionFromColumn } from "./utils";
import { getBreakoutCardinality } from "./validation";
@@ -446,6 +455,44 @@ export const TOOLTIP_SETTINGS: VisualizationSettingsDefinitions = {
},
};
+const isTrendLineDisabled = (
+ series: Series,
+ vizSettings: ComputedVisualizationSettings,
+) =>
+ isTrendLineUnavailable(series, vizSettings) ||
+ !vizSettings["graph.show_trendline"];
+
+/**
+ * Trend line color and style are stored per series. With a single series the
+ * Display tab edits that series' settings directly, so the customization keeps
+ * applying when the chart later gains series and moves to the series popover.
+ */
+const getSingleSeriesTrendLineSetting =
+ (key: "trendline.color" | "trendline.style") =>
+ (series: Series, vizSettings: ComputedVisualizationSettings) =>
+ vizSettings.series?.(series[0])?.[key];
+
+const isSingleSeriesTrendLineSettingHidden = (
+ series: Series,
+ vizSettings: ComputedVisualizationSettings,
+) => isTrendLineDisabled(series, vizSettings) || series.length > 1;
+
+const updateSingleSeriesTrendLineSetting = (
+ series: Series,
+ vizSettings: ComputedVisualizationSettings,
+ onChangeSettings: (settings: Partial<VisualizationSettings>) => void,
+ changes: SeriesSettings,
+) => {
+ const seriesKey = keyForSingleSeries(series[0]);
+ const seriesSettings = vizSettings[SERIES_SETTING_KEY] ?? {};
+ onChangeSettings({
+ [SERIES_SETTING_KEY]: {
+ ...seriesSettings,
+ [seriesKey]: { ...seriesSettings[seriesKey], ...changes },
+ },
+ });
+};
+
export const GRAPH_TREND_SETTINGS: VisualizationSettingsDefinitions = {
"graph.show_trendline": {
getSection: () => t`Display`,
@@ -454,17 +501,69 @@ export const GRAPH_TREND_SETTINGS: VisualizationSettingsDefinitions = {
},
widget: "toggle",
getDefault: () => false,
- getHidden: (series, vizSettings) => {
- const { insights } = series[0].data;
- const graphDimensions = vizSettings["graph.dimensions"] ?? [];
- return !insights || insights.length === 0 || graphDimensions.length > 1;
- },
+ getHidden: isTrendLineUnavailable,
useRawSeries: true,
inline: true,
getWrapperStyle: () => ({
marginBottom: "1rem",
}),
},
+ "graph.trendline_color": {
+ getSection: () => t`Display`,
+ widget: "color",
+ getValue: getSingleSeriesTrendLineSetting("trendline.color"),
+ getProps: (series, vizSettings, _onChange, _extra, onChangeSettings) => ({
+ title: t`Trend line color`,
+ bordered: true,
+ pillSize: "small" as const,
+ onChange: (value: string) =>
+ updateSingleSeriesTrendLineSetting(
+ series,
+ vizSettings,
+ onChangeSettings,
+ {
+ "trendline.color": value,
+ },
+ ),
+ }),
+ getHidden: isSingleSeriesTrendLineSettingHidden,
+ readDependencies: ["series", "graph.show_trendline"],
+ },
+ "graph.trendline_style": {
+ getSection: () => t`Display`,
+ get title() {
+ return t`Trend line style`;
+ },
+ widget: "segmentedControl",
+ getValue: getSingleSeriesTrendLineSetting("trendline.style"),
+ getProps: (series, vizSettings, _onChange, _extra, onChangeSettings) => ({
+ options: [
+ { name: t`Solid`, value: "solid", icon: "line_style_solid" as const },
+ {
+ name: t`Dashed`,
+ value: "dashed",
+ icon: "line_style_dashed" as const,
+ },
+ {
+ name: t`Dotted`,
+ value: "dotted",
+ icon: "line_style_dotted" as const,
+ },
+ ],
+ onChange: (value: string) => {
+ if (isLineStyle(value)) {
+ updateSingleSeriesTrendLineSetting(
+ series,
+ vizSettings,
+ onChangeSettings,
+ { "trendline.style": value },
+ );
+ }
+ },
+ }),
+ getHidden: isSingleSeriesTrendLineSettingHidden,
+ readDependencies: ["series", "graph.show_trendline"],
+ },
};
export const GRAPH_DISPLAY_VALUES_SETTINGS: VisualizationSettingsDefinitions = {
@@ -1000,8 +1099,29 @@ export const GRAPH_AXIS_SETTINGS: VisualizationSettingsDefinitions = {
get title() {
return t`Show label`;
},
- inline: true,
- widget: "toggle",
+ widget: "segmentedControl",
+ getProps: () => ({
+ options: [
+ {
+ get name() {
+ return t`Auto`;
+ },
+ value: "auto",
+ },
+ {
+ get name() {
+ return t`On`;
+ },
+ value: true,
+ },
+ {
+ get name() {
+ return t`Off`;
+ },
+ value: false,
+ },
+ ],
+ }),
getDefault: getIsXAxisLabelEnabledDefault,
},
"graph.x_axis.title_text": {
@@ -1030,8 +1150,29 @@ export const GRAPH_AXIS_SETTINGS: VisualizationSettingsDefinitions = {
get group() {
return t`Y-axis`;
},
- widget: "toggle",
- inline: true,
+ widget: "segmentedControl",
+ getProps: () => ({
+ options: [
+ {
+ get name() {
+ return t`Auto`;
+ },
+ value: "auto",
+ },
+ {
+ get name() {
+ return t`On`;
+ },
+ value: true,
+ },
+ {
+ get name() {
+ return t`Off`;
+ },
+ value: false,
+ },
+ ],
+ }),
getDefault: getIsYAxisLabelEnabledDefault,
},
"graph.y_axis.split_number": {
diff --git a/frontend/src/metabase/viz-core/lib/settings/graph.unit.spec.ts b/frontend/src/metabase/viz-core/lib/settings/graph.unit.spec.ts
index 6ba77264909..80b71080ccc 100644
--- a/frontend/src/metabase/viz-core/lib/settings/graph.unit.spec.ts
+++ b/frontend/src/metabase/viz-core/lib/settings/graph.unit.spec.ts
@@ -1,5 +1,7 @@
+import _ from "underscore";
+
import { checkNotNull } from "metabase/utils/types";
-import type { VisualizationDisplay } from "metabase-types/api";
+import type { SeriesSettings, VisualizationDisplay } from "metabase-types/api";
import {
createMockCard,
createMockColumn,
@@ -9,6 +11,9 @@ import {
createMockSingleSeries,
} from "metabase-types/api/mocks";
+import type { LegacySeriesSettingsObjectKey } from "../../echarts/cartesian/model/types";
+import type { ComputedVisualizationSettings } from "../../types";
+
import {
GRAPH_AXIS_SETTINGS,
GRAPH_DISPLAY_VALUES_SETTINGS,
@@ -393,6 +398,164 @@ describe("GRAPH_AXIS_SETTINGS", () => {
expect(isHidden).toBe(true);
});
});
+
+ describe("single series trend line customization", () => {
+ const CUSTOM_COLOR = "#ED6E6E";
+
+ const seriesWithInsights = (names: string[]) =>
+ names.map((name) =>
+ createMockSingleSeries(
+ { name },
+ {
+ data: createMockDatasetData({
+ insights: [createMockInsight({ col: name })],
+ }),
+ },
+ ),
+ );
+
+ const getSettings = (
+ seriesSettings: Record<string, SeriesSettings>,
+ ): ComputedVisualizationSettings => ({
+ "graph.show_trendline": true,
+ "graph.dimensions": ["FOO"],
+ series_settings: seriesSettings,
+ series: (key: LegacySeriesSettingsObjectKey) =>
+ seriesSettings[key.card.name ?? ""] ?? {},
+ });
+
+ describe("graph.trendline_color", () => {
+ const definition = checkNotNull(
+ GRAPH_TREND_SETTINGS["graph.trendline_color"],
+ );
+ const getValue = checkNotNull(definition.getValue);
+ const getHidden = checkNotNull(definition.getHidden);
+ const getProps = checkNotNull(definition.getProps);
+
+ it("should read the color of the single series", () => {
+ const series = seriesWithInsights(["count"]);
+ const settings = getSettings({
+ count: { "trendline.color": CUSTOM_COLOR },
+ });
+
+ expect(getValue(series, settings)).toBe(CUSTOM_COLOR);
+ });
+
+ it("should write the color into the single series settings and keep the rest", () => {
+ const series = seriesWithInsights(["count"]);
+ const settings = getSettings({
+ count: { "trendline.style": "dotted" },
+ avg: { color: "#88BF4D" },
+ });
+ const onChangeSettings = jest.fn();
+ const { onChange } = getProps(
+ series,
+ settings,
+ _.noop,
+ undefined,
+ onChangeSettings,
+ );
+
+ expect(typeof onChange).toBe("function");
+ if (typeof onChange === "function") {
+ onChange(CUSTOM_COLOR);
+ }
+
+ expect(onChangeSettings).toHaveBeenCalledWith({
+ series_settings: {
+ count: {
+ "trendline.style": "dotted",
+ "trendline.color": CUSTOM_COLOR,
+ },
+ avg: { color: "#88BF4D" },
+ },
+ });
+ });
+
+ it("should be hidden when the trend line is disabled", () => {
+ const series = seriesWithInsights(["count"]);
+
+ expect(
+ getHidden(series, {
+ ...getSettings({}),
+ "graph.show_trendline": false,
+ }),
+ ).toBe(true);
+ expect(getHidden(series, getSettings({}))).toBe(false);
+ });
+
+ it("should be hidden with multiple series, which are customized per series", () => {
+ expect(
+ getHidden(seriesWithInsights(["count", "avg"]), getSettings({})),
+ ).toBe(true);
+ });
+ });
+
+ describe("graph.trendline_style", () => {
+ const definition = checkNotNull(
+ GRAPH_TREND_SETTINGS["graph.trendline_style"],
+ );
+ const getValue = checkNotNull(definition.getValue);
+ const getHidden = checkNotNull(definition.getHidden);
+ const getProps = checkNotNull(definition.getProps);
+
+ it("should read the style of the single series", () => {
+ const series = seriesWithInsights(["count"]);
+ const settings = getSettings({
+ count: { "trendline.style": "dashed" },
+ });
+
+ expect(getValue(series, settings)).toBe("dashed");
+ });
+
+ it("should write the style into the single series settings and keep the rest", () => {
+ const series = seriesWithInsights(["count"]);
+ const settings = getSettings({
+ count: { "trendline.color": CUSTOM_COLOR },
+ });
+ const onChangeSettings = jest.fn();
+ const { onChange } = getProps(
+ series,
+ settings,
+ _.noop,
+ undefined,
+ onChangeSettings,
+ );
+
+ expect(typeof onChange).toBe("function");
+ if (typeof onChange === "function") {
+ onChange("dotted");
+ }
+
+ expect(onChangeSettings).toHaveBeenCalledWith({
+ series_settings: {
+ count: {
+ "trendline.color": CUSTOM_COLOR,
+ "trendline.style": "dotted",
+ },
+ },
+ });
+ });
+
+ it("should be hidden when the trend line is disabled", () => {
+ const series = seriesWithInsights(["count"]);
+
+ expect(
+ getHidden(series, {
+ ...getSettings({}),
+ "graph.show_trendline": false,
+ }),
+ ).toBe(true);
+ expect(getHidden(series, getSettings({}))).toBe(false);
+ });
+
+ it("should be hidden with multiple series, which are customized per series", () => {
+ expect(
+ getHidden(seriesWithInsights(["count", "avg"]), getSettings({})),
+ ).toBe(true);
+ });
+ });
+ });
});
describe("GRAPH_DISPLAY_VALUES_SETTINGS", () => {
diff --git a/frontend/src/metabase/viz-core/lib/settings/series.ts b/frontend/src/metabase/viz-core/lib/settings/series.ts
index 920a5d91ab9..9bde585f7ba 100644
--- a/frontend/src/metabase/viz-core/lib/settings/series.ts
+++ b/frontend/src/metabase/viz-core/lib/settings/series.ts
@@ -1,6 +1,8 @@
import { getIn } from "icepick";
import { t } from "ttag";
+import { color } from "metabase/ui/colors";
+import { deriveChartShadeColor } from "metabase/ui/colors/accents";
import type {
Series,
SeriesCard,
@@ -22,12 +24,31 @@ import {
getSeriesDefaultLinearInterpolate,
getSeriesDefaultShowSeriesTrendline,
getSeriesDefaultShowSeriesValues,
+ isSeriesTrendLineUnavailable,
} from "../../shared/settings/series";
-import type { VisualizationSettingsDefinitions } from "../../types";
+import type {
+ ComputedVisualizationSettings,
+ SettingsExtra,
+ VisualizationSettingsDefinitions,
+} from "../../types";
import { getNameForCard } from "../series";
import { type NestedSettingsOptions, nestedSettings } from "./nested";
+const isSeriesTrendLineCustomizationHidden = (
+ single: SingleSeries,
+ seriesSettings: ComputedVisualizationSettings,
+ extra?: SettingsExtra,
+) => {
+ const { series = [], settings = {} } = extra ?? {};
+ return (
+ series.length <= 1 || // with one series the trend line is customized in the Display tab
+ isSeriesTrendLineUnavailable(single, series, settings) ||
+ !settings["graph.show_trendline"] ||
+ !seriesSettings.show_series_trendline
+ );
+};
+
export function keyForSingleSeries(single: SingleSeries): string {
if (isLegacySeriesCard(single.card)) {
// _seriesKey is sometimes set by transformSeries
@@ -236,10 +257,11 @@ export function seriesSetting({
},
widget: "toggle",
inline: true,
- getHidden: (_single, _seriesSettings, extra) => {
+ getHidden: (single, _seriesSettings, extra) => {
const { series = [], settings = {} } = extra ?? {};
return (
series.length <= 1 || // no need to show series-level control if there's only one series
+ isSeriesTrendLineUnavailable(single, series, settings) ||
!settings["graph.show_trendline"] // don't show it unless this chart has a global setting;
);
},
@@ -247,6 +269,59 @@ export function seriesSetting({
getSeriesDefaultShowSeriesTrendline(extra?.settings ?? {}),
readDependencies: ["graph.show_trendline"],
},
+ // With multiple series, trend lines are customized per series here instead
+ // of the Display tab, which only has room for a single color and style.
+ "trendline.color": {
+ widget: "color",
+ getProps: () => ({
+ title: t`Trend line color`,
+ bordered: true,
+ pillSize: "small" as const,
+ // the color dropdown must not escape the series settings popover
+ withinPortal: false,
+ }),
+ getHidden: (single, seriesSettings, extra) =>
+ isSeriesTrendLineCustomizationHidden(single, seriesSettings, extra),
+ getDefault: (single, _seriesSettings, extra) => {
+ const seriesColor =
+ extra?.settings?.[SERIES_COLORS_SETTING_KEY]?.[
+ keyForSingleSeries(single)
+ ];
+ return seriesColor != null
+ ? deriveChartShadeColor(seriesColor)
+ : color("brand");
+ },
+ readDependencies: [
+ "color",
+ "show_series_trendline",
+ "graph.show_trendline",
+ ],
+ },
+ "trendline.style": {
+ get title() {
+ return t`Trend line style`;
+ },
+ widget: "segmentedControl",
+ getProps: () => ({
+ options: [
+ { name: t`Solid`, value: "solid", icon: "line_style_solid" as const },
+ {
+ name: t`Dashed`,
+ value: "dashed",
+ icon: "line_style_dashed" as const,
+ },
+ {
+ name: t`Dotted`,
+ value: "dotted",
+ icon: "line_style_dotted" as const,
+ },
+ ],
+ }),
+ getHidden: (single, seriesSettings, extra) =>
+ isSeriesTrendLineCustomizationHidden(single, seriesSettings, extra),
+ getDefault: () => "solid",
+ readDependencies: ["show_series_trendline", "graph.show_trendline"],
+ },
show_series_values: {
get title() {
return t`Show values for this series`;
diff --git a/frontend/src/metabase/viz-core/lib/settings/series.unit.spec.ts b/frontend/src/metabase/viz-core/lib/settings/series.unit.spec.ts
index b9cc25a7d9d..9d522977c3a 100644
--- a/frontend/src/metabase/viz-core/lib/settings/series.unit.spec.ts
+++ b/frontend/src/metabase/viz-core/lib/settings/series.unit.spec.ts
@@ -1,11 +1,24 @@
+import _ from "underscore";
+
+import { deriveChartShadeColor } from "metabase/ui/colors/accents";
+import { checkNotNull } from "metabase/utils/types";
+import type { Series, SingleSeries } from "metabase-types/api";
import {
createMockCard,
createMockDataset,
+ createMockDatasetData,
+ createMockInsight,
createMockSingleSeries,
createMockVisualizationSettings,
} from "metabase-types/api/mocks";
-import { getColors } from "./series";
+import { SERIES_SETTING_KEY } from "../../shared/settings/series";
+import type {
+ ComputedVisualizationSettings,
+ VisualizationSettingsDefinitions,
+} from "../../types";
+
+import { getColors, seriesSetting } from "./series";
describe("Series unit settings", () => {
describe("getColors", () => {
@@ -91,3 +104,228 @@ describe("Series unit settings", () => {
});
});
});
+
+describe("series trend line settings", () => {
+ // the definitions map has a catch-all index signature, so type the nested
+ // widget props at this boundary to keep the guard calls below checked
+ type SeriesSettingsWidgetProps = {
+ getSettingDefinitionsForObject: (
+ series: Series,
+ single: SingleSeries,
+ ) => VisualizationSettingsDefinitions;
+ };
+
+ const getSeriesSettingDefinitions = (
+ series: Series,
+ settings: ComputedVisualizationSettings,
+ ): VisualizationSettingsDefinitions => {
+ const getProps = checkNotNull(
+ seriesSetting()[SERIES_SETTING_KEY]?.getProps,
+ );
+ const { getSettingDefinitionsForObject }: SeriesSettingsWidgetProps =
+ getProps(series, { [SERIES_SETTING_KEY]: {}, ...settings }, _.noop, {
+ series,
+ settings,
+ });
+ return getSettingDefinitionsForObject(series, series[0]);
+ };
+
+ const getIsHidden = (
+ key: "show_series_trendline" | "trendline.color" | "trendline.style",
+ series: Series,
+ settings: ComputedVisualizationSettings,
+ seriesSettings: ComputedVisualizationSettings = {},
+ single: SingleSeries = series[0],
+ ) => {
+ const definitions = getSeriesSettingDefinitions(series, settings);
+ const getHidden = checkNotNull(definitions[key]?.getHidden);
+ return getHidden(single, seriesSettings, { series, settings });
+ };
+
+ const insights = [createMockInsight({ col: "count" })];
+
+ const multiMetricSeries = (): Series => [
+ createMockSingleSeries(
+ { name: "count" },
+ { data: createMockDatasetData({ insights }) },
+ ),
+ createMockSingleSeries(
+ { name: "sum" },
+ { data: createMockDatasetData({ insights }) },
+ ),
+ ];
+
+ // series produced by a breakout carry no insights; only the raw card does
+ const breakoutSeries = (): Series =>
+ Object.assign(
+ [
+ createMockSingleSeries(
+ { name: "Gadget" },
+ { data: createMockDatasetData({ insights: undefined }) },
+ ),
+ createMockSingleSeries(
+ { name: "Gizmo" },
+ { data: createMockDatasetData({ insights: undefined }) },
+ ),
+ ],
+ {
+ _raw: [
+ createMockSingleSeries(
+ {},
+ { data: createMockDatasetData({ insights }) },
+ ),
+ ],
+ },
+ );
+
+ const trendLineEnabled = { show_series_trendline: true };
+
+ it("uses the current series color for the default trend line color", () => {
+ const series = multiMetricSeries();
+ const settings: ComputedVisualizationSettings = {
+ "graph.show_trendline": true,
+ "graph.dimensions": ["CREATED_AT"],
+ "series_settings.colors": { count: "#16618E" },
+ };
+ const definitions = getSeriesSettingDefinitions(series, settings);
+ const getDefault = checkNotNull(definitions["trendline.color"]?.getDefault);
+
+ expect(
+ getDefault(series[0], { color: "#CC1122" }, { series, settings }),
+ ).toBe(deriveChartShadeColor("#16618E"));
+ });
+
+ it("should show the series trend line settings for multiple metrics with a single dimension", () => {
+ const settings = {
+ "graph.show_trendline": true,
+ "graph.dimensions": ["CREATED_AT"],
+ };
+
+ expect(
+ getIsHidden("show_series_trendline", multiMetricSeries(), settings),
+ ).toBe(false);
+ expect(
+ getIsHidden(
+ "trendline.color",
+ multiMetricSeries(),
+ settings,
+ trendLineEnabled,
+ ),
+ ).toBe(false);
+ expect(
+ getIsHidden(
+ "trendline.style",
+ multiMetricSeries(),
+ settings,
+ trendLineEnabled,
+ ),
+ ).toBe(false);
+ });
+
+ it("should hide the series trend line settings when the chart has multiple dimensions", () => {
+ const settings = {
+ "graph.show_trendline": true,
+ "graph.dimensions": ["CREATED_AT", "CATEGORY"],
+ };
+
+ expect(
+ getIsHidden("show_series_trendline", breakoutSeries(), settings),
+ ).toBe(true);
+ expect(
+ getIsHidden(
+ "trendline.color",
+ breakoutSeries(),
+ settings,
+ trendLineEnabled,
+ ),
+ ).toBe(true);
+ expect(
+ getIsHidden(
+ "trendline.style",
+ breakoutSeries(),
+ settings,
+ trendLineEnabled,
+ ),
+ ).toBe(true);
+ });
+
+ it("should hide the series trend line settings when the series have no insights", () => {
+ const settings = {
+ "graph.show_trendline": true,
+ "graph.dimensions": ["CREATED_AT"],
+ };
+ const series: Series = [
+ createMockSingleSeries(
+ { name: "count" },
+ { data: createMockDatasetData({ insights: [] }) },
+ ),
+ createMockSingleSeries(
+ { name: "sum" },
+ { data: createMockDatasetData({ insights: [] }) },
+ ),
+ ];
+
+ expect(getIsHidden("show_series_trendline", series, settings)).toBe(true);
+ expect(
+ getIsHidden("trendline.color", series, settings, trendLineEnabled),
+ ).toBe(true);
+ });
+
+ it("should read insights from the raw series behind transformed series", () => {
+ const settings = {
+ "graph.show_trendline": true,
+ "graph.dimensions": ["CREATED_AT"],
+ };
+
+ expect(
+ getIsHidden("show_series_trendline", breakoutSeries(), settings),
+ ).toBe(false);
+ });
+
+ it("should check the insights of each series' own card when cards are combined", () => {
+ const settings = {
+ "graph.show_trendline": true,
+ "graph.dimensions": ["CREATED_AT"],
+ };
+ const series: Series = Object.assign(
+ [
+ createMockSingleSeries(
+ { id: 1, name: "Orders" },
+ { data: createMockDatasetData({ insights: undefined }) },
+ ),
+ createMockSingleSeries(
+ { id: 2, name: "Revenue" },
+ { data: createMockDatasetData({ insights: undefined }) },
+ ),
+ ],
+ {
+ _raw: [
+ createMockSingleSeries(
+ { id: 1, name: "Orders" },
+ { data: createMockDatasetData({ insights: [] }) },
+ ),
+ createMockSingleSeries(
+ { id: 2, name: "Revenue" },
+ { data: createMockDatasetData({ insights }) },
+ ),
+ ],
+ },
+ );
+
+ expect(
+ getIsHidden("show_series_trendline", series, settings, {}, series[0]),
+ ).toBe(true);
+ expect(
+ getIsHidden("show_series_trendline", series, settings, {}, series[1]),
+ ).toBe(false);
+ expect(
+ getIsHidden(
+ "trendline.color",
+ series,
+ settings,
+ trendLineEnabled,
+ series[1],
+ ),
+ ).toBe(false);
+ });
+});
diff --git a/frontend/src/metabase/viz-core/shared/components/RowChart/RowChart.tsx b/frontend/src/metabase/viz-core/shared/components/RowChart/RowChart.tsx
index cc87d37f3e4..85251a97e2d 100644
--- a/frontend/src/metabase/viz-core/shared/components/RowChart/RowChart.tsx
+++ b/frontend/src/metabase/viz-core/shared/components/RowChart/RowChart.tsx
@@ -57,6 +57,7 @@ export interface RowChartProps<TDatum> {
xScaleType?: ContinuousScaleType;
style?: React.CSSProperties;
+ isStatic?: boolean;
hoveredData?: HoveredData | null;
onClick?: (event: React.MouseEvent, bar: BarData<TDatum, SeriesInfo>) => void;
@@ -64,6 +65,7 @@ export interface RowChartProps<TDatum> {
event: React.MouseEvent,
bar: BarData<TDatum, SeriesInfo> | null,
) => void;
+ onGoalHover?: (event: React.MouseEvent, goal: ChartGoal | null) => void;
}
export const RowChart = <TDatum,>({
@@ -99,10 +101,12 @@ export const RowChart = <TDatum,>({
measureTextWidth,
style,
+ isStatic,
hoveredData,
onClick,
onHover,
+ onGoalHover,
}: RowChartProps<TDatum>) => {
const isMeasured = typeof width === "number" && typeof height === "number";
@@ -248,14 +252,22 @@ export const RowChart = <TDatum,>({
);
const rowChartGoal = useMemo(
- () => getRowChartGoal(goal, theme.goal, measureTextWidth, paddedXScale),
- [goal, measureTextWidth, theme.goal, paddedXScale],
+ () =>
+ getRowChartGoal(
+ goal,
+ theme.goal,
+ measureTextWidth,
+ paddedXScale,
+ isStatic,
+ ),
+ [goal, measureTextWidth, theme.goal, paddedXScale, isStatic],
);
return (
<RowChartView
style={style}
isStacked={stackOffset != null}
+ isStatic={isStatic}
seriesData={seriesData}
innerHeight={innerHeight}
innerWidth={innerWidth}
@@ -279,6 +291,7 @@ export const RowChart = <TDatum,>({
measureTextWidth={measureTextWidth}
onClick={onClick}
onHover={onHover}
+ onGoalHover={onGoalHover}
/>
);
};
diff --git a/frontend/src/metabase/viz-core/shared/components/RowChart/RowChart.unit.spec.tsx b/frontend/src/metabase/viz-core/shared/components/RowChart/RowChart.unit.spec.tsx
index b96763e5658..191c10984b7 100644
--- a/frontend/src/metabase/viz-core/shared/components/RowChart/RowChart.unit.spec.tsx
+++ b/frontend/src/metabase/viz-core/shared/components/RowChart/RowChart.unit.spec.tsx
@@ -22,7 +22,17 @@ const testFont: ChartFont = {
const theme: RowChartTheme = {
axis: { color: "gray", ticks: testFont, label: testFont },
dataLabels: testFont,
- goal: { lineStroke: "gray", label: testFont },
+ goal: {
+ lineStroke: "gray",
+ lineShadowStroke: "white",
+ label: testFont,
+ marker: {
+ iconColor: "gray",
+ backgroundColor: "white",
+ hoverBackgroundColor: "gray",
+ shadowColor: "gray",
+ },
+ },
grid: {
color: "gray",
},
@@ -255,9 +265,32 @@ describe("RowChart", () => {
expect(goalLine).toBeFalsy();
});
- it("should render goal line when specified", () => {
- const { goalLine } = setup({ goal: { label: "Goal label", value: 100 } });
- expect(goalLine?.textContent).toBe("Goal label");
+ it("should call onGoalHover when hovering the goal marker", async () => {
+ const goal = { label: "Goal label", value: 100 };
+ const onGoalHover = jest.fn();
+ setup({ goal, onGoalHover });
+
+ await userEvent.hover(screen.getByTestId("goal-line-marker"));
+ expect(onGoalHover).toHaveBeenLastCalledWith(
+ expect.objectContaining({ target: expect.anything() }),
+ expect.objectContaining(goal),
+ );
+
+ await userEvent.unhover(screen.getByTestId("goal-line-marker"));
+ expect(onGoalHover).toHaveBeenLastCalledWith(
+ expect.objectContaining({ target: expect.anything() }),
+ null,
+ );
+ });
+
+ it("should show the goal label instead of the marker on static rendering", () => {
+ const { goalLine } = setup({
+ goal: { label: "Goal label", value: 100 },
+ isStatic: true,
+ });
+
+ expect(goalLine).toHaveTextContent("Goal label");
+ expect(screen.queryByTestId("goal-line-marker")).not.toBeInTheDocument();
});
});
diff --git a/frontend/src/metabase/viz-core/shared/components/RowChart/theme.ts b/frontend/src/metabase/viz-core/shared/components/RowChart/theme.ts
index f54e75d70e1..9502b7f6315 100644
--- a/frontend/src/metabase/viz-core/shared/components/RowChart/theme.ts
+++ b/frontend/src/metabase/viz-core/shared/components/RowChart/theme.ts
@@ -23,13 +23,20 @@ export const getStaticChartTheme = (
},
},
goal: {
- lineStroke: getColor("text-secondary"),
+ lineStroke: getColor("icon-primary"),
+ lineShadowStroke: getColor("background_surface-primary"),
label: {
size: 14,
weight: 700,
color: getColor("text-secondary"),
family: fontFamily,
},
+ marker: {
+ iconColor: getColor("icon-primary"),
+ backgroundColor: getColor("background_surface-primary"),
+ hoverBackgroundColor: getColor("background_surface-primary-hover"),
+ shadowColor: getColor("shadow-default"),
+ },
},
dataLabels: {
weight: 700,
diff --git a/frontend/src/metabase/viz-core/shared/components/RowChart/utils/layout.ts b/frontend/src/metabase/viz-core/shared/components/RowChart/utils/layout.ts
index f9b1e98e7f1..7461a48510d 100644
--- a/frontend/src/metabase/viz-core/shared/components/RowChart/utils/layout.ts
+++ b/frontend/src/metabase/viz-core/shared/components/RowChart/utils/layout.ts
@@ -91,11 +91,16 @@ export const getRowChartGoal = (
style: GoalStyle,
measureTextWidth: TextWidthMeasurer,
xScale: ScaleContinuousNumeric<number, number, never>,
+ isStatic?: boolean,
) => {
if (!goal) {
return null;
}
+ if (!isStatic) {
+ return { ...goal, position: "right" as const };
+ }
+
const labelWidth = measureTextWidth(goal.label, style.label);
const goalX = xScale(goal.value);
const xMax = xScale.range()[1];
diff --git a/frontend/src/metabase/viz-core/shared/components/RowChartView/RowChartView.tsx b/frontend/src/metabase/viz-core/shared/components/RowChartView/RowChartView.tsx
index 9ff10771477..03d0bfd8eab 100644
--- a/frontend/src/metabase/viz-core/shared/components/RowChartView/RowChartView.tsx
+++ b/frontend/src/metabase/viz-core/shared/components/RowChartView/RowChartView.tsx
@@ -15,6 +15,7 @@ import { truncateText } from "../../../lib/text";
import type { SeriesInfo } from "../../types/data";
import type { HoveredData } from "../../types/events";
import type { Margin } from "../../types/layout";
+import type { ChartGoal } from "../../types/settings";
import type { BarData, RowChartTheme, SeriesData } from "../RowChart/types";
import { VerticalGoalLine } from "../VerticalGoalLine/VerticalGoalLine";
@@ -49,6 +50,7 @@ export interface RowChartViewProps<TDatum> {
hasXAxis?: boolean;
hasYAxis?: boolean;
isStacked?: boolean;
+ isStatic?: boolean;
style?: React.CSSProperties;
hoveredData?: HoveredData | null;
measureTextWidth?: TextWidthMeasurer;
@@ -60,6 +62,10 @@ export interface RowChartViewProps<TDatum> {
event: React.MouseEvent<Element>,
bar: BarData<TDatum, SeriesInfo>,
) => void;
+ onGoalHover?: (
+ event: React.MouseEvent<Element>,
+ goal: ChartGoal | null,
+ ) => void;
}
const RowChartView = <TDatum,>({
@@ -82,11 +88,13 @@ const RowChartView = <TDatum,>({
hasXAxis = true,
hasYAxis = true,
isStacked,
+ isStatic,
style,
hoveredData,
measureTextWidth,
onHover,
onClick,
+ onGoalHover,
}: RowChartViewProps<TDatum>) => {
const innerBarScale = isStacked
? null
@@ -218,16 +226,6 @@ const RowChartView = <TDatum,>({
});
})}
- {goal && (
- <VerticalGoalLine
- x={goalLineX}
- height={innerHeight}
- label={goal.label}
- style={theme.goal}
- position={goal.position}
- />
- )}
-
<AxisLeft
label={yLabel ?? ""}
labelProps={{
@@ -283,6 +281,19 @@ const RowChartView = <TDatum,>({
textAnchor: "middle",
})}
/>
+
+ {goal && (
+ <VerticalGoalLine
+ x={goalLineX}
+ height={innerHeight}
+ label={goal.label}
+ style={theme.goal}
+ position={goal.position}
+ isStatic={isStatic}
+ onMarkerMouseEnter={(event) => onGoalHover?.(event, goal)}
+ onMarkerMouseLeave={(event) => onGoalHover?.(event, null)}
+ />
+ )}
</Group>
</svg>
);
diff --git a/frontend/src/metabase/viz-core/shared/components/VerticalGoalLine/GoalLineMarker.tsx b/frontend/src/metabase/viz-core/shared/components/VerticalGoalLine/GoalLineMarker.tsx
new file mode 100644
index 00000000000..3a078595995
--- /dev/null
+++ b/frontend/src/metabase/viz-core/shared/components/VerticalGoalLine/GoalLineMarker.tsx
@@ -0,0 +1,70 @@
+import { useState } from "react";
+
+import { CHART_STYLE } from "../../../echarts/cartesian/constants/style";
+import type { GoalMarkerStyle } from "../../types/style";
+
+interface GoalLineMarkerProps {
+ x: number;
+ y: number;
+ style: GoalMarkerStyle;
+ onMouseEnter?: (event: React.MouseEvent) => void;
+ onMouseLeave?: (event: React.MouseEvent) => void;
+}
+
+export const GoalLineMarker = ({
+ x,
+ y,
+ style,
+ onMouseEnter,
+ onMouseLeave,
+}: GoalLineMarkerProps) => {
+ const [isHovered, setIsHovered] = useState(false);
+ const {
+ outerRingRadius,
+ innerRingRadius,
+ ringWidth,
+ backgroundRadius,
+ shadowSpread,
+ hitAreaRadius,
+ } = CHART_STYLE.goalLine.marker;
+
+ const handleMouseEnter = (event: React.MouseEvent) => {
+ setIsHovered(true);
+ onMouseEnter?.(event);
+ };
+
+ const handleMouseLeave = (event: React.MouseEvent) => {
+ setIsHovered(false);
+ onMouseLeave?.(event);
+ };
+
+ return (
+ <g
+ data-testid="goal-line-marker"
+ transform={`translate(${x}, ${y})`}
+ onMouseEnter={handleMouseEnter}
+ onMouseLeave={handleMouseLeave}
+ >
+ <g pointerEvents="none">
+ <circle r={backgroundRadius + shadowSpread} fill={style.shadowColor} />
+ <circle r={backgroundRadius} fill={style.backgroundColor} />
+ {isHovered && (
+ <circle r={backgroundRadius} fill={style.hoverBackgroundColor} />
+ )}
+ <circle
+ r={outerRingRadius}
+ fill="none"
+ stroke={style.iconColor}
+ strokeWidth={ringWidth}
+ />
+ <circle
+ r={innerRingRadius}
+ fill="none"
+ stroke={style.iconColor}
+ strokeWidth={ringWidth}
+ />
+ </g>
+ <circle r={hitAreaRadius} fill={style.iconColor} opacity={0} />
+ </g>
+ );
+};
diff --git a/frontend/src/metabase/viz-core/shared/components/VerticalGoalLine/VerticalGoalLine.tsx b/frontend/src/metabase/viz-core/shared/components/VerticalGoalLine/VerticalGoalLine.tsx
index c151ee79d04..7d1e3b88ac5 100644
--- a/frontend/src/metabase/viz-core/shared/components/VerticalGoalLine/VerticalGoalLine.tsx
+++ b/frontend/src/metabase/viz-core/shared/components/VerticalGoalLine/VerticalGoalLine.tsx
@@ -1,14 +1,23 @@
import { Line } from "@visx/shape";
import { Text } from "@visx/text";
+import {
+ GOAL_LINE_DASH,
+ GOAL_LINE_WIDTH,
+} from "../../../echarts/cartesian/option/goal-line";
import type { GoalStyle } from "../../types/style";
+import { GoalLineMarker } from "./GoalLineMarker";
+
interface VerticalGoalLineProps {
x: number;
height: number;
label: string;
position: "left" | "right";
style: GoalStyle;
+ isStatic?: boolean;
+ onMarkerMouseEnter?: (event: React.MouseEvent) => void;
+ onMarkerMouseLeave?: (event: React.MouseEvent) => void;
}
export const VerticalGoalLine = ({
@@ -17,32 +26,62 @@ export const VerticalGoalLine = ({
label,
style,
position = "right",
+ isStatic,
+ onMarkerMouseEnter,
+ onMarkerMouseLeave,
}: VerticalGoalLineProps) => {
const textAnchor = position === "right" ? "start" : "end";
return (
<g role="graphics-symbol" aria-roledescription="goal line">
- <Text
- y={0}
- textAnchor={textAnchor}
- verticalAnchor="end"
- dy="-0.2em"
- x={x}
- fill={style.label.color}
- fontSize={style.label.size}
- fontWeight={style.label.weight}
- >
- {label}
- </Text>
- <Line
- strokeDasharray={4}
- stroke={style.lineStroke}
- strokeWidth={2}
- y1={0}
- y2={height}
- x1={x}
- x2={x}
+ <GoalLineStroke
+ x={x + GOAL_LINE_WIDTH}
+ height={height}
+ stroke={style.lineShadowStroke}
/>
+ <GoalLineStroke x={x} height={height} stroke={style.lineStroke} />
+ {isStatic ? (
+ <Text
+ y={0}
+ textAnchor={textAnchor}
+ verticalAnchor="end"
+ dy="-0.2em"
+ x={x}
+ fill={style.label.color}
+ fontSize={style.label.size}
+ fontWeight={style.label.weight}
+ >
+ {label}
+ </Text>
+ ) : (
+ <GoalLineMarker
+ x={x}
+ y={0}
+ style={style.marker}
+ onMouseEnter={onMarkerMouseEnter}
+ onMouseLeave={onMarkerMouseLeave}
+ />
+ )}
</g>
);
};
+
+interface GoalLineStrokeProps {
+ x: number;
+ height: number;
+ stroke: string;
+}
+
+const GoalLineStroke = ({ x, height, stroke }: GoalLineStrokeProps) => (
+ <Line
+ x1={x}
+ x2={x}
+ y1={0}
+ y2={height}
+ stroke={stroke}
+ strokeWidth={GOAL_LINE_WIDTH}
+ strokeDasharray={GOAL_LINE_DASH.join(",")}
+ shapeRendering="crispEdges"
+ pointerEvents="none"
+ />
+);
diff --git a/frontend/src/metabase/viz-core/shared/constants/layout.ts b/frontend/src/metabase/viz-core/shared/constants/layout.ts
new file mode 100644
index 00000000000..ca89243ac10
--- /dev/null
+++ b/frontend/src/metabase/viz-core/shared/constants/layout.ts
@@ -0,0 +1,12 @@
+/** Minimum plot dimensions in pixels, excluding card chrome and axis padding. */
+export const PLOT_HEIGHT_BREAKPOINTS = {
+ small: 200,
+ medium: 300,
+ large: 400,
+} as const;
+
+export const CARTESIAN_CHART_BREAKPOINTS = {
+ medium: { width: 300, height: 200 },
+ large: { width: 640, height: 360 },
+ fullscreen: { width: 900, height: 480 },
+} as const;
diff --git a/frontend/src/metabase/viz-core/shared/settings-adjustments.ts b/frontend/src/metabase/viz-core/shared/settings-adjustments.ts
index ca08863489f..966e4103e3e 100644
--- a/frontend/src/metabase/viz-core/shared/settings-adjustments.ts
+++ b/frontend/src/metabase/viz-core/shared/settings-adjustments.ts
@@ -1,41 +1,93 @@
-import type { ComputedVisualizationSettings } from "../types";
+import type {
+ ComputedVisualizationSettings,
+ VisualizationGridSize,
+} from "../types";
-const HIDE_Y_AXIS_LABEL_WIDTH_THRESHOLD = 360;
-const HIDE_X_AXIS_LABEL_HEIGHT_THRESHOLD = 200;
-const HIDE_Y_AXIS_HEIGHT_THRESHOLD = 150;
-const INTERPOLATE_LINE_THRESHOLD = 150;
const HIDE_TIMELINE_EVENTS_HEIGHT_THRESHOLD = 200;
const HIDE_TIMELINE_EVENTS_WIDTH_THRESHOLD = 240;
-type getAdjustedSettingsProps = {
+// Thresholds prioritize grid size when available so that dashboards in the FE
+// and dashboard PDFs in the BE compute the same settings
+
+interface Threshold {
+ gridWidth?: number;
+ gridHeight?: number;
+ pixelWidth?: number;
+ pixelHeight?: number;
+}
+
+const HIDE_Y_AXIS_THRESHOLD: Threshold = {
+ gridHeight: 4,
+ pixelHeight: 150,
+};
+
+const HIDE_AXIS_LABELS_THRESHOLD: Threshold = {
+ gridWidth: 12,
+ gridHeight: 6,
+ pixelWidth: 500,
+ pixelHeight: 250,
+};
+
+const INTERPOLATE_LINE_THRESHOLD: Threshold = {
+ gridWidth: 4,
+ gridHeight: 4,
+ pixelWidth: 150,
+ pixelHeight: 150,
+};
+
+const isBelowThreshold = (
+ threshold: Threshold,
+ width: number,
+ height: number,
+ gridSize?: VisualizationGridSize,
+) => {
+ if (gridSize) {
+ return (
+ (threshold.gridWidth != null && gridSize.width < threshold.gridWidth) ||
+ (threshold.gridHeight != null && gridSize.height < threshold.gridHeight)
+ );
+ }
+ return (
+ (threshold.pixelWidth != null && width < threshold.pixelWidth) ||
+ (threshold.pixelHeight != null && height < threshold.pixelHeight)
+ );
+};
+
+type GetSizeAdjustedSettingsOpts = {
settings: ComputedVisualizationSettings;
width: number;
height: number;
+ gridSize?: VisualizationGridSize;
};
-export const getDashboardAdjustedSettings = ({
+export const getSizeAdjustedSettings = ({
settings,
width,
height,
-}: getAdjustedSettingsProps): ComputedVisualizationSettings => {
+ gridSize,
+}: GetSizeAdjustedSettingsOpts): ComputedVisualizationSettings => {
const adjusted = { ...settings };
- if (
- width <= INTERPOLATE_LINE_THRESHOLD ||
- height <= INTERPOLATE_LINE_THRESHOLD
- ) {
+ if (isBelowThreshold(INTERPOLATE_LINE_THRESHOLD, width, height, gridSize)) {
adjusted["line.interpolate"] = "cardinal";
}
- if (width <= HIDE_Y_AXIS_LABEL_WIDTH_THRESHOLD) {
- adjusted["graph.y_axis.labels_enabled"] = false;
+ const shouldHideAxisLabels = isBelowThreshold(
+ HIDE_AXIS_LABELS_THRESHOLD,
+ width,
+ height,
+ gridSize,
+ );
+
+ if (adjusted["graph.y_axis.labels_enabled"] === "auto") {
+ adjusted["graph.y_axis.labels_enabled"] = !shouldHideAxisLabels;
}
- if (height <= HIDE_X_AXIS_LABEL_HEIGHT_THRESHOLD) {
- adjusted["graph.x_axis.labels_enabled"] = false;
+ if (adjusted["graph.x_axis.labels_enabled"] === "auto") {
+ adjusted["graph.x_axis.labels_enabled"] = !shouldHideAxisLabels;
}
- if (height <= HIDE_Y_AXIS_HEIGHT_THRESHOLD) {
+ if (isBelowThreshold(HIDE_Y_AXIS_THRESHOLD, width, height, gridSize)) {
adjusted["graph.y_axis.axis_enabled"] = false;
}
diff --git a/frontend/src/metabase/viz-core/shared/settings-adjustments.unit.spec.ts b/frontend/src/metabase/viz-core/shared/settings-adjustments.unit.spec.ts
new file mode 100644
index 00000000000..5ff386281a5
--- /dev/null
+++ b/frontend/src/metabase/viz-core/shared/settings-adjustments.unit.spec.ts
@@ -0,0 +1,164 @@
+import { createMockVisualizationSettings } from "metabase-types/api/mocks";
+
+import { getSizeAdjustedSettings } from "./settings-adjustments";
+
+describe("getSizeAdjustedSettings", () => {
+ describe("pixel fallback (no gridSize)", () => {
+ it.each([
+ { width: 499, height: 400, expected: false },
+ { width: 500, height: 400, expected: true },
+ { width: 800, height: 249, expected: false },
+ { width: 800, height: 250, expected: true },
+ ])(
+ "resolves auto axis labels together to $expected at $width x $height",
+ ({ width, height, expected }) => {
+ const settings = getSizeAdjustedSettings({
+ settings: createMockVisualizationSettings({
+ "graph.x_axis.labels_enabled": "auto",
+ "graph.y_axis.labels_enabled": "auto",
+ }),
+ width,
+ height,
+ });
+
+ expect(settings["graph.y_axis.labels_enabled"]).toBe(expected);
+ expect(settings["graph.x_axis.labels_enabled"]).toBe(expected);
+ },
+ );
+
+ it.each([
+ { width: 149, height: 200, expected: "cardinal" },
+ { width: 200, height: 149, expected: "cardinal" },
+ { width: 150, height: 150, expected: undefined },
+ ])(
+ "interpolates the line at $width x $height",
+ ({ width, height, expected }) => {
+ const settings = getSizeAdjustedSettings({
+ settings: createMockVisualizationSettings(),
+ width,
+ height,
+ });
+
+ expect(settings["line.interpolate"]).toBe(expected);
+ },
+ );
+
+ it.each([
+ { height: 149, expected: false },
+ { height: 150, expected: undefined },
+ ])("hides the y-axis at height $height", ({ height, expected }) => {
+ const settings = getSizeAdjustedSettings({
+ settings: createMockVisualizationSettings(),
+ width: 800,
+ height,
+ });
+
+ expect(settings["graph.y_axis.axis_enabled"]).toBe(expected);
+ });
+ });
+
+ describe("gridSize", () => {
+ it.each([
+ { gridSize: { width: 12, height: 6 }, expected: true },
+ { gridSize: { width: 11, height: 6 }, expected: false },
+ { gridSize: { width: 12, height: 5 }, expected: false },
+ { gridSize: { width: 11, height: 5 }, expected: false },
+ ])(
+ "resolves auto axis labels together to $expected at grid $gridSize.width x $gridSize.height",
+ ({ gridSize, expected }) => {
+ const settings = getSizeAdjustedSettings({
+ settings: createMockVisualizationSettings({
+ "graph.x_axis.labels_enabled": "auto",
+ "graph.y_axis.labels_enabled": "auto",
+ }),
+ width: 100,
+ height: 100,
+ gridSize,
+ });
+
+ expect(settings["graph.y_axis.labels_enabled"]).toBe(expected);
+ expect(settings["graph.x_axis.labels_enabled"]).toBe(expected);
+ },
+ );
+
+ it("uses gridSize even when pixel size would produce the opposite result", () => {
+ const settings = getSizeAdjustedSettings({
+ settings: createMockVisualizationSettings({
+ "graph.x_axis.labels_enabled": "auto",
+ "graph.y_axis.labels_enabled": "auto",
+ }),
+ width: 800,
+ height: 400,
+ gridSize: { width: 11, height: 5 },
+ });
+
+ expect(settings["graph.y_axis.labels_enabled"]).toBe(false);
+ expect(settings["graph.x_axis.labels_enabled"]).toBe(false);
+ });
+
+ it.each([
+ { gridSize: { width: 3, height: 4 }, expected: "cardinal" },
+ { gridSize: { width: 4, height: 3 }, expected: "cardinal" },
+ { gridSize: { width: 4, height: 4 }, expected: undefined },
+ ])(
+ "interpolates the line at grid $gridSize.width x $gridSize.height",
+ ({ gridSize, expected }) => {
+ const settings = getSizeAdjustedSettings({
+ settings: createMockVisualizationSettings(),
+ width: 800,
+ height: 400,
+ gridSize,
+ });
+
+ expect(settings["line.interpolate"]).toBe(expected);
+ },
+ );
+
+ it.each([
+ { gridSize: { width: 12, height: 3 }, expected: false },
+ { gridSize: { width: 12, height: 4 }, expected: undefined },
+ ])(
+ "hides the y-axis at grid height $gridSize.height",
+ ({ gridSize, expected }) => {
+ const settings = getSizeAdjustedSettings({
+ settings: createMockVisualizationSettings(),
+ width: 800,
+ height: 400,
+ gridSize,
+ });
+
+ expect(settings["graph.y_axis.axis_enabled"]).toBe(expected);
+ },
+ );
+ });
+
+ it.each([true, false] as const)(
+ "leaves an explicit y-axis title setting of %s unchanged",
+ (labelsEnabled) => {
+ const settings = getSizeAdjustedSettings({
+ settings: createMockVisualizationSettings({
+ "graph.y_axis.labels_enabled": labelsEnabled,
+ }),
+ width: 400,
+ height: 200,
+ });
+
+ expect(settings["graph.y_axis.labels_enabled"]).toBe(labelsEnabled);
+ },
+ );
+
+ it.each([true, false] as const)(
+ "leaves an explicit x-axis title setting of %s unchanged",
+ (labelsEnabled) => {
+ const settings = getSizeAdjustedSettings({
+ settings: createMockVisualizationSettings({
+ "graph.x_axis.labels_enabled": labelsEnabled,
+ }),
+ width: 400,
+ height: 200,
+ });
+
+ expect(settings["graph.x_axis.labels_enabled"]).toBe(labelsEnabled);
+ },
+ );
+});
diff --git a/frontend/src/metabase/viz-core/shared/settings/cartesian-chart.ts b/frontend/src/metabase/viz-core/shared/settings/cartesian-chart.ts
index bb39b686ad1..ab4c89fd0a2 100644
--- a/frontend/src/metabase/viz-core/shared/settings/cartesian-chart.ts
+++ b/frontend/src/metabase/viz-core/shared/settings/cartesian-chart.ts
@@ -245,7 +245,7 @@ export const getDefaultYAxisTitle = (metricNames: (string | undefined)[]) => {
return metricsCount === 1 ? metricNames[0] : null;
};
-export const getIsYAxisLabelEnabledDefault = () => true;
+export const getIsYAxisLabelEnabledDefault = () => "auto" as const;
export const getYAxisAutoRangeDefault = () => true;
@@ -279,7 +279,7 @@ export const getDefaultXAxisTitle = (
return dimensionColumn.display_name;
};
-export const getIsXAxisLabelEnabledDefault = () => true;
+export const getIsXAxisLabelEnabledDefault = () => "auto" as const;
export const getDefaultIsHistogram = (dimensionColumn: DatasetColumn) => {
return dimensionColumn.binning_info != null;
diff --git a/frontend/src/metabase/viz-core/shared/settings/series.ts b/frontend/src/metabase/viz-core/shared/settings/series.ts
index a787f5a5f57..386e85daccb 100644
--- a/frontend/src/metabase/viz-core/shared/settings/series.ts
+++ b/frontend/src/metabase/viz-core/shared/settings/series.ts
@@ -1,5 +1,10 @@
import { getColorsForValues } from "metabase/ui/colors/charts";
-import type { VisualizationSettings } from "metabase-types/api";
+import type {
+ Series,
+ SingleSeries,
+ VisualizationSettings,
+} from "metabase-types/api";
+import { isObjectWithRaw } from "metabase-types/guards";
import { getChartColor } from "../../lib/color-name";
import type { ComputedVisualizationSettings } from "../../types";
@@ -89,6 +94,32 @@ export const getSeriesDefaultShowSeriesTrendline = (
settings: ComputedVisualizationSettings,
) => settings["graph.show_trendline"];
+const getRawSeries = (series: Series): Series =>
+ isObjectWithRaw(series) && series._raw ? series._raw : series;
+
+const hasInsights = (single: SingleSeries | undefined) =>
+ (single?.data.insights?.length ?? 0) > 0;
+
+const hasMultipleDimensions = (settings: ComputedVisualizationSettings) =>
+ (settings["graph.dimensions"] ?? []).length > 1;
+
+export const isTrendLineUnavailable = (
+ series: Series,
+ settings: ComputedVisualizationSettings,
+) => hasMultipleDimensions(settings) || !hasInsights(getRawSeries(series)[0]);
+
+// unlike isTrendLineUnavailable, reads the insights of the series' own card
+export const isSeriesTrendLineUnavailable = (
+ single: SingleSeries,
+ series: Series,
+ settings: ComputedVisualizationSettings,
+) => {
+ const rawSeries = getRawSeries(series);
+ const sourceSeries =
+ rawSeries.find((raw) => raw.card.id === single.card.id) ?? rawSeries[0];
+ return hasMultipleDimensions(settings) || !hasInsights(sourceSeries);
+};
+
export const getSeriesDefaultShowSeriesValues = (
settings: ComputedVisualizationSettings,
) => settings["graph.show_values"];
diff --git a/frontend/src/metabase/viz-core/shared/settings/series.unit.spec.ts b/frontend/src/metabase/viz-core/shared/settings/series.unit.spec.ts
index 8af7ec4ee85..24c29234797 100644
--- a/frontend/src/metabase/viz-core/shared/settings/series.unit.spec.ts
+++ b/frontend/src/metabase/viz-core/shared/settings/series.unit.spec.ts
@@ -1,4 +1,14 @@
-import { getSeriesColors } from "./series";
+import {
+ createMockDatasetData,
+ createMockInsight,
+ createMockSingleSeries,
+} from "metabase-types/api/mocks";
+
+import {
+ getSeriesColors,
+ isSeriesTrendLineUnavailable,
+ isTrendLineUnavailable,
+} from "./series";
describe("getSeriesColors", () => {
const mockSeriesKeys = ["Series A", "Series B", "Series C"];
@@ -162,3 +172,147 @@ describe("getSeriesColors", () => {
expect(result["Display Title"]).toBe("#CUSTOM_COLOR");
});
});
+
+describe("isTrendLineUnavailable", () => {
+ const seriesWithInsights = () => [
+ createMockSingleSeries(
+ {},
+ {
+ data: createMockDatasetData({
+ insights: [createMockInsight({ col: "count" })],
+ }),
+ },
+ ),
+ ];
+
+ it("should be available with insights and a single dimension", () => {
+ expect(
+ isTrendLineUnavailable(seriesWithInsights(), {
+ "graph.dimensions": ["CREATED_AT"],
+ }),
+ ).toBe(false);
+ });
+
+ it("should be unavailable without insights", () => {
+ const series = [
+ createMockSingleSeries(
+ {},
+ { data: createMockDatasetData({ insights: [] }) },
+ ),
+ ];
+
+ expect(
+ isTrendLineUnavailable(series, { "graph.dimensions": ["CREATED_AT"] }),
+ ).toBe(true);
+ });
+
+ it("should be unavailable with multiple dimensions", () => {
+ expect(
+ isTrendLineUnavailable(seriesWithInsights(), {
+ "graph.dimensions": ["CREATED_AT", "CATEGORY"],
+ }),
+ ).toBe(true);
+ });
+
+ it("should read insights from the raw series behind a transformed series", () => {
+ const transformedSeries = Object.assign(
+ [
+ createMockSingleSeries(
+ { name: "Gadget" },
+ { data: createMockDatasetData({ insights: undefined }) },
+ ),
+ createMockSingleSeries(
+ { name: "Gizmo" },
+ { data: createMockDatasetData({ insights: undefined }) },
+ ),
+ ],
+ { _raw: seriesWithInsights() },
+ );
+
+ expect(
+ isTrendLineUnavailable(transformedSeries, {
+ "graph.dimensions": ["CREATED_AT"],
+ }),
+ ).toBe(false);
+ expect(
+ isTrendLineUnavailable(transformedSeries, {
+ "graph.dimensions": ["CREATED_AT", "CATEGORY"],
+ }),
+ ).toBe(true);
+ });
+});
+
+describe("isSeriesTrendLineUnavailable", () => {
+ const insights = [createMockInsight({ col: "count" })];
+ const settings = { "graph.dimensions": ["CREATED_AT"] };
+
+ const combinedCards = () =>
+ Object.assign(
+ [
+ createMockSingleSeries(
+ { id: 1, name: "Orders" },
+ { data: createMockDatasetData({ insights: undefined }) },
+ ),
+ createMockSingleSeries(
+ { id: 2, name: "Revenue" },
+ { data: createMockDatasetData({ insights: undefined }) },
+ ),
+ ],
+ {
+ _raw: [
+ createMockSingleSeries(
+ { id: 1, name: "Orders" },
+ { data: createMockDatasetData({ insights: [] }) },
+ ),
+ createMockSingleSeries(
+ { id: 2, name: "Revenue" },
+ { data: createMockDatasetData({ insights }) },
+ ),
+ ],
+ },
+ );
+
+ it("should look up the insights of the series' own card", () => {
+ const series = combinedCards();
+
+ expect(isSeriesTrendLineUnavailable(series[0], series, settings)).toBe(
+ true,
+ );
+ expect(isSeriesTrendLineUnavailable(series[1], series, settings)).toBe(
+ false,
+ );
+ });
+
+ it("should fall back to the first card when the series has no card id", () => {
+ const series = Object.assign(
+ [
+ createMockSingleSeries(
+ { id: undefined, name: "count" },
+ { data: createMockDatasetData({ insights: undefined }) },
+ ),
+ ],
+ {
+ _raw: [
+ createMockSingleSeries(
+ { id: undefined },
+ { data: createMockDatasetData({ insights }) },
+ ),
+ ],
+ },
+ );
+
+ expect(isSeriesTrendLineUnavailable(series[0], series, settings)).toBe(
+ false,
+ );
+ });
+
+ it("should be unavailable with multiple dimensions regardless of the card", () => {
+ const series = combinedCards();
+
+ expect(
+ isSeriesTrendLineUnavailable(series[1], series, {
+ "graph.dimensions": ["CREATED_AT", "CATEGORY"],
+ }),
+ ).toBe(true);
+ });
+});
diff --git a/frontend/src/metabase/viz-core/shared/types/style.ts b/frontend/src/metabase/viz-core/shared/types/style.ts
index 70e88e7fb59..ae055d32b1c 100644
--- a/frontend/src/metabase/viz-core/shared/types/style.ts
+++ b/frontend/src/metabase/viz-core/shared/types/style.ts
@@ -5,9 +5,18 @@ export type ChartFont = {
color: string;
};
+export type GoalMarkerStyle = {
+ iconColor: string;
+ backgroundColor: string;
+ hoverBackgroundColor: string;
+ shadowColor: string;
+};
+
export type GoalStyle = {
lineStroke: string;
+ lineShadowStroke: string;
label: ChartFont;
+ marker: GoalMarkerStyle;
};
export type AxisStyle = {
diff --git a/frontend/src/metabase/viz-core/shared/utils/theme.ts b/frontend/src/metabase/viz-core/shared/utils/theme.ts
index 0a25e3f5e0b..24cb7513607 100644
--- a/frontend/src/metabase/viz-core/shared/utils/theme.ts
+++ b/frontend/src/metabase/viz-core/shared/utils/theme.ts
@@ -4,9 +4,10 @@ import {
DEFAULT_METABASE_COMPONENT_THEME,
type MantineThemeOther,
} from "metabase/ui";
-import { color } from "metabase/ui/colors";
+import { color, staticVizOverrides } from "metabase/ui/colors";
-import type { VisualizationTheme } from "../../types";
+import type { CartesianChartSize, VisualizationTheme } from "../../types";
+import { CARTESIAN_CHART_BREAKPOINTS } from "../constants/layout";
import { getSizeInPx } from "./size-in-px";
@@ -24,16 +25,59 @@ function getPieBorderColor(
return questionBg;
}
+const CARTESIAN_TICKS: Record<
+ CartesianChartSize,
+ VisualizationTheme["cartesian"]["ticks"]
+> = {
+ small: { fontSize: 12, marginX: 10, marginY: 12 },
+ medium: { fontSize: 12, marginX: 10, marginY: 12 },
+ large: { fontSize: 12, marginX: 10, marginY: 16 },
+ fullscreen: { fontSize: 14, marginX: 14, marginY: 24 },
+};
+
+const CARTESIAN_AXIS_TITLE: Record<
+ CartesianChartSize,
+ VisualizationTheme["cartesian"]["axisTitle"]
+> = {
+ small: { fontSize: 11, fontWeight: 700, marginX: 8, marginY: 16 },
+ medium: { fontSize: 12, fontWeight: 700, marginX: 12, marginY: 16 },
+ large: { fontSize: 12, fontWeight: 700, marginX: 24, marginY: 24 },
+ fullscreen: { fontSize: 14, fontWeight: 700, marginX: 40, marginY: 40 },
+};
+
+export function getCartesianChartSize(size?: {
+ width: number;
+ height: number;
+}): CartesianChartSize {
+ if (size === undefined) {
+ return "fullscreen";
+ }
+
+ const { medium, large, fullscreen } = CARTESIAN_CHART_BREAKPOINTS;
+ if (size.width >= fullscreen.width && size.height >= fullscreen.height) {
+ return "fullscreen";
+ }
+ if (size.width >= large.width && size.height >= large.height) {
+ return "large";
+ }
+ if (size.width >= medium.width && size.height >= medium.height) {
+ return "medium";
+ }
+ return "small";
+}
+
/**
* Computes the visualization style from the Mantine theme.
*/
export function getVisualizationTheme({
theme,
isDashboard,
+ cartesianSize = "fullscreen",
isStaticViz,
}: {
theme: Partial<MantineThemeOther>;
isDashboard?: boolean;
+ cartesianSize?: CartesianChartSize;
isStaticViz?: boolean;
}): VisualizationTheme {
const { cartesian, dashboard, question } = theme;
@@ -49,16 +93,31 @@ export function getVisualizationTheme({
const px = (value: string) =>
getSizeInPx(value, baseFontSize) ?? baseFontSize ?? 14;
+ const ticks = CARTESIAN_TICKS[cartesianSize];
+ const axisTitle = CARTESIAN_AXIS_TITLE[cartesianSize];
+
return {
cartesian: {
label: { fontSize: px(cartesian.label.fontSize) },
+ ticks: {
+ ...ticks,
+ fontSize: theme.hasCustomChartFontSize
+ ? px(cartesian.label.fontSize)
+ : ticks.fontSize,
+ },
+ axisTitle: {
+ ...axisTitle,
+ fontSize: theme.hasCustomChartFontSize
+ ? px(cartesian.label.fontSize)
+ : axisTitle.fontSize,
+ },
goalLine: {
label: { fontSize: px(cartesian.goalLine.label.fontSize) },
},
splitLine: {
lineStyle: {
color: isStaticViz
- ? Color(color("border-neutral")).hex()
+ ? Color(staticVizOverrides["chart-axis"]).hex()
: cartesian.splitLine.lineStyle.color,
},
},
diff --git a/frontend/src/metabase/viz-core/shared/utils/theme.unit.spec.ts b/frontend/src/metabase/viz-core/shared/utils/theme.unit.spec.ts
new file mode 100644
index 00000000000..654b0d07fba
--- /dev/null
+++ b/frontend/src/metabase/viz-core/shared/utils/theme.unit.spec.ts
@@ -0,0 +1,85 @@
+import { DEFAULT_METABASE_COMPONENT_THEME } from "metabase/ui";
+
+import { DEFAULT_VISUALIZATION_THEME, getVisualizationTheme } from "./theme";
+
+describe("Cartesian tick and axis title styling", () => {
+ it.each([
+ {
+ cartesianSize: "small",
+ ticks: { fontSize: 12, marginX: 10, marginY: 12 },
+ axisTitle: { fontSize: 11, fontWeight: 700, marginX: 8, marginY: 16 },
+ },
+ {
+ cartesianSize: "medium",
+ ticks: { fontSize: 12, marginX: 10, marginY: 12 },
+ axisTitle: { fontSize: 12, fontWeight: 700, marginX: 12, marginY: 16 },
+ },
+ {
+ cartesianSize: "large",
+ ticks: { fontSize: 12, marginX: 10, marginY: 16 },
+ axisTitle: { fontSize: 12, fontWeight: 700, marginX: 24, marginY: 24 },
+ },
+ {
+ cartesianSize: "fullscreen",
+ ticks: { fontSize: 14, marginX: 14, marginY: 24 },
+ axisTitle: { fontSize: 14, fontWeight: 700, marginX: 40, marginY: 40 },
+ },
+ ] as const)(
+ "uses the specified values for $cartesianSize charts",
+ ({ cartesianSize, ticks, axisTitle }) => {
+ const theme = getVisualizationTheme({
+ theme: DEFAULT_METABASE_COMPONENT_THEME,
+ cartesianSize,
+ });
+
+ expect(theme.cartesian.ticks).toEqual(ticks);
+ expect(theme.cartesian.axisTitle).toEqual(axisTitle);
+ expect(theme.cartesian.label.fontSize).toBe(13);
+ expect(theme.cartesian.goalLine.label.fontSize).toBe(13);
+ },
+ );
+
+ it.each(["small", "medium", "large", "fullscreen"] as const)(
+ "preserves explicit embedding font overrides on %s charts",
+ (cartesianSize) => {
+ const theme = getVisualizationTheme({
+ theme: {
+ ...DEFAULT_METABASE_COMPONENT_THEME,
+ hasCustomChartFontSize: true,
+ fontSize: "20px",
+ cartesian: {
+ ...DEFAULT_METABASE_COMPONENT_THEME.cartesian,
+ label: { fontSize: "1.2em" },
+ },
+ },
+ cartesianSize,
+ });
+
+ expect(theme.cartesian.ticks.fontSize).toBe(24);
+ expect(theme.cartesian.axisTitle.fontSize).toBe(24);
+ expect(theme.cartesian.ticks.marginY).toBe(
+ getVisualizationTheme({
+ theme: DEFAULT_METABASE_COMPONENT_THEME,
+ cartesianSize,
+ }).cartesian.ticks.marginY,
+ );
+ },
+ );
+
+ it("keeps the unsized fallback as fullscreen", () => {
+ expect(DEFAULT_VISUALIZATION_THEME.cartesian.ticks).toEqual({
+ fontSize: 14,
+ marginX: 14,
+ marginY: 24,
+ });
+ expect(DEFAULT_VISUALIZATION_THEME.cartesian.axisTitle).toEqual({
+ fontSize: 14,
+ fontWeight: 700,
+ marginX: 40,
+ marginY: 40,
+ });
+ expect(
+ DEFAULT_VISUALIZATION_THEME.cartesian.splitLine.lineStyle.color,
+ ).toBe("#DCDFE0");
+ });
+});
diff --git a/frontend/src/metabase/viz-core/types/definition.ts b/frontend/src/metabase/viz-core/types/definition.ts
index 81819293c5f..a0f8e1aed5c 100644
--- a/frontend/src/metabase/viz-core/types/definition.ts
+++ b/frontend/src/metabase/viz-core/types/definition.ts
@@ -265,6 +265,11 @@ export type VisualizationSettingsDefinitions = {
>;
"graph.tooltip_columns"?: SeriesSettingDefinition<Value, Props>;
"graph.tooltip_type"?: SeriesSettingDefinition<Value, Props>;
+ "graph.trendline_color"?: SeriesSettingDefinition<Value, Props>;
+ "graph.trendline_style"?: SeriesSettingDefinition<
+ Value,
+ ChartSettingSegmentedControlProps
+ >;
"graph.x_axis._is_histogram"?: SeriesSettingDefinition<Value, Props>;
"graph.x_axis._is_numeric"?: SeriesSettingDefinition<Value, Props>;
"graph.x_axis._is_timeseries"?: SeriesSettingDefinition<Value, Props>;
@@ -363,6 +368,11 @@ export type VisualizationSettingsDefinitions = {
"treemap.show_parent_values"?: SeriesSettingDefinition<Value, Props>;
"treemap.sub_grouping"?: SeriesSettingDefinition<Value, Props>;
"treemap.value"?: SeriesSettingDefinition<Value, Props>;
+ "trendline.color"?: SingleSeriesSettingDefinition<Value, Props>;
+ "trendline.style"?: SingleSeriesSettingDefinition<
+ Value,
+ ChartSettingSegmentedControlProps
+ >;
view_as?: SeriesSettingDefinition<Value, Props>;
"waterfall.decrease_color"?: SeriesSettingDefinition<Value, Props>;
"waterfall.increase_color"?: SeriesSettingDefinition<Value, Props>;
diff --git a/frontend/src/metabase/viz-core/types/rendering.ts b/frontend/src/metabase/viz-core/types/rendering.ts
index 65a631f0886..7f5c4fc6f7e 100644
--- a/frontend/src/metabase/viz-core/types/rendering.ts
+++ b/frontend/src/metabase/viz-core/types/rendering.ts
@@ -5,6 +5,8 @@ import type {
} from "metabase/utils/measure-text";
import type { ColumnSettings, RawSeries, RowValue } from "metabase-types/api";
+import type { VisualizationGridSize } from "./definition";
+
export interface Padding {
top: number;
left: number;
@@ -19,6 +21,8 @@ export type Formatter = (
export type Extent = [number, number];
+export type CartesianChartSize = "small" | "medium" | "large" | "fullscreen";
+
export interface RenderingContext {
getColor: ColorGetter;
measureText: TextWidthMeasurer;
@@ -26,6 +30,8 @@ export interface RenderingContext {
fontFamily: string;
/** Defaults to "light" when not provided. */
colorScheme?: "light" | "dark";
+ cartesianSize?: CartesianChartSize;
+ isStatic?: boolean;
theme: VisualizationTheme;
}
@@ -39,6 +45,17 @@ export interface VisualizationTheme {
label: {
fontSize: number;
};
+ ticks: {
+ fontSize: number;
+ marginX: number;
+ marginY: number;
+ };
+ axisTitle: {
+ fontSize: number;
+ fontWeight: number;
+ marginX: number;
+ marginY: number;
+ };
goalLine: {
label: {
fontSize: number;
@@ -63,4 +80,5 @@ export interface StaticVisualizationProps {
width?: number;
height?: number;
fitWithinBounds?: boolean;
+ gridSize?: VisualizationGridSize;
}
diff --git a/frontend/src/types/mantine.d.ts b/frontend/src/types/mantine.d.ts
index 077b91073e4..f2f571aad24 100644
--- a/frontend/src/types/mantine.d.ts
+++ b/frontend/src/types/mantine.d.ts
@@ -23,6 +23,7 @@ declare module "@mantine/core" {
**/
export interface MantineThemeOther extends EmbeddingThemeOptions {
colorScheme: "light" | "dark";
+ hasCustomChartFontSize?: boolean;
updateColorSettings: (settings: ColorSettings) => void;
}
diff --git a/src/metabase/channel/render/js/svg.clj b/src/metabase/channel/render/js/svg.clj
index 99a1b1867c5..2bbea5eb67d 100644
--- a/src/metabase/channel/render/js/svg.clj
+++ b/src/metabase/channel/render/js/svg.clj
@@ -113,7 +113,11 @@
An optional `:fit-within?` (default false) tells legended charts to treat `:width`x`:height` as
the exact output box -- fitting the legend *inside* it rather than stacking it on top (which
returns an SVG taller than requested and makes it shrink to fit). Used by the PDF renderer so a
- chart fills its grid cell's full width."
+ chart fills its grid cell's full width.
+
+ An optional `:grid-size` `{:width <cols> :height <rows>}` is the dashcard's dashboard grid size
+ (`size_x`/`size_y`). Used by the PDF renderer so size-dependent settings (e.g. auto axis titles)
+ match the dashboard, independent of the print cell's pixel box."
nil)
#_{:clj-kondo/ignore [:metabase/discourage-dynamic-vars]}
@@ -196,7 +200,9 @@
*chart-size*
(assoc :width (:width *chart-size*)
:height (:height *chart-size*)
- :fitWithinBounds (boolean (:fit-within? *chart-size*))))}) (update :type (fnil keyword "unknown"))))
+ :fitWithinBounds (boolean (:fit-within? *chart-size*))
+ :gridSize (:grid-size *chart-size*)))})
+ (update :type (fnil keyword "unknown"))))
(defn gauge
"Clojure entrypoint to render a gauge chart. Returns a byte array of a png file"
diff --git a/src/metabase/channel/render/pdf.clj b/src/metabase/channel/render/pdf.clj
index 44c1d81fb75..3594251ea32 100644
--- a/src/metabase/channel/render/pdf.clj
+++ b/src/metabase/channel/render/pdf.clj
@@ -647,7 +647,9 @@
(binding [js.svg/*chart-size* {:width w-px
:height h-px
:scale common/chart-supersample
- :fit-within? true}]
+ :fit-within? true
+ :grid-size (when (and (:size_x dashcard) (:size_y dashcard))
+ {:width (:size_x dashcard) :height (:size_y dashcard)})}]
(let [viz (or (:visualization_settings dashcard)
(:visualization_settings card))
{:keys [content type]} (js.svg/*javascript-visualization* (cards-with-data card dashcard data) viz)]
diff --git a/test/metabase/channel/render/body_test.clj b/test/metabase/channel/render/body_test.clj
index 7ded045fdc8..58f2c31405b 100644
--- a/test/metabase/channel/render/body_test.clj
+++ b/test/metabase/channel/render/body_test.clj
@@ -812,7 +812,7 @@
card-b-doc (render.tu/render-card-as-hickory! card-b-id)]
;; The test asserts that all 4 slices exist by seeing that each path element has the colour assigned to that category
;; we should expect to see each of the 4 (and only those 4) colours.
- ;; This is also true of the colours for the legend circle elements.
+ ;; This is also true of the colours for the legend marker elements.
;; When legend and Totals are disabled, we should expect those elements not to exist in the render
(doseq [[doc test-str expectations] [[card-a-doc "Renders with legend and 'total'."
{:legend-els-colours #{"#AAAAAA" "#BBBBBB" "#CCCCCC" "#DDDDDD"}
@@ -822,7 +822,7 @@
{:legend-els-colours #{"#AAAAAA" "#BBBBBB" "#CCCCCC" "#DDDDDD"}
:slice-els-colours #{"#AAAAAA" "#BBBBBB" "#CCCCCC" "#DDDDDD"}
:total-els-text #{}}]]]
- (let [legend-elements (->> (hik.s/select (hik.s/tag :circle) doc)
+ (let [legend-elements (->> (hik.s/select (hik.s/child (hik.s/class "visx-group") (hik.s/tag :rect)) doc)
(map #(get-in % [:attrs :fill]))
set)
slice-elements (->> (hik.s/select (hik.s/tag :path) doc)
@@ -1324,10 +1324,11 @@
:graph.metrics ["sum"]}}]
(mt/with-temp [:model/Card {card-id :id} card]
(let [doc (render.tu/render-card-as-hickory! card-id)
+ weekday-names #{"Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday"}
first-day-text (->> (hik.s/select (hik.s/tag :text) doc)
(map (fn [el] (-> el :content first)))
- (take-last 4)
(map str/trim)
+ (filter weekday-names)
first)]
(testing "Renders with correct day of week first"
(is (= "Monday" first-day-text))))))))))