tooltip templating with variable-length ColumnDataSource fields

I have data that looks something like this:

scholar_id history xvals yvals

0 2217 [(2012-2013, 3), (2013-2014, 3)] 0 0

1 2243 [(2013-2014, 3)] 1 1

2 2250 [(2012-2013, 3), (2013-2014, 3)] 2 2

3 2340 [(2012-2013, 2), (2013-2014, 2)] 3 3

4 2351 [(2012-2013, 3), (2013-2014, 2)] 4 4

5 2372 [(2012-2013, 2), (2013-2014, 2)] 5 5

6 2381 [(2012-2013, 3), (2013-2014, 4)] 6 6

7 2398 [(2011-2012, 2), (2012-2013, 2)] 7 7

8 2418 [(2013-2014, 2)] 8 8

9 2423 [(2012-2013, 4), (2013-2014, 4)] 9 9

I’d like create a scatterplot using xvals and yvals, with tooltips displaying scholar_id and history (each student’s state test score history), something like this:

Student ID: 2250

  • 2012-2013: 3
  • 2013-2014: 3

If I were doing this in a jinja2 template, I would just create a for-loop, but I haven’t seen any illustration of that kind of functionality for Bokeh’s tooltip templates. Is more advanced templating possible in Bokeh’s tooltips? If not, is there any way to approximate this use case with Bokeh’s current functionality?

Thanks in advance for any help you can offer!

I believe this is beyond the current capability of Bokeh hover tooltips, but it is certainly a reasonable and useful feature. Can you make a feature request issue on GH describing this use-case?

Thanks,

Bryan

···

On Apr 15, 2015, at 3:57 PM, Schaun Wheeler <[email protected]> wrote:

I have data that looks something like this:

   scholar_id history xvals yvals
0 2217 [(2012-2013, 3), (2013-2014, 3)] 0 0
1 2243 [(2013-2014, 3)] 1 1
2 2250 [(2012-2013, 3), (2013-2014, 3)] 2 2
3 2340 [(2012-2013, 2), (2013-2014, 2)] 3 3
4 2351 [(2012-2013, 3), (2013-2014, 2)] 4 4
5 2372 [(2012-2013, 2), (2013-2014, 2)] 5 5
6 2381 [(2012-2013, 3), (2013-2014, 4)] 6 6
7 2398 [(2011-2012, 2), (2012-2013, 2)] 7 7
8 2418 [(2013-2014, 2)] 8 8
9 2423 [(2012-2013, 4), (2013-2014, 4)] 9 9

I'd like create a scatterplot using xvals and yvals, with tooltips displaying scholar_id and history (each student's state test score history), something like this:

Student ID: 2250
  • 2012-2013: 3
  • 2013-2014: 3
If I were doing this in a jinja2 template, I would just create a for-loop, but I haven't seen any illustration of that kind of functionality for Bokeh's tooltip templates. Is more advanced templating possible in Bokeh's tooltips? If not, is there any way to approximate this use case with Bokeh's current functionality?

Thanks in advance for any help you can offer!

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/2592a5c8-abea-40b7-8d23-c33a718fd80f%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.