Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/span-panel-card.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/span-panel.js

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion src/chart/chart-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ interface SeriesDef {
data: DataPair[];
showSymbol: boolean;
smooth?: boolean;
step?: "start" | "middle" | "end" | false;
lineStyle: { width: number; color: string; type?: string };
areaStyle?: {
color: {
Expand Down Expand Up @@ -73,7 +74,8 @@ export function buildChartOptions(
durationMs: number,
metric: ChartMetricDef | undefined,
isProducer: boolean,
breakerRatingA: number | undefined
breakerRatingA: number | undefined,
useLinearInterpolation = false
): BuildChartResult {
if (!metric) metric = CHART_METRICS[DEFAULT_CHART_METRIC]!;
const accentRgb = isProducer ? "140, 160, 220" : "77, 217, 175";
Expand All @@ -91,6 +93,8 @@ export function buildChartOptions(
data,
showSymbol: false,
smooth: false,
// Continuous signals (PV, SoC) suit linear interpolation; discrete readings use step
...(useLinearInterpolation ? {} : { step: "end" as const }),
lineStyle: { width: 1.5, color: accentColor },
areaStyle: {
color: {
Expand Down
5 changes: 3 additions & 2 deletions src/chart/chart-update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ export function updateChart(
metric: ChartMetricDef | undefined,
isProducer: boolean,
heightPx: number | undefined,
breakerRatingA?: number
breakerRatingA?: number,
useLinearInterpolation?: boolean
): void {
const { options, series } = buildChartOptions(history, durationMs, metric, isProducer, breakerRatingA);
const { options, series } = buildChartOptions(history, durationMs, metric, isProducer, breakerRatingA, useLinearInterpolation);
const minH = heightPx ?? 120;
container.style.minHeight = minH + "px";

Expand Down
6 changes: 4 additions & 2 deletions src/core/dom-updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@ export function updateCircuitDOM(
const history = powerHistory.get(uuid) || [];
const h = slot.classList.contains("circuit-col-span") ? CIRCUIT_COL_SPAN_CHART_HEIGHT : CIRCUIT_CHART_HEIGHT;
const circuitDuration = horizonMap?.has(uuid) ? getHorizonDurationMs(horizonMap.get(uuid)!) : defaultDurationMs;
updateChart(chartContainer, hass, history, circuitDuration, chartMetric, isProducer, h, circuit.breaker_rating_a ?? undefined);
const useLinear = circuit.device_type === DEVICE_TYPE_PV;
updateChart(chartContainer, hass, history, circuitDuration, chartMetric, isProducer, h, circuit.breaker_rating_a ?? undefined, useLinear);
}
}
}
Expand Down Expand Up @@ -264,7 +265,8 @@ export function updateSubDeviceDOM(
else if (chartKey.endsWith("_soe")) metric = BESS_CHART_METRICS["soe"]!;
const isBessCol = !!cc.closest(".bess-chart-col");
const devDuration = subDeviceHorizonMap?.has(devId) ? getHorizonDurationMs(subDeviceHorizonMap.get(devId)!) : defaultDurationMs;
updateChart(cc as HTMLElement, hass, history, devDuration, metric, false, isBessCol ? BESS_CHART_COL_HEIGHT : EVSE_CHART_HEIGHT);
const useLinear = chartKey.endsWith("_soc") || chartKey.endsWith("_soe");
updateChart(cc as HTMLElement, hass, history, devDuration, metric, false, isBessCol ? BESS_CHART_COL_HEIGHT : EVSE_CHART_HEIGHT, undefined, useLinear);
}

for (const entityId of Object.keys(sub.entities || {})) {
Expand Down
Loading