LabelSet behaviour changed from 2.3.2 to 2.4.1? Text property not accepting integer anymore

Hello all,
I’m not sure if this is worth reporting, but I just spend some time debugging an error in the JS console after upgrading from 2.3.2 to 2.4.1. It can be reproduced by using the LabelSet example from the documentation (Adding annotations — Bokeh 2.4.2 Documentation)

from bokeh.models import ColumnDataSource, Label, LabelSet, Range1d
from bokeh.plotting import figure
from bokeh.plotting import curdoc


source = ColumnDataSource(data=dict(height=[66, 71, 72, 68, 58, 62],
                                    weight=[165, 189, 220, 141, 260, 174],
                                    names=[165, 189, 220, 141, 260, 174]))                                                                         

p = figure(title='Dist. of 10th Grade Students at Lee High',
           x_range=Range1d(140, 275))
p.scatter(x='weight', y='height', size=8, source=source)
p.xaxis[0].axis_label = 'Weight (lbs)'
p.yaxis[0].axis_label = 'Height (in)' 

labels = LabelSet(x='weight', y='height', text='names',
              x_offset=5, y_offset=5, source=source, render_mode='canvas')
              
citation = Label(x=70, y=70, x_units='screen', y_units='screen',
                 text='Collected by Luke C. 2016-04-01', render_mode='css',
                 border_line_color='black', border_line_alpha=1.0,
                 background_fill_color='white', background_fill_alpha=1.0)
                 
p.add_layout(labels)
p.add_layout(citation)

doc = curdoc()
doc.add_root(p)

Passing integers to the text property (I just replaced the names with integers) ‘just works’ on 2.3.3 but on 2.4.1 it gives the following error:

Error rendering Bokeh items: TypeError: this.text.split is not a function
    at x.paint (bokeh.min.js?v=d84834ccd5c99419880814bf28eebb39a98dc69967e6c85a9b210aed48948ef2ddb58c82a008737808145988c9c629536623eb19867396a59f887d7ef0306656:285)
    at v._v_canvas_text (bokeh.min.js?v=d84834ccd5c99419880814bf28eebb39a98dc69967e6c85a9b210aed48948ef2ddb58c82a008737808145988c9c629536623eb19867396a59f887d7ef0306656:386)
    at v.paint (bokeh.min.js?v=d84834ccd5c99419880814bf28eebb39a98dc69967e6c85a9b210aed48948ef2ddb58c82a008737808145988c9c629536623eb19867396a59f887d7ef0306656:386)
    at v._render (bokeh.min.js?v=d84834ccd5c99419880814bf28eebb39a98dc69967e6c85a9b210aed48948ef2ddb58c82a008737808145988c9c629536623eb19867396a59f887d7ef0306656:234)
    at v.render (bokeh.min.js?v=d84834ccd5c99419880814bf28eebb39a98dc69967e6c85a9b210aed48948ef2ddb58c82a008737808145988c9c629536623eb19867396a59f887d7ef0306656:206)
    at O._paint_levels (bokeh.min.js?v=d84834ccd5c99419880814bf28eebb39a98dc69967e6c85a9b210aed48948ef2ddb58c82a008737808145988c9c629536623eb19867396a59f887d7ef0306656:519)
    at O._actual_paint (bokeh.min.js?v=d84834ccd5c99419880814bf28eebb39a98dc69967e6c85a9b210aed48948ef2ddb58c82a008737808145988c9c629536623eb19867396a59f887d7ef0306656:519)
    at O.paint (bokeh.min.js?v=d84834ccd5c99419880814bf28eebb39a98dc69967e6c85a9b210aed48948ef2ddb58c82a008737808145988c9c629536623eb19867396a59f887d7ef0306656:519)
    at O.after_layout (bokeh.min.js?v=d84834ccd5c99419880814bf28eebb39a98dc69967e6c85a9b210aed48948ef2ddb58c82a008737808145988c9c629536623eb19867396a59f887d7ef0306656:519)
    at O.compute_layout (bokeh.min.js?v=d84834ccd5c99419880814bf28eebb39a98dc69967e6c85a9b210aed48948ef2ddb58c82a008737808145988c9c629536623eb19867396a59f887d7ef0306656:496)

I debugged this in my code by loading the non-minified JS and that showed ‘LabelSet’ in the error output there so that’s where I started looking (commenting out my LabelSets one after another).

Anyway, I can see that passing str to the text property of LabelSet makes sense, but so far integers where silently accepted as well.

Thanks!
Johannes

1 Like

If integers ever worked to any degree in the past, it was accidental and unintentional.

2 Likes

Definitely worth reporting - saved me lots of grief - thanks.

3 Likes

Yep thanks for bringing this up, good to know

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.