Skip to content
Merged
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
7 changes: 6 additions & 1 deletion web-common/src/components/time-series-chart/Chart.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script lang="ts">
import RangeDisplay from "@rilldata/web-common/features/dashboards/time-controls/super-pill/components/RangeDisplay.svelte";
import { MainLineColor } from "@rilldata/web-common/features/dashboards/time-series/chart-colors";
import { computeNiceYExtent } from "@rilldata/web-common/features/dashboards/time-series/measure-chart/scales";
import { portal } from "@rilldata/web-common/lib/actions/portal";
import { createMeasureValueFormatter } from "@rilldata/web-common/lib/number-formatting/format-measure-value";
import { TIME_GRAIN } from "@rilldata/web-common/lib/time/config";
Expand Down Expand Up @@ -91,7 +92,11 @@
$: mins = allYExtents.map((extents) => extents[0]).filter(isNumber);
$: maxes = allYExtents.map((extents) => extents[1]).filter(isNumber);

$: yExtents = [Math.min(0, min(mins) ?? 0), max(maxes) ?? 0];
// No padding: keep the line flush with the top of the sparkline
$: yExtents = computeNiceYExtent(min(mins) ?? 0, max(maxes) ?? 0, {
includeZero: true,
paddingFactor: 1,
});
$: yScale = scaleLinear().domain(yExtents).range([100, 0]);

// Bridge gaps in the data, treating missing data as zero
Expand Down
Loading