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

editor for DasAxis.format is needed #73

Closed jbfaden closed 11 months ago

jbfaden commented 1 year ago

An editor for URI_Templates is needed, or maybe a specialized editor for tick formatting. For example, DasAxis.format provides no guidance about what fields are allowed, in strings like $Y-$m-$d or for continuous data like %.2f.

jbfaden commented 1 year ago

See also https://github.com/das-developers/das2java/issues/4, another one of these editors. All of these should link back to a common ticket.

jbfaden commented 1 year ago

I've made a dummy editor (one that is better than nothing), but there's a problem. The editors are registered by property name, and "format" is the property. This needs to be made more precise, probably linking the bean type as well as the property name.

UriTemplatesStringSchemeEditor is the new editor. Actually another editor needs to be added which supports both "%.3f" and "$Y-$m-$d $H:$M"

jbfaden commented 1 year ago

Check that, there's a second method which uses the object type:

PropertyEditor.addStringEditor("org.das2.graph.DasAxis","format", new UriTemplatesStringSchemeEditor() );

jbfaden commented 1 year ago

There's a context which should be set when the editor is entered, but isn't. I suspect that there's an issue with implementing this, but I'll need to remind myself what it is. I was hoping I could use the DasAxis context to get the units.

jbfaden commented 1 year ago

I set the context now to the axis. This still needs some work, in particular when multiple beans with the same property are edited.

jbfaden commented 11 months ago

%d and %05d don't work for formatting decimals. I think the code needs to check to see if an integer is needed.

jbfaden commented 11 months ago

I've corrected the tick formatter to support %d, %x, and %X.