Limit height of charts to 400px (#9487)

This commit is contained in:
Bram Kragten 2021-07-01 07:54:17 +02:00 committed by GitHub
parent 4466950bb8
commit 36c20e4348
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 3 deletions

View File

@ -20,7 +20,7 @@ interface Tooltip extends TooltipModel<any> {
export default class HaChartBase extends LitElement { export default class HaChartBase extends LitElement {
public chart?: Chart; public chart?: Chart;
@property() @property({ attribute: "chart-type", reflect: true })
public chartType: ChartType = "line"; public chartType: ChartType = "line";
@property({ attribute: false }) @property({ attribute: false })
@ -228,6 +228,9 @@ export default class HaChartBase extends LitElement {
height: 0; height: 0;
transition: height 300ms cubic-bezier(0.4, 0, 0.2, 1); transition: height 300ms cubic-bezier(0.4, 0, 0.2, 1);
} }
:host(:not([chart-type="timeline"])) canvas {
max-height: 400px;
}
.chartLegend { .chartLegend {
text-align: center; text-align: center;
} }

View File

@ -30,7 +30,7 @@ class StateHistoryChartLine extends LitElement {
<ha-chart-base <ha-chart-base
.data=${this._chartData} .data=${this._chartData}
.options=${this._chartOptions} .options=${this._chartOptions}
chartType="line" chart-type="line"
></ha-chart-base> ></ha-chart-base>
`; `;
} }

View File

@ -98,7 +98,7 @@ export class StateHistoryChartTimeline extends LitElement {
<ha-chart-base <ha-chart-base
.data=${this._chartData} .data=${this._chartData}
.options=${this._chartOptions} .options=${this._chartOptions}
chartType="timeline" chart-type="timeline"
></ha-chart-base> ></ha-chart-base>
`; `;
} }