Closed slochower closed 3 years ago
Yes that would be a nice addition!
However, I'll very likely put it outside of the style
parameter for both clarity for users and simplicity on my side...
Something like this with a fmt
parameter that works similarly to style
:
Yep, that sounds like a good plan!
What do you think about also allowing callbacks? You could check in your "what would run internally" code if the format is a string or a callable and apply .format if its a string or otherwise just hand it over to apply. That way, the format could be very flexible.
Now available in v0.0.5 with the transform
parameter:
transform={"Solubility": lambda x: f"{x:.2f}"}
Looks great! 🎉
Hi, thanks again.
It's really handy that you built-in CSS styling of the labels and tooltips, like
color: red
. It would also be great to support Python string formatting (e.g., to trim the string representation of floats). For example:I'm guessing this will be tricky since it looks like you're building up the CSS manually here: https://github.com/cbouy/mols2grid/blob/849cf49a105b941c3c6918bb4b91d9b4d348c4ed/mols2grid/molgrid.py#L316
...but I think it's something to consider for the future.