das-developers / das2java

The original das2 library. Provides interactive publication-ready 2-D plotting
https://das2.org
GNU Lesser General Public License v3.0
4 stars 0 forks source link

Editing the format string on a time axis no longer has any effect #71

Closed DiamondJim87 closed 1 year ago

DiamondJim87 commented 1 year ago

Plot anything with time on the X axis (with time units "t2000"). It used to be that a user could change the format of the axis labels in the Property Editor, for example, %h:%M:%s or %y-%m-%d %h:%M. This no longer seems to have any effect. (I'm pretty sure the %-based format was what used to work).

jbfaden commented 1 year ago

Could you try "%y-%j!c%H:%M:%S", which works for me?

DiamondJim87 commented 1 year ago

Hmm, that does work and if I use upper case for HMS, other variations seem to work. I somehow thought case mattered only for M == minute and m == month.

I think what threw me off was that when I had the format wrong, it just ignored it. That is mostly correct behavior -- I mean, the time should still be displayed, and the whole plot should not fail to render or anything like that. But there's no indication anything is wrong.

I noticed that das issues a warning about a gap in digits if there is whitespace in the formatted string. Could there be a warning also if the format is altogether invalid?

Finally, are the available format codes documented anywhere? It's unclear whether, for example, C-like syntax including precision is supported (e.g., "%5.3S").

jbfaden commented 1 year ago

Yes, it's case sensitive. I'd point you to the docs on this but I'm not sure where that would be. Autoplot has a few GUIs to help with this, and I've been starting to add GUIs to edit fields in Das2 (like the Granny Text Strings). See http://autoplot.org/help#Aggregation for the characters (yYmdHMS,and also subsec and others) and it should pretty well match https://github.com/hapi-server/uri-templates/wiki/Specification

Also there should be a GUI which helps with the number formatting (%5.3f). I think that form should work, and %d and maybe even %x (hex). Basically, if it looks like it's that form, it will use String.format(format,f) to format the decimal number. If it's a time, then it uses TimeParser (which also formats).

DiamondJim87 commented 1 year ago

OK, thanks for the pointers to docs. Clearly there's no bug here, so we can close this out.

jbfaden commented 1 year ago

See also https://github.com/das-developers/das2java/issues/73