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

update to modular d3 (and compatible d3pie) #533

Closed
chappjc opened this issue Sep 19, 2019 · 1 comment · Fixed by #540
Closed

update to modular d3 (and compatible d3pie) #533

chappjc opened this issue Sep 19, 2019 · 1 comment · Fixed by #540

Comments

@chappjc
Copy link
Member

chappjc commented Sep 19, 2019

The d3.js being used is very old (v3.4.4 from Mar 25, 2014 from what I can determine). Since then, there have been two major releases.

D3 v4 (4.0.0 on Jun 28, 2016, and 4.13.0 Jan 29, 2018) introduced a module design, that would allow only the required libraries (whatever is needed to make the pie charts) to be used. This is desirable as the d3.min.js file pushing ~450 kB, which is ridiculously large for pie charts.

D3 v5 (5.0.0 on Jan 28, 2018, and 5.12.0 on Sep 7, 2019).

D3 CHANGES.md: https://github.com/d3/d3/blob/master/CHANGES.md

d3pie.js on the other hand has changed very little. We seem to be using 0.1.8 or 0.1.9. The latest, 0.2.1, supports d3 v4. I have tested d3pie v0.2.1 with d3 v4.13.0 in dcrstakepool and it seems to work without issue. I have not tried to identified the minimum set of d3 submodules, instead just using the monolithic version of d3 that (unnecessarily) includes everything.

In short, we should either drop d3/d3pi entirely and find a more efficient way of making pie charts, or we should strive to get D3 up-to-date (on v5) and using the minimum required modules, and d3pie working with D3 v5 if that means patching d3pie itself.

@jholdstock
Copy link
Member

Related - [Design] Stats page: New chart design #347

might make sense to implement these together

jholdstock added a commit to jholdstock/dcrstakepool that referenced this issue Sep 23, 2019
- Chart legend is now drawn by d3 rather than manually in the html template
- Most of the javascript creating the charts is now in a dedicated file (good progress towards decred#532)
- Chart labels are now showing absolute values rather than percentages. This is because percentages are quite easy to estimate by looking at the size of the pie slices, but it is not possible to work out the absolute values.

Closes decred#533
jholdstock added a commit to jholdstock/dcrstakepool that referenced this issue Sep 24, 2019
- Chart legend is now drawn by d3 rather than manually in the html template
- Most of the javascript creating the charts is now in a dedicated file (good progress towards decred#532)
- Chart labels are now showing absolute values rather than percentages. This is because percentages are quite easy to estimate by looking at the size of the pie slices, but it is not possible to work out the absolute values.

Closes decred#533
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

Successfully merging a pull request may close this issue.

2 participants