jaraco / svg.charts

SVG Charting Library for Python
MIT License
30 stars 10 forks source link

RFC: adding label formatting #21

Closed jdowner closed 7 years ago

jdowner commented 7 years ago

This PR is not ready to be merged but I wanted to get some feedback on how to proceed. I want to add formatting functions for the x and y axis labels. This will allow a user to define a format for the values of the axes, e.g. allowing the values have a fixed number of significant digits.

I have added a pair of class attributes to do this but there is a problem with the spacing between the labels as a result. I have tracked it down to the field_size function. I can resolve the problem by setting dx = 0 but I don't think that is the right thing to do. However, I'm not sure I understand the logic in that function, and that is why I wanted to get some feedback.

jaraco commented 7 years ago

I see the tests pass at your second commit, so it's hard to say what's not working. I suggest capturing some images of the issue, showing how it works prior to your patch and how it fails when you add your patch.

Beyond what the code says, I'm afraid I can't offer much insight. I ported that code from the Ruby and Perl implementations years ago, so the basis of the intent goes back a long time. To add a feature like this, someone is going to have to try to reconstruct the original author's intention. I do welcome you to continue to do so.

jdowner commented 7 years ago

Thanks @jaraco! I will dig more into the test failures and see if I can figure it out.