-
-
Notifications
You must be signed in to change notification settings - Fork 477
/
vizzu.py
56 lines (39 loc) · 1.17 KB
/
vizzu.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
"""
Defines custom VizzuChart bokeh model to render Vizzu charts.
"""
from bokeh.core.properties import (
Any, Bool, Dict, Instance, Int, List, String,
)
from bokeh.events import ModelEvent
from bokeh.models import LayoutDOM
from bokeh.models.sources import DataSource
from ..config import config
from ..util import classproperty
class VizzuEvent(ModelEvent):
event_name = 'vizzu_event'
def __init__(self, model, data=None):
self.data = data
super().__init__(model=model)
class VizzuChart(LayoutDOM):
"""
A Bokeh model that wraps around a Vizzu chart and renders it
inside a Bokeh.
"""
__javascript_module_exports__ = ['Vizzu']
__javascript_modules__ = [
f"{config.npm_cdn}/vizzu@0.9.3/dist/vizzu.min.js"
]
@classproperty
def __js_skip__(cls):
return {
'Vizzu': cls.__javascript__[0]
}
animation = Dict(String, Any)
config = Dict(String, Any)
columns = List(Dict(String, Any))
source = Instance(DataSource, help="""
Local data source to use when rendering glyphs on the plot.
""")
duration = Int(500)
style = Dict(String, Any)
tooltip = Bool()