Set suggested min max to min and max (#9805)

This commit is contained in:
Bram Kragten 2021-08-16 05:44:42 +02:00 committed by GitHub
parent 4a4465efb6
commit 7a35f46370
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 45 deletions

View File

@ -10,13 +10,7 @@ import {
ChartOptions,
ScatterDataPoint,
} from "chart.js";
import {
addHours,
differenceInDays,
endOfToday,
isToday,
startOfToday,
} from "date-fns";
import { differenceInDays, endOfToday, isToday, startOfToday } from "date-fns";
import { HomeAssistant } from "../../../../types";
import { LovelaceCard } from "../../types";
import { EnergyGasGraphCardConfig } from "../types";
@ -123,14 +117,8 @@ export class HuiEnergyGasGraphCard
scales: {
x: {
type: "time",
suggestedMin: (dayDifference > 2
? addHours(start, -11)
: start
).getTime(),
suggestedMax: (dayDifference > 2
? addHours(end, -11)
: end
).getTime(),
suggestedMin: start.getTime(),
suggestedMax: end.getTime(),
adapters: {
date: {
locale: locale,

View File

@ -10,13 +10,7 @@ import {
ChartOptions,
ScatterDataPoint,
} from "chart.js";
import {
addHours,
differenceInDays,
endOfToday,
isToday,
startOfToday,
} from "date-fns";
import { differenceInDays, endOfToday, isToday, startOfToday } from "date-fns";
import { HomeAssistant } from "../../../../types";
import { LovelaceCard } from "../../types";
import { EnergySolarGraphCardConfig } from "../types";
@ -128,14 +122,8 @@ export class HuiEnergySolarGraphCard
scales: {
x: {
type: "time",
suggestedMin: (dayDifference > 2
? addHours(start, -11)
: start
).getTime(),
suggestedMax: (dayDifference > 2
? addHours(end, -11)
: end
).getTime(),
suggestedMin: start.getTime(),
suggestedMax: end.getTime(),
adapters: {
date: {
locale: locale,

View File

@ -1,11 +1,5 @@
import { ChartData, ChartDataset, ChartOptions } from "chart.js";
import {
startOfToday,
endOfToday,
isToday,
differenceInDays,
addHours,
} from "date-fns";
import { startOfToday, endOfToday, isToday, differenceInDays } from "date-fns";
import { UnsubscribeFunc } from "home-assistant-js-websocket";
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { customElement, property, state } from "lit/decorators";
@ -115,14 +109,8 @@ export class HuiEnergyUsageGraphCard
scales: {
x: {
type: "time",
suggestedMin: (dayDifference > 2
? addHours(start, -11)
: start
).getTime(),
suggestedMax: (dayDifference > 2
? addHours(end, -11)
: end
).getTime(),
suggestedMin: start.getTime(),
suggestedMax: end.getTime(),
adapters: {
date: {
locale: locale,