Titles not updated

In the attachment is code where are rendered two plots (line and vbar) placed in separate tabs. The plots are regularly updated on RadioButton click but title and subtitle are not updated. On first run of the code titles and subtitles are added to the plots (add_layout(Title(…) but on each change titles are not changed. What I am doing wrong?

Also, I would like to change radioButton and button1 with appropriate images.

Please any suggestions for above mentioned problems.

Thanks in advance,

Goran

Sample.py (7.51 KB)

Hi,
Any suggestions about problems.

Thanks,

Goran

···

On Monday, February 4, 2019 at 6:17:08 PM UTC+1, Goran Goki wrote:

In the attachment is code where are rendered two plots (line and vbar) placed in separate tabs. The plots are regularly updated on RadioButton click but title and subtitle are not updated. On first run of the code titles and subtitles are added to the plots (add_layout(Title(…) but on each change titles are not changed. What I am doing wrong?

Also, I would like to change radioButton and button1 with appropriate images.

Please any suggestions for above mentioned problems.

Thanks in advance,

Goran

Please always provide a MINIMAL but runnable code. Your code is not runnable (due to missing custom imports). Also the Bokeh version is important (run ‘bokeh info’).
The plot’s title should be set the following way:

plot.title.text = ‘New Title’

``

···

On Monday, February 4, 2019 at 6:17:08 PM UTC+1, Goran Goki wrote:

In the attachment is code where are rendered two plots (line and vbar) placed in separate tabs. The plots are regularly updated on RadioButton click but title and subtitle are not updated. On first run of the code titles and subtitles are added to the plots (add_layout(Title(…) but on each change titles are not changed. What I am doing wrong?

Also, I would like to change radioButton and button1 with appropriate images.

Please any suggestions for above mentioned problems.

Thanks in advance,

Goran

Thanks Toni for you suggestion. I thought that is enough to post only main code.

I found what is wrong. I have defined title and subtitle with
p2.add_layout(Title(text=subtitle, text_font_style=“italic”), ‘above’)

p2.add_layout(Title(text=title, text_font_size=“16pt”), ‘above’) for both line plot and vbar plot.

and i had not title property for my figure p2 = figure(x_axis_type=“datetime”, plot_width=800, plot_height=500)

I have changed to

p2 = figure(x_axis_type=“datetime”, title=title, plot_width=800, plot_height=500)

and two lines with add_layout replaced with one line for subtitle.

p2.add_layout(Title(text=subtitle, text_font_style=“italic”), ‘above’)

in update procedure I put

plot_line.title.text = title

plot_line.update

I solved also the second problem to show images as background_image to buttons. I had to go deeper into css to find solution. Maybe is not perfect but it works. For others who have similar problem In my css file I use css selector

div[class$=‘button_G12’] > button[type=‘button’]{

background-image: url("/a/b/c.png");

}

where the condition is find div with class contains button_G12 (css_class defined by me in the bokeh app (button2 = Button(label=“”, button_type=“success”, width=77, css_classes=[‘button_G2’]))

and under this div find button tag with type=button).

I tried to use name or value attribute as criteria but as I have written in my previous post I can’t find this property in my browser’s inspect element (although was defined in Button definition in my code)

Thanks,

Goran.

···

On Saturday, February 9, 2019 at 6:35:08 PM UTC+1, tony halik wrote:

Please always provide a MINIMAL but runnable code. Your code is not runnable (due to missing custom imports). Also the Bokeh version is important (run ‘bokeh info’).
The plot’s title should be set the following way:

plot.title.text = ‘New Title’

``

On Monday, February 4, 2019 at 6:17:08 PM UTC+1, Goran Goki wrote:

In the attachment is code where are rendered two plots (line and vbar) placed in separate tabs. The plots are regularly updated on RadioButton click but title and subtitle are not updated. On first run of the code titles and subtitles are added to the plots (add_layout(Title(…) but on each change titles are not changed. What I am doing wrong?

Also, I would like to change radioButton and button1 with appropriate images.

Please any suggestions for above mentioned problems.

Thanks in advance,

Goran