From 593b6ae6edf69e472975cecc85ffbd0e3a8e659a Mon Sep 17 00:00:00 2001 From: Eric Radman Date: Wed, 18 Oct 2023 22:35:58 -0400 Subject: [PATCH] Specify counter widgets font size in pt (#6537) - prevent scrollbars from appearing - start with a base font size of 12pt for more even scaling Co-authored-by: Guido Petri <18634426+guidopetri@users.noreply.github.com> --- viz-lib/src/visualizations/counter/Renderer.tsx | 6 +++--- viz-lib/src/visualizations/counter/render.less | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/viz-lib/src/visualizations/counter/Renderer.tsx b/viz-lib/src/visualizations/counter/Renderer.tsx index 45697164e0..47d011ec39 100644 --- a/viz-lib/src/visualizations/counter/Renderer.tsx +++ b/viz-lib/src/visualizations/counter/Renderer.tsx @@ -10,7 +10,7 @@ import "./render.less"; function getCounterStyles(scale: any) { return { - fontSize: `${scale}px`, + fontSize: `${scale}pt`, }; } @@ -20,8 +20,8 @@ function getCounterScale(container: any) { if (container.closest('.visualization-preview') || container.closest('.ant-tabs-tabpane')) { return "60"; } - const fontSize = container.clientHeight / 4.5; - return fontSize > 60 ? "60" : fontSize < 14 ? "14" : fontSize.toFixed(); + const fontSize = 12 + container.clientHeight / 5; + return fontSize > 60 ? "60" : fontSize.toFixed(); } export default function Renderer({ data, options, visualizationName }: any) { diff --git a/viz-lib/src/visualizations/counter/render.less b/viz-lib/src/visualizations/counter/render.less index 253fac6fe8..96ee33f1c9 100755 --- a/viz-lib/src/visualizations/counter/render.less +++ b/viz-lib/src/visualizations/counter/render.less @@ -3,6 +3,7 @@ text-align: center; padding: 15px 10px; position: relative; + overflow: hidden; .counter-visualization-content { margin: 0;