Skip to content
Open
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
5 changes: 5 additions & 0 deletions .changeset/reactive-prop-derivations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@evidence-dev/core-components': patch
---

Make prop-derived chart values reactive: Area's and Line's default label positions now follow `swapXY`, and Sparkline's series type follows `type`, instead of freezing at their mount-time values.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
middle: 'inside'
};

let defaultLabelPosition = swapXY ? 'right' : 'top';
$: defaultLabelPosition = swapXY ? 'right' : 'top';
$: labelPosition =
(swapXY ? swapXYLabelPositions[labelPosition] : labelPositions[labelPosition]) ??
defaultLabelPosition;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
export let yScale = false; // scale the y axis to the data
$: yScale = yScale === 'true' || yScale === true;

let seriesType = type === 'area' ? 'line' : type;
$: seriesType = type === 'area' ? 'line' : type;

export let connectGroup = undefined; // connects to all other connected sparklines with the same group name (shared tooltip behaviour)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
middle: 'inside'
};

let defaultLabelPosition = swapXY ? 'right' : 'top';
$: defaultLabelPosition = swapXY ? 'right' : 'top';
$: labelPosition =
(swapXY ? swapXYLabelPositions[labelPosition] : labelPositions[labelPosition]) ??
defaultLabelPosition;
Expand Down