I am using d3.js to show network traffic information. At a certain point in the visualization, the y axis is used to display the number of bytes.
I am currently using the d3.svg.axis () system. ticks (), which leads to good rounded numbers, for example, 20,000. When converting to kB / MB / etc, however, the result has uncomfortable numbers such as 19.5 and 9.8, is there a way to return ticks to multiple (2 ^ (10 * c)), e.g. 1024, 1048576, etc. Instead of multiple (10 ^ c)?
Other information / thoughts:
- I appreciate that svg.axis handles the nuts and bolts of the drawing for me and would like to find a solution that does not replace this functionality.
- I am open to changing d3 and sending a transfer request if it is jive with @mbostock and company.
- I checked the repositions, focusing on the code in and around d3_scale_linearTickRange () , I see a simple way to achieve my goals without changing the default functionality that I need for the other axis.
- There is one potential problem below , which can be addressed, but it borders on dishonest.
source
share