mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Fix label truncated timeline chart (#24077)
This commit is contained in:
parent
4a94cfc05b
commit
6efe237639
@ -214,7 +214,7 @@ export class StateHistoryChartTimeline extends LitElement {
|
||||
},
|
||||
axisLabel: {
|
||||
show: showNames,
|
||||
width: labelWidth - labelMargin,
|
||||
width: labelWidth,
|
||||
overflow: "truncate",
|
||||
margin: labelMargin,
|
||||
formatter: (id: string) => {
|
||||
|
@ -21,5 +21,8 @@ export function measureTextWidth(
|
||||
}
|
||||
|
||||
context.font = `${fontSize}px ${fontFamily}`;
|
||||
return Math.ceil(context.measureText(text).width);
|
||||
const textMetrics = context.measureText(text);
|
||||
return Math.ceil(
|
||||
textMetrics.actualBoundingBoxRight + textMetrics.actualBoundingBoxLeft
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user