I’m testing out with this [https://observablehq.com/@d3/bar-chart-race](http://bar chart)
How to show image (flag or brand logo) at the end of the bar chart?
Like this:
Any suggestions?
I’m testing out with this [https://observablehq.com/@d3/bar-chart-race](http://bar chart)
How to show image (flag or brand logo) at the end of the bar chart?
Like this:
Any suggestions?
Hi @ferdat,
By coincidence, I happened to implement a version of this yesterday afternoon.
See the images
function, which defines svg:image
elements in terms of the bar positions.
If the flags you want are available as emoji (e.g., ), you could also crib from this example:
How to fix countries names issue?
Please click “enable link sharing” in the notebook menu so readers of this thread can see your notebook.
Oops!
Here’s the notebook:
Ah, that’s based on John Burn-Murdoch’s implementation. I’d probably recommend starting over with the newer D3 implementation, which is cleaner and has an explainer to teach you how it works. Fortunately the data formats are compatible (and the D3 version doesn’t require you to compute the ranks or previous values), so here’s a new fork with your data:
And to see what I changed to add the images, here’s a diff with the original:
Thanks Mike!