mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 03:06:41 +00:00
Fixed history graph tooltip so dates are readable (#2872)
This commit is contained in:
parent
c2948638d6
commit
178e4de452
@ -60,6 +60,9 @@ class HaChartBase extends mixinBehaviors(
|
|||||||
width: 200px;
|
width: 200px;
|
||||||
transition: opacity 0.15s ease-in-out;
|
transition: opacity 0.15s ease-in-out;
|
||||||
}
|
}
|
||||||
|
:host([rtl]) .chartTooltip {
|
||||||
|
direction: rtl;
|
||||||
|
}
|
||||||
.chartLegend ul,
|
.chartLegend ul,
|
||||||
.chartTooltip ul {
|
.chartTooltip ul {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
@ -99,6 +102,10 @@ class HaChartBase extends mixinBehaviors(
|
|||||||
margin-right: 4px;
|
margin-right: 4px;
|
||||||
width: 10px;
|
width: 10px;
|
||||||
}
|
}
|
||||||
|
:host([rtl]) .chartTooltip em {
|
||||||
|
margin-right: inherit;
|
||||||
|
margin-left: 4px;
|
||||||
|
}
|
||||||
paper-icon-button {
|
paper-icon-button {
|
||||||
color: var(--secondary-text-color);
|
color: var(--secondary-text-color);
|
||||||
}
|
}
|
||||||
@ -169,6 +176,10 @@ class HaChartBase extends mixinBehaviors(
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
unit: Object,
|
unit: Object,
|
||||||
|
rtl: {
|
||||||
|
type: Boolean,
|
||||||
|
reflectToAttribute: true,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import LocalizeMixin from "../mixins/localize-mixin";
|
|||||||
import "./entity/ha-chart-base";
|
import "./entity/ha-chart-base";
|
||||||
|
|
||||||
import formatDateTime from "../common/datetime/format_date_time";
|
import formatDateTime from "../common/datetime/format_date_time";
|
||||||
|
import { computeRTL } from "../common/util/compute_rtl";
|
||||||
|
|
||||||
class StateHistoryChartTimeline extends LocalizeMixin(PolymerElement) {
|
class StateHistoryChartTimeline extends LocalizeMixin(PolymerElement) {
|
||||||
static get template() {
|
static get template() {
|
||||||
@ -28,6 +29,7 @@ class StateHistoryChartTimeline extends LocalizeMixin(PolymerElement) {
|
|||||||
<ha-chart-base
|
<ha-chart-base
|
||||||
data="[[chartData]]"
|
data="[[chartData]]"
|
||||||
rendered="{{rendered}}"
|
rendered="{{rendered}}"
|
||||||
|
rtl="{{rtl}}"
|
||||||
></ha-chart-base>
|
></ha-chart-base>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
@ -50,6 +52,10 @@ class StateHistoryChartTimeline extends LocalizeMixin(PolymerElement) {
|
|||||||
value: false,
|
value: false,
|
||||||
reflectToAttribute: true,
|
reflectToAttribute: true,
|
||||||
},
|
},
|
||||||
|
rtl: {
|
||||||
|
reflectToAttribute: true,
|
||||||
|
computed: "_computeRTL(hass)",
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,11 +195,7 @@ class StateHistoryChartTimeline extends LocalizeMixin(PolymerElement) {
|
|||||||
afterSetDimensions: (yaxe) => {
|
afterSetDimensions: (yaxe) => {
|
||||||
yaxe.maxWidth = yaxe.chart.width * 0.18;
|
yaxe.maxWidth = yaxe.chart.width * 0.18;
|
||||||
},
|
},
|
||||||
position: this.hass.translationMetadata.translations[
|
position: this._computeRTL ? "right" : "left",
|
||||||
this.hass.language
|
|
||||||
].isRTL
|
|
||||||
? "right"
|
|
||||||
: "left",
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -209,6 +211,10 @@ class StateHistoryChartTimeline extends LocalizeMixin(PolymerElement) {
|
|||||||
};
|
};
|
||||||
this.chartData = chartOptions;
|
this.chartData = chartOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_computeRTL(hass) {
|
||||||
|
return computeRTL(hass);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
customElements.define(
|
customElements.define(
|
||||||
"state-history-chart-timeline",
|
"state-history-chart-timeline",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user