Menu

#417 more control over %{CONTEXT}

Someday
open
nobody
None
5
2023-12-08
2015-03-05
No

I wish I had more control over the way context is displayed. For example, if the page title is "2000-01-09" then it is sufficient to report "00:17:42" to indicate the datum 2000-01-09T00:17:42

You can have a title like %{CONTEXT}, but maybe it would work to have %{CONTEXT,externalContext=2001-01-09} so the user can assert that to report just the less significant digits of hour, minute and second.

Discussion

  • Jeremy Faden

    Jeremy Faden - 2023-12-05

    Connor was wanting to change the label generated from the context from pitch_angle=85 to α=85. I should revisit this. To make it print the value without the "pitch_angle=" would be fairly easy.

     

    Last edit: Jeremy Faden 2023-12-07
  • Jeremy Faden

    Jeremy Faden - 2023-12-06

    %{CONTEXT;format=$H:$M} would work for the above (externalContext) case. What might be tricky would be parsing %{CONTEXT;format=%.2f}, since there are multiple percents...

     
  • Jeremy Faden

    Jeremy Faden - 2023-12-06

    This seems to work fine. I was already using a regular expression to pull out the arguments, so this has effectively been in place for a while. The first argument supported is format, so

    %{CONTEXT,format=$H:$M}
    and
    %{CONTEXT,format=%d}
    and
    %{CONTEXT,format=%.3f}
    have been shown to work, and will be available in the next development release. This only works when there is one context, and it is a datum (rank 0 dataset) or datum range (rank 1, two-element dataset).

     

    Last edit: Jeremy Faden 2023-12-06
  • Jeremy Faden

    Jeremy Faden - 2023-12-06

    I have a nagging feeling I was doing something like this recently, where formats were supported, and I have to check for %d and %x (hex) and truncate this to an int before passing it to string.format. I need to remind myself where this was (resolution of times, I think) and make sure this is consistent.

     
  • Jeremy Faden

    Jeremy Faden - 2023-12-06

    This same argument should be made to work for other macros, like %{USER_PROPERTIES} and %{TIMERANGE}.

     
  • Jeremy Faden

    Jeremy Faden - 2023-12-06

    I added the parameter "name" so that when there are a bunch of context variables, one can be selected.
    %{CONTEXT,name=phi,format=%.3f}

     

    Last edit: Jeremy Faden 2023-12-06
  • Jeremy Faden

    Jeremy Faden - 2023-12-07

    There should also be a tab added to the GrannyTextRenderer where Autoplot can offer its macros.

     
  • Jeremy Faden

    Jeremy Faden - 2023-12-08

    When this is used for annotations, data set updates aren't detected, as the title properly does.
    1. load https://github.com/autoplot/dev/blob/master/demos/vaps/slices-context.vap,
    2. add annotation
    3. copy the title to the annotation
    4. see that adjusting the slice updates the title but not the annotation.