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

optimized version #151

Open
ktsaou opened this issue Feb 4, 2018 · 0 comments
Open

optimized version #151

ktsaou opened this issue Feb 4, 2018 · 0 comments

Comments

@ktsaou
Copy link

ktsaou commented Feb 4, 2018

Hi,

thank you for d3pie!

I needed a pie library to include at https://my-netdata.io and d3pie was ideal for that purpose.
But it was slow.

So, I modified it a bit:

optimized-d3pie

The code had these performance killers:

  1. transitions that unfortunately could not be disabled - so I removed them. Actually d3 transitions are async, while I needed the whole rendering to be synced under conditions, and there was no easy way to fix it (a transition duration of zero, does not disable async).

  2. extensive use of d3.select() and d3.selectAll(). These kill performance when the page is huge (like netdata dashboards). I cached all that was easy to cache, and I replaced the rest with pie.svg.select() and pie.svg.selectAll() respectively to constrain the dom searches within the chart. However, even these are problematic. Ideally, a chart library should not perform any dom searches.

I also fixed a bug that was not closing an open segment when a new was clicked (you need to pass pie to that function).

Finally, I added:

  1. The ability to set font weight for all labels
  2. The ability to set font color to segment, so that the labels could get the the color of the segment, like this:

screenshot from 2018-02-04 04-52-19

The modified version can be found here: https://github.com/firehol/netdata/tree/master/web/lib (we increase the version of the filename on every change, so search for d3pie-0.2.1-netdata-XXX.js to get the latest.

It is not yet the fastest that can be, but it is now quite usable for me.

Again... thank you for d3pie.
Nice work!

btw, since netdata re-destributes the modified version of d3pie, I have mentioned you to its redistributed software notice: https://github.com/firehol/netdata/blob/master/LICENSE-REDISTRIBUTED.md

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

No branches or pull requests

1 participant