Skip to content

Commit

Permalink
Specify counter widgets font size in pt (#6537)
Browse files Browse the repository at this point in the history
- prevent scrollbars from appearing
- start with a base font size of 12pt for more even scaling

Co-authored-by: Guido Petri <[email protected]>
  • Loading branch information
eradman and guidopetri authored Oct 19, 2023
1 parent 8bb1767 commit 593b6ae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions viz-lib/src/visualizations/counter/Renderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import "./render.less";

function getCounterStyles(scale: any) {
return {
fontSize: `${scale}px`,
fontSize: `${scale}pt`,
};
}

Expand All @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions viz-lib/src/visualizations/counter/render.less
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
text-align: center;
padding: 15px 10px;
position: relative;
overflow: hidden;

.counter-visualization-content {
margin: 0;
Expand Down

0 comments on commit 593b6ae

Please sign in to comment.