We've used <selection> tag quite successfully for our timecharts. The regular
<selection>
<set token="slider.start">$start$</set>
<set token="slider.end">$end$</set>
</selection>
addition to a timechart populates the slider.start
and slider.end
tokens quite fine each time a user makes a selection or pans it. They get the starting and ending epoch times, respectively.
However, the same approach fails miserably for non-time charts. If, say, a span of some column is 965 to 970 of independent variable, and that column happens to become the first one in the selection, we'll get "965-970"
inside the $slider.start$
token.
How can we set the token properly - extracting that 965
from it? This panel is going to be exported to HTML at some point, but is there an easier way for now? We still have a lot of development ahead of us.
Well - we finally got some time to look closer into it, and found some way which is not documented for the <selection>
tag but is used elsewhere: <eval>
tag.
The code looks like this:
<selection>
<eval token="histogram.start">mvindex(split('start',"-"),0)</eval>
<eval token="histogram.end">mvindex(split('end',"-"),1)</eval>
</selection>
This code sets the $histogram.start$ token to the lower boundary of the first column inside the selection and $histogram.end$ to the upper one. Also works if there is no selection - defaults to the whole range.
I only wish it were documented better...
Alternatively, a neat little trick to avoid the <eval> thing is to avoid the dashes in the x-axis values in the first place. To do that, just change span=5 to span=5s. I know it seems strange but believe me it works - just do it and you will see!
Well - we finally got some time to look closer into it, and found some way which is not documented for the <selection>
tag but is used elsewhere: <eval>
tag.
The code looks like this:
<selection>
<eval token="histogram.start">mvindex(split('start',"-"),0)</eval>
<eval token="histogram.end">mvindex(split('end',"-"),1)</eval>
</selection>
This code sets the $histogram.start$ token to the lower boundary of the first column inside the selection and $histogram.end$ to the upper one. Also works if there is no selection - defaults to the whole range.
I only wish it were documented better...