Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unique values hierarchy #832

Merged
merged 3 commits into from
Nov 10, 2022
Merged

Fix unique values hierarchy #832

merged 3 commits into from
Nov 10, 2022

Conversation

ptbrowne
Copy link
Collaborator

@ptbrowne ptbrowne commented Nov 9, 2022

  • fix: Do not uniqueBy hierarchy values
  • feat: Add debug method for graphviz

Fix #822 (comment)

Some hierarchies have values that are present at multiple branches
of a hierarchy
@vercel
Copy link

vercel bot commented Nov 9, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
visualization-tool ✅ Ready (Inspect) Visit Preview Nov 9, 2022 at 2:10PM (UTC)

Copy link
Collaborator

@bprusinowski bprusinowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When mapping Tariff or Basket ID as color field, selecting the Zolltarifs and List of Zolltarifs values doesn't do anything (no data is filtered + no color appears in the option row). I guess it's related to a value being shared across multiple parents, but is this an expected behavior?

Comment on lines 64 to 89
/**
* Can be used for debugging, pass a hierarchy, and copy the output
* to graphviz.
*
* @see https://dreampuf.github.io/GraphvizOnline/
*/
export const hierarchyToGraphviz = (
hierarchy: DimensionHierarchyQueryHierarchy
) => {
const lines = [] as string[];
dfs(hierarchy, (node, { depth, parents }) => {
lines.push(`"${node.value}"[label="${node.label.replace(/"/g, "")}"]`);
if (parents.length > 0) {
const parent = parents[parents.length - 1];
lines.push(`"${parent.value}" -> "${node.value}"`);
}
});
return `
digraph G {
rankdir=LR

${lines.join("\n")}
}
`;
};

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

Copy link

@FabianCretton FabianCretton Nov 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can give an input here, and this might be an "special" situation in my data: most of the nodes are related to values in the Data, except the "list of Zolltarif" node itself -> this is kind of a "fake" node, just to regroup and display the list of Zolltarifs that are included in a basket (whithout having to look at all tarifs in the children, and also given that a tarif could be directly at that level and not coming from a child).
As discussed with Patrick, there could be a better way to show this, we can talk about it. This was just a "possible" way that I used for that POC.
Thus, for me it makes sense if the node "list of Zolltarfis" can not be selected. It is a nice handling of the situation by Visualize.

And it is the same for the node "Zolltarifs" itself: there is no value in the data for it, but its children do have a value.

Copy link
Collaborator

@bprusinowski bprusinowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

@ptbrowne ptbrowne merged commit 7d86022 into main Nov 10, 2022
@ptbrowne ptbrowne deleted the fix/unique-values-hierarchies branch November 10, 2022 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hierarchies list question/bug - edition mode - left filter
3 participants