1
"""
2
Defines a custom PlotlyPlot bokeh model to render Plotly plots.
3
"""
4 7
from bokeh.core.properties import (
5
    Any, Dict, Enum, Int, Instance, List, String
6
)
7 7
from bokeh.models import LayoutDOM, ColumnDataSource
8

9 7
from ..util import classproperty, bundled_files
10

11

12 7
class PlotlyPlot(LayoutDOM):
13
    """
14
    A bokeh model that wraps around a plotly plot and renders it inside
15
    a bokeh plot.
16
    """
17

18 7
    __javascript_raw__ = [
19
        'https://code.jquery.com/jquery-3.4.1.min.js',
20
        'https://cdn.plot.ly/plotly-latest.min.js'
21
    ]
22

23 7
    @classproperty
24 2
    def __javascript__(cls):
25 7
        return bundled_files(cls)
26

27 7
    @classproperty
28 2
    def __js_skip__(cls):
29 0
        return {'Plotly': cls.__javascript__[1:]}
30

31 7
    __js_require__ = {
32
        'paths': {
33
            'plotly': 'https://cdn.plot.ly/plotly-latest.min'
34
        },
35
        'exports': {'plotly': 'Plotly'}
36
    }
37

38 7
    data = List(Any)
39

40 7
    layout = Dict(String, Any)
41

42 7
    config = Dict(String, Any)
43

44 7
    data_sources = List(Instance(ColumnDataSource))
45

46
    # Callback properties
47 7
    relayout_data = Dict(String, Any)
48 7
    restyle_data = List(Any)
49 7
    click_data = Dict(String, Any)
50 7
    hover_data = Dict(String, Any)
51 7
    clickannotation_data = Dict(String, Any)
52 7
    selected_data = Dict(String, Any)
53 7
    viewport = Dict(String, Any)
54 7
    viewport_update_policy = Enum( "mouseup", "continuous", "throttle")
55 7
    viewport_update_throttle = Int()
56 7
    _render_count = Int()

Read our documentation on viewing source code .

Loading