Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
some bokeh custom models not rendering
import * as _ from "underscore"
import * as $ from "jquery"
import * as p from 'core/properties';
import {LayoutDOM, LayoutDOMView} from 'models/layouts/layout_dom';
class ComparativeMapView extends LayoutDOMView {
constructor(options) {
console.log('ComparativeMapView()');
super(options);
this.render();
}
render() {
this.$el.html('ComparativeMap');
console.log('ComparativeMapView.render()');
console.log(this.model);
}
}
export class ComparativeMap extends LayoutDOM {}
ComparativeMap.prototype.default_view = ComparativeMapView;
ComparativeMap.prototype.type = 'ComparativeMap';
ComparativeMap.define({
map_renderers : [p.Array, []]
});
from os import path
from bokeh.models.layouts import LayoutDOM
from bokeh.core.properties import Instance, List
from bokeh.util.compiler import FromFile
from models.map_renderer import MapRenderer
script_path = path.dirname(path.abspath( __file__ ))
class ComparativeMap(LayoutDOM):
"""
ComparativeMap is the top level component for visualizing one or more
genetic or genomic maps.
"""
__implementation__ = FromFile(script_path + '/comparative_map.js')
map_renderers = List(Instance(MapRenderer))
def __init__(self, maps=[], *args, **kwargs):
LayoutDOM.__init__(self, **kwargs)
self.map_renderers = maps
from bokeh.io import show
from bokeh.models.layouts import HBox
from models.comparative_map import ComparativeMap
from models.map_renderer import MapRenderer
map_renderers = [
MapRenderer(name="map1"),
MapRenderer(name="map2")
]
vis = ComparativeMap(
maps=map_renderers
)
layout = HBox(vis)
show(layout)
import * as _ from "underscore"
import * as $ from "jquery"
import * as p from 'core/properties';
import {LayoutDOM, LayoutDOMView} from 'models/layouts/layout_dom';
class MapRendererView extends LayoutDOMView {
constructor(options) {
console.log('MapRendererView()');
super(options);
this.render();
}
render() {
console.log('MapRendererView.render()');
this.$el.html(`MapRenderer: ${this.model.name}`);
}
}
export class MapRenderer extends LayoutDOM {}
MapRenderer.prototype.default_view = MapRendererView;
MapRenderer.prototype.type = 'MapRenderer';
from os import path
from bokeh.models.layouts import LayoutDOM
from bokeh.core.properties import Instance, List
from bokeh.util.compiler import FromFile
script_path = path.dirname(path.abspath( __file__ ))
class MapRenderer(LayoutDOM):
__implementation__ = FromFile(script_path + '/map_renderer.js')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.