Reduce reset-zoom button size on timeline charts

pull/25796/head
Petar Petrov 2025-06-16 09:48:44 +03:00
parent a255463a76
commit 805e7bb2fa
2 changed files with 14 additions and 1 deletions

View File

@ -49,6 +49,9 @@ export class HaChartBase extends LitElement {
@property({ attribute: "expand-legend", type: Boolean })
public expandLegend?: boolean;
@property({ attribute: "small-controls", type: Boolean })
public smallControls?: boolean;
// extraComponents is not reactive and should not trigger updates
public extraComponents?: any[];
@ -194,7 +197,7 @@ export class HaChartBase extends LitElement {
<div class="chart"></div>
</div>
${this._renderLegend()}
<div class="chart-controls">
<div class="chart-controls ${classMap({ small: this.smallControls })}">
${this._isZoomed
? html`<ha-icon-button
class="zoom-reset"
@ -784,6 +787,10 @@ export class HaChartBase extends LitElement {
flex-direction: column;
gap: 4px;
}
.chart-controls.small {
top: 0;
flex-direction: row;
}
.chart-controls ha-icon-button,
.chart-controls ::slotted(ha-icon-button) {
background: var(--card-background-color);
@ -792,6 +799,11 @@ export class HaChartBase extends LitElement {
color: var(--primary-color);
border: 1px solid var(--divider-color);
}
.chart-controls.small ha-icon-button,
.chart-controls.small ::slotted(ha-icon-button) {
--mdc-icon-button-size: 22px;
--mdc-icon-size: 16px;
}
.chart-controls ha-icon-button.inactive,
.chart-controls ::slotted(ha-icon-button.inactive) {
color: var(--state-inactive-color);

View File

@ -66,6 +66,7 @@ export class StateHistoryChartTimeline extends LitElement {
.options=${this._chartOptions}
.height=${`${this.data.length * 30 + 30}px`}
.data=${this._chartData as ECOption["series"]}
small-controls
@chart-click=${this._handleChartClick}
></ha-chart-base>
`;