Skip to content
Snippets Groups Projects
Commit 01cfebdf authored by Leander's avatar Leander
Browse files

fix: nodes are assigned to the wrong group

parent a6a65a6e
Branches
No related tags found
No related merge requests found
......@@ -102,7 +102,7 @@ export default class BubbleChart extends SearchableChart {
const node = vis.chart
.selectAll("g")
.data(vis.packRoot?.descendants())
.data(vis.packRoot?.leaves())
.join(
(enter: any) => enter.append("g"),
(update: any) => update
......@@ -113,6 +113,7 @@ export default class BubbleChart extends SearchableChart {
)
node.selectAll('circle')
.data((d: any) => [d])
.transition()
.duration(1000)
.attr('fill', (d: any) => vis.getFillForNode(d))
......@@ -126,16 +127,13 @@ export default class BubbleChart extends SearchableChart {
const node = vis.chart
.selectAll("g")
.data(vis.packRoot?.descendants())
.data(vis.packRoot?.leaves())
.join("g")
.attr("transform", (d: any) => `translate(${d.x},${d.y})`)
node
.filter((d: any) => !d.children)
.append('circle')
.attr('fill', (d: any) => vis.getFillForNode(d))
.attr('stroke', 'none')
.attr('stroke-width', 2)
.attr('r', (d: any) => d.r)
.attr('data-player', (d: any) => d.data.player)
.on('mouseover', (_: Event, d: any) => {
......@@ -181,7 +179,9 @@ export default class BubbleChart extends SearchableChart {
(
(d3.hierarchy(groupedData) as HierarchyNode<any>)
.sum((d: any) => this.config.sizeAccessor(d))
.sort((d: any) => this.config.sizeAccessor(d))
)
}
private getFillForNode(node: HierarchyNode<any>) {
......
......@@ -38,7 +38,7 @@ dsv(';', 'data/output.csv').then(data => {
if (sliderBlocked) return
zoomSlider.value = event.transform.k.toString()
},
groupAccessor: (d: any) => d['team'],
groupAccessor: (d: any) => d['nation'],
})
bubbleChart.renderVis()
......
......@@ -71,6 +71,7 @@ h1 {
border-radius: 8px;
border: 1px solid #ccc;
box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
user-select: none;
}
#app {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment