Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions static-site/components/list-resources/modal_draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,29 +92,25 @@ export default function modal_draw(ref, resource, lightGrey) {
heights.marginBelowAxis;
let radius = 12;
const padding = 1;
let nextRadius = radius;
let iterCount = 0;
let beeswarmData;
let beeswarmHeight = 0;
let spareHeight = availBeeswarmHeight - beeswarmHeight - radius;
const maxIter = 5;
const radiusJump = 2;
while (iterCount++ < maxIter && spareHeight > 50) {
const nextBeeswarmData = dodge(flatData, {
radius: nextRadius * 2 + padding,
beeswarmData = dodge(flatData, {
radius: radius * 2 + padding,
x: (d) => x(d["date"]),
});
const nextBeeswarmHeight = d3.max(nextBeeswarmData.map((d) => d.y));
beeswarmHeight = d3.max(beeswarmData.map((d) => d.y));
const nextSpareHeight =
availBeeswarmHeight - nextBeeswarmHeight - nextRadius;
availBeeswarmHeight - beeswarmHeight - radius;
if (nextSpareHeight <= spareHeight && nextSpareHeight > 0) {
beeswarmData = nextBeeswarmData;
beeswarmHeight = nextBeeswarmHeight;
spareHeight = nextSpareHeight;
radius = nextRadius;
nextRadius += radiusJump;
radius += radiusJump;
} else {
nextRadius -= radiusJump;
radius -= radiusJump;
Comment on lines +102 to +113
Copy link
Member

Choose a reason for hiding this comment

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

This fixes the bug, but the radius seems off:

Image

}
}

Expand Down