-
Notifications
You must be signed in to change notification settings - Fork 11
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
WIP: explore d3 library #605
base: main
Are you sure you want to change the base?
Conversation
.range([ | ||
height - (numberOfOutcomes - 1) * gap - margin.bottom, | ||
margin.top, | ||
]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<use | ||
href={`${iconsSVGSpriteHref}#arrow-right`} | ||
height={40} | ||
width={40} | ||
x={(width + margin.left - margin.right - 40) / 2} | ||
y={(height + margin.top - margin.bottom - 40) / 2} | ||
/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reuse of an existing svg icon (it's the abstracted SVG code hidden inside Icon
component)
const foo = d3.index( | ||
data, | ||
(d) => d.version, | ||
(d) => d.outcome, | ||
); | ||
|
||
// Determine the series that need to be stacked. | ||
const series = d3 | ||
.stack<[string, d3.InternMap<Outcome, Data['nodes'][number]>], Outcome>() | ||
.offset(d3.stackOffsetExpand) | ||
.keys(orderredOutcomes) | ||
.order(d3.stackOrderNone) | ||
.value(([, D], key) => { | ||
return D.get(key)?.count ?? 0; | ||
})(foo); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the strength of D3 (but also the reason it's difficult to understand).
d3.stack()
is exactly what we need here, but to make use of it, it's better to use the D3 internal data manipulation fonctions, (like d3.index
) and the data structure is not something usual (take some time to reason about).
7a83975
to
2361261
Compare
This is a PoC of D3 to handle the testrun charts display.
In this PR :
http://localhost:3000/d3
page with hardcoded data