mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 03:06:41 +00:00
Workaround for chart size bug in editor preview (#24040)
This commit is contained in:
parent
af35b15400
commit
6eb43a7d61
@ -267,7 +267,8 @@ export class StateHistoryChartLine extends LitElement {
|
|||||||
margin: 5,
|
margin: 5,
|
||||||
formatter: (value: number) => {
|
formatter: (value: number) => {
|
||||||
const label = formatNumber(value, this.hass.locale);
|
const label = formatNumber(value, this.hass.locale);
|
||||||
const width = measureTextWidth(label, 12) + 5;
|
// adding 5px extra because preview is not accurate #24027
|
||||||
|
const width = measureTextWidth(label, 12) + 5 + 5;
|
||||||
if (width > this._yWidth) {
|
if (width > this._yWidth) {
|
||||||
this._yWidth = width;
|
this._yWidth = width;
|
||||||
fireEvent(this, "y-width-changed", {
|
fireEvent(this, "y-width-changed", {
|
||||||
|
@ -287,7 +287,7 @@ export class StatisticsChart extends LitElement {
|
|||||||
},
|
},
|
||||||
grid: {
|
grid: {
|
||||||
...(this.hideLegend ? { top: this.unit ? 30 : 5 } : {}), // undefined is the same as 0
|
...(this.hideLegend ? { top: this.unit ? 30 : 5 } : {}), // undefined is the same as 0
|
||||||
left: 20,
|
left: 5,
|
||||||
right: 1,
|
right: 1,
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
containLabel: true,
|
containLabel: true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user