I am building a graph with d3, sometimes the graph has smaller numbers on the axis and sometimes the graph has larger numbers on the axis. This causes the following problem from time to time;
Notice how at the left and right hand side the svg element is done and such the entire legend doesnt get displayed. I would prefer not to play around with increasing the margins on either side because that would decrease the screen real estate.
Is there a way such that the axis are responsive with regards to the data input? Ie; when the numbers are in the thousands then a 'k' or an 'm' is added to the number ( 100000 -> 100K, 12000000 -> 12M ).