The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Fix math to calculate scatter bubble diameter (#63104)
eliotmetabase7b4ed715aec0
diff --git a/.loki/reference/chrome_laptop_Components_Inputs_DateTimePicker_Default.png b/.loki/reference/chrome_laptop_Components_Inputs_DateTimePicker_Default.pngdeleted file mode 100644index c94308360ed..00000000000Binary files a/.loki/reference/chrome_laptop_Components_Inputs_DateTimePicker_Default.png and /dev/null differdiff --git a/.loki/reference/chrome_laptop_Components_Inputs_DateTimePicker_Value_Format.png b/.loki/reference/chrome_laptop_Components_Inputs_DateTimePicker_Value_Format.pngdeleted file mode 100644index 1d72848a709..00000000000Binary files a/.loki/reference/chrome_laptop_Components_Inputs_DateTimePicker_Value_Format.png and /dev/null differdiff --git a/.loki/reference/chrome_laptop_Components_Inputs_DateTimePicker_With_Seconds.png b/.loki/reference/chrome_laptop_Components_Inputs_DateTimePicker_With_Seconds.pngdeleted file mode 100644index a70e5a41c48..00000000000Binary files a/.loki/reference/chrome_laptop_Components_Inputs_DateTimePicker_With_Seconds.png and /dev/null differdiff --git a/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Bubble_Size.png b/.loki/reference/chrome_laptop_Viz_Static_Viz_ScatterPlot_Bubble_Size.pngindex 45051027978..417047fbe03 100644Binary 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 differdiff --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.pngindex d9ac0720b29..3c78671dfad 100644Binary 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 differdiff --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.pngindex b5085fc2ae8..ff3403c6296 100644Binary 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 differdiff --git a/frontend/src/metabase/visualizations/echarts/cartesian/scatter/option/series.ts b/frontend/src/metabase/visualizations/echarts/cartesian/scatter/option/series.tsindex 174b76139c6..e3462310572 100644--- a/frontend/src/metabase/visualizations/echarts/cartesian/scatter/option/series.ts+++ b/frontend/src/metabase/visualizations/echarts/cartesian/scatter/option/series.ts@@ -38,8 +38,8 @@ function getBubbleDiameterScale(// D3 will take a value from the domain (bubble size column) and normalize it (`t` is between 0,1).// Then we plug the normalized value `t` into the `areaScale` to get the corrseponding area for that diameter.// We then take this area and convert it back to a diameter value- // if area = π × (diameter ÷ 2)², then diameter = (2 × √area) ÷ π- .interpolate(() => (t) => (2 * Math.sqrt(areaScale(t))) / Math.PI)+ // if area = π × (diameter ÷ 2)², then diameter = 2 × √(area ÷ π)+ .interpolate(() => (t) => 2 * Math.sqrt(areaScale(t) / Math.PI))// Finally, D3 linearly maps that value into our defined min/max range..range([MIN_BUBBLE_DIAMETER, MAX_BUBBLE_DIAMETER]);