@quartic/bokehjs
Version:
Interactive, novel data visualization
37 lines (28 loc) • 1.07 kB
text/coffeescript
import {SidePanel} from "core/layout/side_panel"
import * as p from "core/properties"
import {Renderer, RendererView} from "../renderers/renderer"
export class AnnotationView extends RendererView
_get_panel_offset: () ->
# Sub-classes may have to implement _get_panel_offset themselves
# because different renderers draw themselves differently so
# need the individual classes to determine the correct offset.
x = @model.panel._left._value
y = @model.panel._bottom._value
return {x: x, y: -y}
_get_size: () ->
# Sub-classes should implement _get_size if they want layout on side panels to work.
return -1
export class Annotation extends Renderer
type: 'Annotation'
default_view: AnnotationView
plot: [ p.Instance ]
}
level: 'annotation'
}
add_panel: (side) ->
# If the annotation is in a side panel, we need to set level to overlay, so it is visible.