mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +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: {
|
axisLabel: {
|
||||||
show: showNames,
|
show: showNames,
|
||||||
width: labelWidth - labelMargin,
|
width: labelWidth,
|
||||||
overflow: "truncate",
|
overflow: "truncate",
|
||||||
margin: labelMargin,
|
margin: labelMargin,
|
||||||
formatter: (id: string) => {
|
formatter: (id: string) => {
|
||||||
|
@ -21,5 +21,8 @@ export function measureTextWidth(
|
|||||||
}
|
}
|
||||||
|
|
||||||
context.font = `${fontSize}px ${fontFamily}`;
|
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