RadioButton JS_on_event обратный вызов + запись данных

Диск сервера Wamp сервера "C://", если вы не используете его на другом диске для ex G://: перейдите к

  1. g:\\wamp\bin\apache\apache2.4.9\bin\

2.call cmd

3 .execute httpd.exe -t

вы увидите ошибки

  1. перейти к g:\wamp\bin\apache\apache2.4.9\conf\extra\httpd-autoindex.conf
  2. изменить в строке 23 на:

Alias /icons/ "g:/Apache24/icons/"


    Options Indexes MultiViews
    AllowOverride None
    Require all granted

  1. Перезапустить Все услуги. Готово. Решено

0
задан Roccalito 5 March 2019 в 09:59
поделиться

1 ответ

См. Код ниже. Вам нужно будет отфильтровать теги HTML из текста Div (работает для Bokeh v1.0.4).

from bokeh.io import show
from bokeh.plotting import figure
from bokeh import events
from bokeh.models import CustomJS, Div, Button, RadioButtonGroup
from bokeh.layouts import column, row

def display_event(div, attributes = [], style = 'float:left;clear:left;font_size=10pt'):
    "Build a suitable CustomJS to display the current event in the div model."
    return CustomJS(args = dict(div = div, radio_button = radioButton), code = """
        var attrs = %s; var args = [];
        for (var i = 0; i<attrs.length; i++) {
            args.push(attrs[i] + '=' + Number(cb_obj[attrs[i]]).toFixed(2));
        }
        var line = "<span style=%r><b>" + radio_button.labels[radio_button.active] + "</b>: (" + args.join(", ") + ")</span>\\n";
        var text = div.text.concat(line);
        var lines = text.split("\\n")
        if (lines.length > 35)
            lines.shift();
        div.text = lines.join("\\n");
    """ % (attributes, style))

p = figure()
p.circle(x = [1, 2, 3, 4, 5], y = [5, 4, 3, 2, 1])
div = Div(width = 1000)
radioButton = RadioButtonGroup(labels = ["Elevator", "LOP", "Waiting point"], active = 0)
button = Button(label = "Download JSON", button_type = "success")
layout = column(button, radioButton, row(p, div))

js_download = """
var filetext = div.text;
var lines = filetext.split("\\n")
var lines_json = {}
for (i = 0; i < lines.length; i++)
    if (lines[i].trim())
        lines_json[String(i)] = lines[i];

var filename = 'results.json';
var blob = new Blob([JSON.stringify(lines_json)], { type: 'text/json;charset=utf-8;' });
div.text = '';
if (navigator.msSaveBlob) { // IE 10+
navigator.msSaveBlob(blob, filename);
} else {
var link = document.createElement("a");
if (link.download !== undefined) { // feature detection
    // Browsers that support HTML5 download attribute
    var url = URL.createObjectURL(blob);
    link.setAttribute("href", url);
    link.setAttribute("download", filename);
    link.style.visibility = 'hidden';
    document.body.appendChild(link);
    link.click();
    document.body.removeChild(link);
}
}"""

button.callback = CustomJS(args = dict(div = div), code = js_download)
# button.js_on_event(events.ButtonClick, display_event(div))  # Button click$

point_attributes = ['x', 'y', 'sx', 'sy']  # Point events
point_events = [events.Tap, events.DoubleTap]

for event in point_events:
    p.js_on_event(event, display_event(div, attributes = point_attributes))

show(layout)
0
ответ дан Tony 5 March 2019 в 09:59
поделиться
Другие вопросы по тегам:

Похожие вопросы: