Skip to content

Commit

Permalink
Merge pull request #393 from visdesignlab/plotinfo-default-fix
Browse files Browse the repository at this point in the history
Update default values for the plot information text
  • Loading branch information
NateLanza authored Sep 4, 2024
2 parents 82e85b9 + 32d9256 commit 11fb38b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/upset/src/components/custom/PlotInformation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ export const PlotInformation = ({
sets: 'name for the sets in this data, eg: "movie genres"',
items: 'name for the items in this data, eg: "movies"',
};
const defaultPlotInformation = {
description: '[dataset description]',
sets: '[set names]',
items: '[item names]',
};

/**
* State
Expand All @@ -94,7 +99,7 @@ export const PlotInformation = ({
const generatePlotInformationText: () => string = useCallback(() => {
// return default string if there are no values filled in
if (Object.values(plotInformation).filter((a) => a && a.length > 0).length === 0) {
return `This UpSet plot shows ${placeholderText.description}. The sets are ${placeholderText.sets}. The items are ${placeholderText.items}`;
return `This UpSet plot shows ${defaultPlotInformation.description}. The sets are ${defaultPlotInformation.sets}. The items are ${defaultPlotInformation.items}`;
}

let str: string = '';
Expand All @@ -109,7 +114,7 @@ export const PlotInformation = ({
}

return str;
}, [plotInformation, placeholderText]);
}, [plotInformation, defaultPlotInformation]);

/**
* Commits changes to the plot information if the new state is different from the old state.
Expand Down

0 comments on commit 11fb38b

Please sign in to comment.