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

Donut charts in Graphviz #44

Closed
GrahamHannington opened this issue Jun 20, 2019 · 5 comments
Closed

Donut charts in Graphviz #44

GrahamHannington opened this issue Jun 20, 2019 · 5 comments
Labels
enhancement New feature or request

Comments

@GrahamHannington
Copy link

Hi @parrt,

Following your suggestion via email (20 July 2019):

donuts do look cool; maybe create an issue in repo so I can look at this when I have time?

here's an extract from my email to you:

I’m sending you this email in case:

  • You’re using Graphviz to create pie charts (I gather you might be using matplotlib for this—for these nodes—not Graphviz) and
  • You’d prefer donuts

Here’s a code pen I created yesterday, “Donut charts in d3-graphviz”, which overlays filled circles on the pies to make them like donuts.

Some background on this technique/hack, in a d3-graphviz GitHub issue: “image node attribute that refers to dynamically generated SVG (data URL)?”.

@parrt
Copy link
Owner

parrt commented Jun 20, 2019

Does d3 imply it only renders in a browser? Can this donut thing work purely in mpl and graphviz?

@parrt parrt added the enhancement New feature or request label Jun 20, 2019
@GrahamHannington
Copy link
Author

GrahamHannington commented Jun 21, 2019 via email

@parrt
Copy link
Owner

parrt commented Jun 21, 2019

Hmm...well,I don't hate the pie charts enough to really worry about this, particularly if it requires that I do some thinking or has anything requiring a browser. ;) if it's okay with you I'm going to close this for now

@parrt parrt closed this as completed Jun 21, 2019
@GrahamHannington
Copy link
Author

No worries, entirely your call. No browser required, but, yes, some thinking 😉.

I chose donuts for two reasons:

  • In some circles 🙄, nothing says "20th century" quite like a pie chart. Donuts, apparently, are the dessert chart du jour.
  • I wanted to overlay a label—a computer transaction ID—on each chart. I preferred the cleaner look of the label on the graph background color rather than on a multicolored pie.

My viz is rendered entirely in Graphviz. I investigated using a different library to render each node in the chart, as you've done, but I hit a roadblock: I couldn't capture mouse events for objects in such nodes. I think that's because Graphviz renders them using the SVG <image> element. This is important to me, because I want interactivity. At some point, I'll revisit that issue, and perhaps integrate the SVG for each node into the main Graphviz-generated SVG—as I've read you've done—rather than referring to it via the <image> element.

Here's an example of what I'm doing:

d3-graphviz-donuts

Essentially, I'm overlaying computer transaction performance data on transaction call structures. Each node (donut) represents a computer transaction. Each edge (arrow) represents a transaction calling another transaction. The size of each node represents the transaction CPU time relative to other transactions: so, the donuts are also "bubbles". I've deliberately omitted the legend because this viz is currently an inhouse project; I don't want to publicize the domain-specific details.

@parrt
Copy link
Owner

parrt commented Jun 24, 2019

very impressive!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants