Last active
November 2, 2019 19:10
-
-
Save mjarosie/69336ede5f9d786f638b30c7ba6247ef to your computer and use it in GitHub Desktop.
Fix making https://github.com/bokeh/bokeh/pull/9153 build successfully
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Example demonstrating hovering with line widths specified in the data source - with bokeh server""" | |
from bokeh.io import curdoc | |
from bokeh.plotting import figure | |
data = dict( | |
x=[0, 0, 25], | |
y=[5, 20, 5], | |
dw=[20, 20, 10], | |
dh=[10, 10, 25], | |
colors=['blue', 'blue', 'blue'], | |
alphas=[0.2, 0.4, 0.6], | |
hover_line_widths=[5, 10, 15], | |
) | |
p = figure(x_range=(0, 35), y_range=(0, 35), tools='hover') | |
p.rect(source=data, | |
x='x', y='y', | |
width='dw', height='dh', | |
color='colors', | |
alpha='alphas', | |
hover_line_width='hover_line_widths' | |
) | |
curdoc().add_root(p) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/bokehjs/src/lib/api/plotting.ts b/bokehjs/src/lib/api/plotting.ts | |
index a42a95acd..0eb36a718 100644 | |
--- a/bokehjs/src/lib/api/plotting.ts | |
+++ b/bokehjs/src/lib/api/plotting.ts | |
@@ -631,7 +631,7 @@ export class Figure extends Plot { | |
} | |
_pop_visuals(cls: Class<HasProps>, props: Attrs, prefix: string = "", | |
- defaults: Attrs = {}, trait_defaults: Attrs = {}): Attrs { | |
+ defaults_: Attrs = {}, trait_defaults_: Attrs = {}): Attrs { | |
const _split_feature_trait = function(ft: string): string { | |
ft = ft.split('_', 2) | |
@@ -643,25 +643,27 @@ export class Figure extends Plot { | |
return ['line', 'fill', 'text'].includes(feature) && (trait != null) | |
} | |
- const defaults : Attrs = {...defaults} | |
+ const defaults : Attrs = {...defaults_} | |
if ( !defaults.includes('text_color') ) { | |
defaults['text_color'] = 'black' } | |
- const trait_defaults : Attrs = {...trait_defaults} | |
+ const trait_defaults : Attrs = {...trait_defaults_} | |
if ( !trait_defaults.includes('color') ) { | |
trait_defaults['color'] = _default_color } | |
if ( !trait_defaults.includes('alpha') ){ | |
trait_defaults['alpha'] = _default_alpha } | |
const result: Attrs = {} | |
- traits = new Set() | |
- for (pname in cls.properties) { | |
+ const traits = new Set() | |
+ for (const pname in cls.properties) { | |
if (_is_visual(pname)) { | |
- [_, trait] = _split_feature_trait(pname) | |
+ const [_, trait] = _split_feature_trait(pname) | |
if (props.includes(prefix+pname)) { | |
result[pname] = props[prefix+pname] | |
- delete props[prefix+pname] } | |
+ delete props[prefix+pname] | |
+ } | |
else if (props.includes(prefix+trait)) { | |
- result[pname] = props[prefix+trait] } | |
+ result[pname] = props[prefix+trait] | |
+ } | |
else if (defaults.includes(pname)) { | |
result[pname] = defaults[pname] } | |
else if (trait_defaults.includes(trait)) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
plotting.js
goes tobokehjs/src/lib/api/
hover.py
goes toexamples/app/
Run example by invoking
python -m bokeh serve --show examples/app/hover.py