Skip to content

Commit

Permalink
Fix coloring bug of the coordinate segments by making it reactive (#230)
Browse files Browse the repository at this point in the history
* fix: fixing a bug of coloring segements by making it reactive

* fix: reenable drawing order option in the storybook

* style: fix style bug for creating coords in the store
  • Loading branch information
onc authored Jun 15, 2022
1 parent 5345b7a commit 10a3e76
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
$: shouldDashStroke =
$drawConfig.variation === Variation.DASHED && (isAxis1Null || isAxis2Null);
// Set the stroke to the appropriate color/gradient.
$: stroke = getStroke($drawConfig.variation, isAxis1Null, isAxis2Null);
$: stroke = getStroke(color, $drawConfig.variation, isAxis1Null, isAxis2Null);
// Horizontal gradient lines are invisible in SVG.
// (https://stackoverflow.com/questions/13223636/svg-gradient-for-perfectly-horizontal-path)
// Therefore, we replace the line with a rect if that is the case.
Expand All @@ -43,6 +43,7 @@
(isAxis1Null || isAxis2Null);
function getStroke(
color: string,
variation: Variation,
axis1Null: boolean,
axis2Null: boolean
Expand Down
2 changes: 1 addition & 1 deletion packages/missing-coordinates/src/stores.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export const coordinates = derived(data, ($data) => {
$data.axes.forEach(
(axis) => (values[axis.name] = axis.data.length > i ? axis.data[i] : null)
);
coords.push({ values: values });
coords.push({ values });
}
return coords;
});
8 changes: 5 additions & 3 deletions packages/storybook/stories/PCDemo.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ export default {
control: { type: "inline-radio" },
},
"drawConfiguration > drawingOrder": {
table: {
disable: true,
options: [0, 1],
control: {
type: "radio",
labels: ["Random", "Ordered"],
},
},
data: {
Expand Down Expand Up @@ -113,7 +115,7 @@ const defaultArgs = {
},
lineOpacity: 0.5,
fontSize: 12,
drawingOrder: DrawingOrder.ORDERED,
drawingOrder: DrawingOrder.RANDOM,
missingValuesConfiguration: {
missingValuesAxisSpacing: 35,
imputationNeighbors: 2,
Expand Down

0 comments on commit 10a3e76

Please sign in to comment.