Skip to content

Commit

Permalink
feat: add dash variant (#174)
Browse files Browse the repository at this point in the history
The dashed variant now works with missing data.

fix #167
  • Loading branch information
Alex Bäuerle authored Jun 2, 2022
1 parent 389fd9f commit b20dd4a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
// Check whether the opacity of the line segment should be reduced.
$: shouldReduceOpacity =
$drawConfig.variation === Variation.OPACITY && (isAxis1Null || isAxis2Null);
// Check whether the line segment should be dashed.
$: shouldDashStroke =
$drawConfig.variation === Variation.DASHED && (isAxis1Null || isAxis2Null);
// Set the stroke to the appropriate color/gradient.
$: stroke = getStroke($drawConfig.variation, isAxis1Null, isAxis2Null);
Expand Down Expand Up @@ -129,6 +132,9 @@
opacity={shouldReduceOpacity
? $drawConfig.missingValuesConfiguration.missingValueOpacity
: 1}
stroke-dasharray={shouldDashStroke
? $drawConfig.missingValuesConfiguration.strokeDasharray
: ""}
/>
{#if shouldDrawGlyph}
<circle
Expand Down
1 change: 1 addition & 0 deletions packages/missing-coordinates/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class MissingValuesConfiguraion {
imputationNeighbors = 2;
glyphRadius = 4;
missingValueOpacity = 0.1;
strokeDasharray = "5 5";
}

export enum TopBottomPosition {
Expand Down
1 change: 1 addition & 0 deletions packages/storybook/stories/PCDemo.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const defaultArgs = {
imputationNeighbors: 2,
glyphRadius: 4,
missingValueOpacity: 0.1,
strokeDasharray: "5 5",
},
},
};
Expand Down

0 comments on commit b20dd4a

Please # to comment.