Ejemplo n.º 1
0
    def setup_layout(self):

        #layout setup
        self.flights = bkwidgets.MultiSelect()
        tile_provider = get_provider(Vendors.CARTODBPOSITRON)
        p = bkplot.figure(x_axis_type='mercator', y_axis_type='mercator')
        p.add_tile(tile_provider)
        self.p2 = bkplot.figure()
        self.lines = self.p2.line(x='time', y='param', source=self.source2)
        self.hist = self.p2.quad(source=self.source3,
                                 top='top',
                                 bottom='bottom',
                                 left='left',
                                 right='right')
        self.params = bkwidgets.Select(
            options=['altitude', 'tas', 'fpf', 'performance_hist'],
            value='altitude')
        p2control = bklayouts.WidgetBox(self.params)
        layout = bklayouts.layout(self.controls, p)
        self.tables = bkwidgets.Select(options=self.tableList,
                                       value=self.tableList[0])
        self.time = bkwidgets.RangeSlider()
        self.populated = False

        #plot setup
        self.points = p.triangle(x='longitude',
                                 y='latitude',
                                 angle='heading',
                                 angle_units='deg',
                                 alpha=0.5,
                                 source=self.source)
        hover = bk.models.HoverTool()
        hover.tooltips = [("Callsign", "@callsign"), ("Time", "@time"),
                          ("Phase", "@status"), ("Heading", "@heading"),
                          ("Altitude", "@altitude"), ("Speed", "@tas")]
        hover2 = bk.models.HoverTool()
        hover2.tooltips = [("Callsign", "@callsign")]
        self.p2.add_tools(hover2)
        p.add_tools(hover)

        #callback setup
        self.params.on_change('value', self.plot_param)
        self.tables.on_change('value', self.set_data_source)
        self.cmdline.on_change('value', self.runCmd)

        self.controls = bklayouts.row(
            bklayouts.WidgetBox(self.tables, self.cmdline),
            bk.models.Div(width=20), p2control)
        self.layout = bklayouts.column(self.controls,
                                       bklayouts.row(p, self.p2))
Ejemplo n.º 2
0
def pages_pointschart():
    match = sme.EventDal.get_current_match()
    os.chdir(sc.output_path())
    chart = point_chart()
    div1 = blt.WidgetBox(bmw.Div(text='<a href="index.html">Home Page</a>'))
    div2 = blt.WidgetBox(
        bmw.Div(text='<h1>Points Chart</h1>' + 'updated at match:' + match))
    bokeh.io.output_file('pointschart.html')
    col = blt.column([div1, div2, chart])
    title = 'Ranking Table: Match ' + match
    # LocalResource needed to load JS and CSS files from local folder
    res = server.view.bokeh.LocalResource(
        os.path.join(sc.output_path(), 'static'))
    bokeh.io.save(col, title=title, resources=res)
Ejemplo n.º 3
0
def pages_rankingtable():
    df_all = ranking_df()
    autoTable = ranking_auto(df_all)
    generalTable = ranking_general(df_all)
    match = sme.EventDal.get_current_match()
    tab1 = bmw.Panel(child=generalTable, title='General Table')
    tab2 = bmw.Panel(child=autoTable, title='Auto Table')
    tabs = bmw.Tabs(tabs=[tab1, tab2])
    div1 = blt.WidgetBox(bmw.Div(text='<a href="index.html">Home Page</a>'))
    div2 = blt.WidgetBox(
        bmw.Div(text='<h1>Ranking Table</h1>' + 'updated at match:' + match))
    os.chdir(sc.output_path())
    bokeh.io.output_file('rankingtable.html')
    col = blt.column([div1, div2, tabs])
    title = 'Ranking Table: Match ' + match
    # LocalResource needed to load JS and CSS files from local folder
    res = server.view.bokeh_res.LocalResource(
        os.path.join(sc.output_path(), 'static'))
    bokeh.io.save(col, title=title, resources=res)
Ejemplo n.º 4
0
def pages_1t(teams):
    try:
        for team in teams:
            os.chdir(server.config.output_path() + r'/oneteam')
            bokeh.io.output_file('1t{0}.html'.format(team))
            title = 'One Team Display: Match ' + team
            graph = oneteam_plot(team)
            # LocalResource needed to load JS and CSS files from local folder
            res = server.view.bokeh_res.LocalResource(
                os.path.join(server.config.output_path(), 'static'))
            div = blt.WidgetBox(
                bwd.Div(
                    text=
                    '<h1>One Team Graphs</h1><a href="../index.html"><h4>Main Page</h4></a>'
                    + '<h3> Last Updated at Match: {} </h3>'.format(
                        sme.EventDal.get_previous_match())))
            col = blt.column(div, graph)
            bokeh.io.save(col, title=title, resources=res)
    except:
        print("Wasn't able to make this chart")
Ejemplo n.º 5
0
def compute(t):
    value = np.sin(xx / 50 + t / 10) * np.cos(yy / 50 + t / 10) * 50 + 50
    # print("doing compute..")
    return dict(x=xx, y=yy, z=value, color=value)


b = Button(name='test')
source = ColumnDataSource(data=compute(0))

#content_filename = join(dirname(__file__), "description.html")

description = Div(text="some text to describe this",
                  render_as_text=False,
                  width=600)

# surface = Surface3d(x="x", y="y", z="z", color="color", data_source=source)
nwidget = NewWidget()

curdoc().add_root(layouts.column([description, b, layouts.WidgetBox(nwidget)]))
# doc.add_root(layouts.column([description, b]))


@count()
def update(t):
    source.data = compute(t)


doc.add_periodic_callback(update, 100)
doc.title = "NewWidget"