def make_ajax_plot():
    test = AjaxDataSource(data_url=request.url_root + 'data/',
                          polling_interval=2000,
                          mode='replace')

    test.data = dict(angle=[], country=[], value=[], color=[])

    print(test.data)

    plot = figure(plot_height=350,
                  title="Pie Chart",
                  toolbar_location=None,
                  tools="hover",
                  tooltips="@country: @value")

    plot.annular_wedge(x=0,
                       y=1,
                       inner_radius=0.2,
                       outer_radius=0.4,
                       start_angle=cumsum('angle', include_zero=True),
                       end_angle=cumsum('angle'),
                       line_color=None,
                       fill_color='color',
                       legend='country',
                       source=test)

    plot.axis.axis_label = None
    plot.axis.visible = False
    plot.grid.grid_line_color = None

    script, div = components(plot)
    return script, div
Ejemplo n.º 2
0
def make_ajax_plot(observable, dim, network_ID):
    """This function is used to create a new Bokeh instance to send to the view.

        Inputs:
        -observable: a string containing the name of the observable to poll for.
        -network_ID: an int referring to the network whose observable need to be fetched.
    """
    source = AjaxDataSource(method='GET',
                            data_url=resolve_url('control') +
                            "?method=get_observable&observable=" +
                            str(observable) + "&network_ID=" + str(network_ID),
                            polling_interval=3000,
                            mode='replace')
    source.data = dict(x=[])
    for i in range(dim):
        source.data["y" + str(i)] = []

    plot = figure(plot_height=200, sizing_mode='scale_width')
    span = int(256 * 256 * 256 / (dim + 1)) + 1
    a = (int(span / (255 * 255)), int(span / (255)) % 255, span % 255)
    print(a)
    for i in range(dim):
        plot.line('x',
                  'y' + str(i),
                  source=source,
                  line_width=2,
                  line_color="#%02x%02x%02x" %
                  (int(i * span / (255 * 255)) + 1, int(i * span / (255)) %
                   (255) + 1, i * span % 255 + 1))

    plot.xaxis.axis_label = "Iterations over time"

    script, div = components(plot, CDN)
    return script, div
Ejemplo n.º 3
0
def make_ajax_plot():
    source = AjaxDataSource(data_url=request.url_root + 'data/',
                            polling_interval=2000,
                            mode='append')

    source.data = dict(x=[], y=[])

    plot = figure(plot_height=300, sizing_mode='scale_width')
    plot.line('x', 'y', source=source, line_width=4)

    script, div = components(plot)
    return script, div
Ejemplo n.º 4
0
def make_demo_plot():
    source = AjaxDataSource(data_url=resolve_url('demo_data'),
                            polling_interval=2000,
                            mode='replace')

    source.data = dict(x=[], y=[])

    plot = figure(plot_height=200, sizing_mode='scale_width')
    plot.line('x', 'y', source=source, line_width=4)

    script, div = components(plot, CDN)
    return script, div
Ejemplo n.º 5
0
def make_ajax_plot():

    source = AjaxDataSource(data_url='http://localhost:9000/data/',
                            polling_interval=2000,
                            mode="append")

    source.data = dict(x=[], y=[])

    plot = figure(plot_height=300, sizing_mode='scale_width')
    plot.line('x', 'y', source=source, line_width=4)

    script, div = components(plot, CDN)
    return script, div
Ejemplo n.º 6
0
def make_ajax_plot(traffic_scale, databrick):
    traffic_scale = traffic_scale
    databrick = databrick

    source = AjaxDataSource(data_url=request.url_root + 'data/',
                            polling_interval=3000,
                            mode='replace')

    #source.data = dict(traffic=[], x=[], y=[], hitters=[], category=[])

    source.data = create_source_live_ip(traffic_scale, databrick)

    # Map specific colors to each category value in the dataframe and set the tools to be suppplied with the visualization.
    mapper = CategoricalColorMapper(factors=('1', '5', '10'),
                                    palette=['#3a9244', '#f9cc10', '#b2282f'])
    TOOLS = "hover,save,pan,box_zoom,reset,wheel_zoom, crosshair"

    # create a 128 x 128 Bokeh figure entitled "Databrick."
    plot = figure(title="Databrick",
                  tools=TOOLS,
                  x_range=(0, 127),
                  y_range=(0, 127),
                  x_axis_label="source",
                  y_axis_label="destination")

    # get rid of any grid, axis, or tick_line color.
    plot.grid.grid_line_color = None
    plot.axis.axis_line_color = None
    plot.axis.major_tick_line_color = None

    # Create 1 x 1 heatmap elements (rectangles) that visualize each piece of data in from source.data
    plot.rect(x="x",
              y="y",
              width=1,
              height=1,
              source=source,
              fill_color={
                  'field': 'category',
                  'transform': mapper
              },
              line_color=None)

    # Set the values to be displayed by the hover tool.
    plot.select_one(HoverTool).tooltips = [('Traffic', '@traffic'),
                                           ('source bin', '@x'),
                                           ('dest bin', '@y'),
                                           ('hitters', '@hitters')]

    script, div = components(plot)
    return script, div
Ejemplo n.º 7
0
def make_line_plot(dictionary, id):
    source = AjaxDataSource(data_url=request.url_root + 'data/' + id + "/",
                            polling_interval=1000,
                            mode='replace')
    source.data = dictionary
    plot = figure(plot_height=300,
                  sizing_mode='scale_width',
                  x_axis_type="datetime")

    for key in dictionary.keys():
        if key == "time_stamp": continue
        plot.line('time_stamp', key, source=source, line_width=4)

    script, div = components(plot)
    return script, div
Ejemplo n.º 8
0
def make_control_chart(dictionary, id):
    source = AjaxDataSource(data_url=request.url_root + 'control-chart/' + id +
                            "/",
                            polling_interval=1000,
                            mode='replace')
    source.data = dictionary

    keys = [
        key for key in dictionary
        if not (key.endswith("_lower") or (key.endswith("_upper")))
    ]
    figures = []
    for key in keys:
        if key == "time_stamp": continue
        plot = figure(plot_height=300,
                      sizing_mode='scale_width',
                      x_axis_type="datetime")
        band = Band(
            base="time_stamp",
            lower=key + '_lower',
            upper=key + '_upper',
            source=source,
            level='underlay',
            fill_alpha=0.4,
            line_width=1,
            fill_color='#55FF88',
            line_color='red',
            line_dash='dashed',
        )
        plot.add_layout(band)
        plot.line('time_stamp', key, source=source, line_width=4)
        plot.circle('time_stamp',
                    key,
                    source=source,
                    line_width=4,
                    color="red")

        figures.append(plot)

    script, div = components(column(figures))

    return script, div
Ejemplo n.º 9
0
def make_ajax_plot(sensor_data: SensorType):

    colours = bokeh.palettes.Category10[10]
    plot = figure(plot_height=300, sizing_mode='scale_width')
    i = 0
    for sensor_instance_name, sensor_instance_data in sensor_data.series_data.items(
    ):
        update_path = 'data/{}/{}'.format(sensor_data.sensor_type,
                                          sensor_instance_name)
        source = AjaxDataSource(data_url=request.url_root + update_path,
                                polling_interval=30000,
                                mode='replace')
        source.data = dict(x=sensor_instance_data.x_data,
                           y=sensor_instance_data.y_data)
        plot.line('x',
                  'y',
                  source=source,
                  line_width=4,
                  legend_label=sensor_instance_name,
                  color=colours[i % 10])
        i += 1

    plot.title.text = sensor_data.sensor_type
    plot.title.text_font_size = '20px'
    plot.legend.location = "top_left"
    plot.legend.click_policy = "hide"
    fs_days = "%Y-%m-%d"
    fs_hours = "%Y-%m-%d %H"
    fs_mins = "%Y-%m-%d %H:%M"
    fs_secs = "%Y-%m-%d %H:%M:%S"
    plot.xaxis.formatter = DatetimeTickFormatter(
        seconds=[fs_secs],
        minutes=[fs_mins],
        hours=[fs_hours],
        days=[fs_days],
        months=[fs_days],
        years=[fs_days],
    )

    script, div = components(plot)
    return script, div
Ejemplo n.º 10
0
text.on_change('value', update_title)

def update_data(attrname, old, new):

    # Get the current slider values
    #a = date.value

    # Generate the new curve
    #view = all_data.loc[all_data['year'] == a]
    #print(len(view))
    x = view['scene_lat']
    y = view['scene_lon']
<<<<<<< HEAD
    #colors = ["#%02x%02x%02x" % (int(255/(r+1)), 100, 100) for r in all_data.data['percentageofpote1']]
    all_data.data = dict(x=x, y=y)#, c=colors)
=======
    #c = view['percentageofpote1']
    # print(min(view['percentageofpote1']), max(view['percentageofpote1']))
    colors = ["#%02x%02x%02x" % (int(255/(r+1)), 100, 100) for r in all_data['percentageofpote1']]
    source.data = dict(x=x, y=y, c=colors)
>>>>>>> e7f846dee1dfa6a2cadf387c048e368d3183ad49

for w in [date]:
    w.on_change('value', update_data)


# Set up layouts and add to document
inputs = widgetbox(text, date)

curdoc().add_root(row(inputs, plot, ))
Ejemplo n.º 11
0
def make_plot(data_url):
    def make_unit_poly_vertices(dist):
        x0, y0 = 0, 0
        theta = np.linspace(0, 2 * np.pi, 101, endpoint=True)
        theta += np.pi / 2  # start zero at top
        result = [(dist * np.cos(t) + x0, dist * np.sin(t) + y0) for t in theta]
        return result

    p = figure(plot_width=SIZE,
               plot_height=SIZE,
               x_range=(-1 - PAD, 1 + PAD),
               y_range=(-1 - PAD, 1 + PAD),
               min_border=0,
               background_fill_color="#000000")
    p.xgrid.visible = False
    p.ygrid.visible = False
    p.xaxis.axis_label = 'Distance ({})'.format(DISTANCE_UNITS)
    p.xaxis.axis_label = 'Distance ({})'.format(DISTANCE_UNITS)
    p.xaxis.ticker = [-1, 0, 1]
    p.yaxis.ticker = [-1, 0, 1]
    p.xaxis.major_label_overrides = {-1: str(-SENSOR_RANGE[-1]), 0: 'Zero', 1: str(SENSOR_RANGE[-1])}
    p.yaxis.major_label_overrides = {-1: str(-SENSOR_RANGE[-1]), 0: 'Zero', 1: str(SENSOR_RANGE[-1])}
    p.toolbar.logo = None
    p.toolbar_location = None

    # concentric lines
    distances_to_line = np.linspace(0, 1, NUM_LINES, endpoint=True)
    for d in distances_to_line:
        vertices = make_unit_poly_vertices(d)  # TODO make circle instead
        line_x = [v[0] for v in vertices]
        line_y = [v[1] for v in vertices]
        line_source = ColumnDataSource({'x': line_x,
                                        'y': line_y})
        p.line(x='x',
               y='y',
               source=line_source,
               line_width=LINE_WIDTH,
               line_color='#43ff00')

    # radial axes
    num_axes = 4
    big_angle = 2.0 * np.pi / num_axes
    angles = np.arange(num_axes) * big_angle - np.pi / 2
    p.annular_wedge(x=0,
                    y=0,
                    inner_radius=distances_to_line[0],
                    outer_radius=distances_to_line[-1],
                    start_angle=angles,
                    end_angle=angles,
                    color='#43ff00')

    # scatter
    scatter_source = AjaxDataSource(data_url=data_url,
                                    polling_interval=MS_PER_STEP,
                                    max_size=ROLLOVER,
                                    mode='replace')
    scatter_source.data = {'x': [],
                           'y': []}
    p.scatter(x='x',
              y='y',
              source=scatter_source,
              line_color=None,
              fill_color='#43ff00',
              radius=SCATTER_RADIUS)

    return p
Ejemplo n.º 12
0
def make_plot():

    # Initialize Plot
    plot = figure(x_range=(-9790000, -9745000),
                  y_range=(5120000, 5170000),
                  x_axis_type="mercator",
                  y_axis_type="mercator",
                  tools=['pan'],
                  sizing_mode='stretch_both')
    plot.add_tile(CARTODBPOSITRON)

    plot.toolbar.active_scroll = "auto"
    plot.xaxis.major_tick_line_color = None  # turn off x-axis major ticks
    plot.xaxis.minor_tick_line_color = None  # turn off x-axis minor ticks

    plot.yaxis.major_tick_line_color = None  # turn off y-axis major ticks
    plot.yaxis.minor_tick_line_color = None  # turn off y-axis minor ticks

    plot.xaxis.major_label_text_font_size = '0pt'  # turn off x-axis tick labels
    plot.yaxis.major_label_text_font_size = '0pt'  # turn off y-axis tick labels

    plot.toolbar.logo = None
    plot.toolbar_location = None

    # Read in train line data
    sf = shapefile.Reader("CTA_New/CTA_New")
    features = sf.shapeRecords()

    Lines = []
    Coords_x = []
    Coords_y = []
    for shape in features:
        Line = shape.record[5]
        Coord = shape.shape.points
        X_s = []
        Y_s = []
        for coord in Coord:
            Trans = merc(tuple(reversed(coord)))
            X_s.append(Trans[0])
            Y_s.append(Trans[1])
        Coords_x.append(X_s)
        Coords_y.append(Y_s)

    CTA_Lines = ['Red', 'G', 'Blue', 'P', 'Brn', 'Pink', 'Org', 'Y']

    # Set up data sources
    # - Live CTA Data
    source = AjaxDataSource(data_url=request.url_root + 'cta_data/',
                            polling_interval=5000,
                            mode='replace')
    source.data = dict(x=[],
                       y=[],
                       next_station=[],
                       destination=[],
                       direction=[],
                       color=[],
                       line_name=[])

    # - Station Coordinate Data
    L_Map = pd.read_csv('Stations.csv')
    station_source = ColumnDataSource(
        dict(x=L_Map['coords_x'],
             y=L_Map['coords_y'],
             name=L_Map['STATION_NAME']))

    # Color Map for trains
    color_mapper = CategoricalColorMapper(factors=CTA_Lines,
                                          palette=[
                                              'Red', 'Green', 'Blue', 'Purple',
                                              'Brown', 'Pink', 'Orange',
                                              'Yellow'
                                          ])

    # Plot Glyphs
    for i in range(len(Coords_x)):
        plot.line(x=Coords_x[i], y=Coords_y[i], line_color="black", alpha=0.7)

    stations = plot.circle(x='x',
                           y='y',
                           source=station_source,
                           size=5,
                           line_color="black",
                           fill_color='white')
    circles = plot.circle(x='x',
                          y='y',
                          angle='heading',
                          source=source,
                          color={
                              'field': 'color',
                              'transform': color_mapper
                          },
                          size=14,
                          line_color="black",
                          line_width=0.8,
                          legend='line_name')
    triangles = plot.triangle(x='x',
                              y='y',
                              angle='heading',
                              source=source,
                              size=8,
                              color='white')

    # Set Up Tools
    hover = HoverTool(tooltips=[("Next Stop", "@next_station"),
                                ("Destination", "@destination")],
                      renderers=[circles])

    station_hover = HoverTool(tooltips=[("Station", "@name")],
                              renderers=[stations])

    wheel = WheelZoomTool()

    plot.add_tools(hover)
    plot.add_tools(station_hover)
    plot.add_tools(wheel)

    plot.toolbar.active_scroll = wheel

    plot.legend.location = "top_left"

    script, div = components(plot)
    return script, div
Ejemplo n.º 13
0
def ajax_getplot(x, y, y_bottom, ref_value):  #fi,ff,y_bottom,ref_value,x,y):
    # En la ventana del plot
    graf = figure(tools="save",
                  x_axis_label="Frequency [Hz]",
                  y_axis_label='Power [dBm]',
                  width=700,
                  height=400,
                  sizing_mode='stretch_width',
                  x_range=(x[0], x[-1]),
                  y_range=(float(y_bottom), float(ref_value)))
    graf.toolbar.logo = None
    graf.toolbar.active_drag = None
    graf.toolbar.active_scroll = None

    graf.yaxis.major_label_text_font_style = 'bold'
    graf.xaxis.major_label_text_font_style = 'bold'
    graf.xaxis.axis_label_text_font_style = 'bold'
    graf.yaxis.axis_label_text_font_style = 'bold'
    graf.xaxis[0].formatter.use_scientific = True

    graf.xaxis[0].ticker.desired_num_ticks = 15
    graf.yaxis[0].ticker.desired_num_ticks = 10
    graf.ygrid.grid_line_alpha = 0.4
    graf.ygrid.grid_line_dash = [6, 4]
    graf.xgrid.grid_line_alpha = 0.4
    graf.xgrid.grid_line_dash = [6, 4]
    # graf.ygrid.minor_grid_line_alpha = 0.1
    # graf.ygrid.minor_grid_line_color = 'navy'
    # graf.xgrid.minor_grid_line_alpha = 0.1

    graf.background_fill_color = "black"
    graf.border_fill_color = "black"
    graf.border_fill_alpha = 0
    graf.xaxis.axis_line_color = "white"
    graf.yaxis.axis_line_color = "white"

    props = dict(line_width=4, line_alpha=0.7)

    # source for (marker_abs, markers [CANT_MARKERS])
    source_markers = ColumnDataSource(data={})

    # source for table of graf's markers
    source_table = ColumnDataSource()
    # strings for table of graf's markers
    source_table_share = ColumnDataSource(
    )  # only for share strings of table's rows between graf_adapter.js, checkbox_callback.js

    #################################################################################################################################################################
    # # --------------------------------------------------------------------------------------

    # button_height   = 30
    # button_width    = 70
    #SLIDER_WIDTH    = 500 # px
    CHECKBOX_WIDTH = 100

    # --------------------------------------------------------------------------------------

    if x != 0 and y != 0:
        max_abs_y = max(y)
        max_abs_x = argmax(y)
        #x_npa=asarray(x)
        y_npa = asarray(y)
        x_axis = linspace(x[0], x[-1], len(x))
    else:
        y_bottom = -100
        ref_value = -60
        y_npa = asarray([0, 0])
        x_axis = [0, 0]
        max_abs_y = 0
        max_abs_x = 0

#################################################################################################################################################################
# Sliders de marcadores

# solicitar frecuencias al analizador
    sliders = []
    if x[0] != x[-1]:
        step = (x[-1] - x[0]) / len(x)

        if step <= 0:
            step = 1

        init = (max_abs_x * step) + x[0]

        for i in range(0, CANT_MARKERS):
            sliders.append(
                Slider(start=x[0],
                       end=x[-1],
                       value=init,
                       step=step,
                       title="MARKER " + str(i + 1)))

    else:
        for i in range(0, CANT_MARKERS):
            sliders.append(
                Slider(start=0,
                       end=1,
                       value=0,
                       step=1,
                       title="MARKER " + str(i + 1)))

#################################################################################################################################################################
# Tablas de configuracion (las de solo lectura)

    source_set_an = ColumnDataSource()
    source_set_gen = ColumnDataSource()
    source_set_powm = ColumnDataSource()

    #################################################################################################################################################################
    # preparo el marcador movil

    # ve posibilidad de agregar PointDrawTool de hovertools
    # http://docs.bokeh.org/en/1.0.0/docs/user_guide/tools.html#click-tap-tools

    graf.add_tools(
        HoverTool(
            tooltips=[
                ('frec', '@x{0,0} Hz'),
                ('amp', '@y dBm'),  # use @{ } for field names with spaces
            ],
            point_policy='follow_mouse',
            mode='vline'))

    with open("static/js/graf_adapter.js", "r") as f:
        code = f.read()

    adapter = CustomJS(args=dict(graf=graf,
                                 sliders=sliders,
                                 source_markers=source_markers,
                                 source_table=source_table,
                                 source_table_share=source_table_share,
                                 source_set_an=source_set_an,
                                 source_set_gen=source_set_gen,
                                 source_set_powm=source_set_powm),
                       code=code)

    source = AjaxDataSource(data_url=request.url_root + 'data/',
                            polling_interval=1000,
                            mode='replace',
                            adapter=adapter)

    source.data = dict(x=[],
                       y=[],
                       y_bottom=[],
                       ref_value=[],
                       start_freq=[],
                       stop_freq=[])  #, power = [] )
    # span = [], center_freq = [], demod_time = [], ref_level = [], # ANALIZADOR
    # lf_freq = [], lf_level = [], rf_freq = [], rf_level = [], fm_mod_freq = [], am_mod_freq = [],am_mod_index= [],fm_mod_index= [],pm_mod_index= [], power = []) # GENERADOR

    graf.line('x', 'y', source=source, line_color="cyan")

    ###############################################################################

    # maximos relativos
    max_rel_x = argrelextrema(y_npa, greater)  #dato pasado a numpy array

    ###############################################################################

    # datos para la tabla de datos
    info = []
    value = []

    # tabla de datos
    source_table.data = dict(x_data=info, y_data=value)
    source_table_share.data = dict(x_data=info, y_data=value)
    #source_table = source
    columns = [
        TableColumn(field="x_data", title="Information"),
        TableColumn(field="y_data", title="Value")
    ]

    data_table = DataTable(source=source_table,
                           columns=columns,
                           height=200,
                           width=400)

    ###############################################################################
    set_div = Div(text="<b>Current Settings</b>")

    # tabla de valores seteados actualmente del analizador
    source_set_an.data = dict(
        configuration=[
            "X scale", "Y scale", "Start freq", "Stop freq", "Span",
            "Center freq", "Ref level", "Demod time", "Demod type",
            "Input att", "Resolution BW", "Scale div", "Avg state", "Avg times"
        ],
        value=[
            "LIN", "LOG", "0.0", "1.0", "1.0", "1.0", "0.0", "0.0", "FM", "10",
            "100000", "10.0", "WRITe", "1"
        ],
    )

    columns_set_an = [
        TableColumn(field="configuration", title="Analizer"),
        TableColumn(field="value", title="value"),
    ]
    info_table_an = DataTable(source=source_set_an,
                              columns=columns_set_an,
                              width=220,
                              height=180)

    # tabla de valuees seteados actualmente en el generador
    source_set_gen.data = dict(
        configuration=[
            "LF state", "LF freq", "LF level", "LF waveform", "RF state",
            "RF freq", "RF level", "AM state", "AM source", "AM mod freq",
            "AM mod index", "AM waveform", "Modulation type",
            "Modulation state", "FM mod freq", "FM mod index", "FM waveform",
            "PM mod freq", "PM mod index", "PM waveform"
        ],
        value=[
            "OFF", "0.0", "0.0", "SINE", "0.0", "0.0", "0.0", "OFF", "INT",
            "0.0", "0.0", "SINE", "FM", "OFF", "0.0", "0.0", "SINE", "0.0",
            "0.0", "0.0"
        ],
    )

    columns_set_gen = [
        TableColumn(field="configuration", title="Generator"),
        TableColumn(field="value", title="value"),
    ]
    info_table_gen = DataTable(source=source_set_gen,
                               columns=columns_set_gen,
                               width=220,
                               height=180)

    # tabla de valuees seteados actualmente en el generador
    source_set_powm.data = dict(
        configuration=["Duty cycle", "Average"],
        value=["50", "1"],
    )

    columns_set_powm = [
        TableColumn(field="configuration", title="Power meter"),
        TableColumn(field="value", title="value"),
    ]
    info_table_powm = DataTable(source=source_set_powm,
                                columns=columns_set_powm,
                                width=200,
                                height=180)

    #source_table = source

    ###############################################################################
    ## cosas a graficar

    # source5 = ColumnDataSource(data=dict(x5=[x_axis[max_abs_x]], y5=[max_abs_y]))
    # source4 = ColumnDataSource(data=dict(x4=[x_axis[max_abs_x]], y4=[max_abs_y]))
    # source3 = ColumnDataSource(data=dict(x3=[x_axis[max_abs_x]], y3=[max_abs_y]))
    # source2 = ColumnDataSource(data=dict(x2=[x_axis[max_abs_x]], y2=[max_abs_y]))

    # source5 = ColumnDataSource(data=dict(x5=[], y5=[]))
    # source4 = ColumnDataSource(data=dict(x4=[], y4=[]))
    # source3 = ColumnDataSource(data=dict(x3=[], y3=[]))
    # source2 = ColumnDataSource(data=dict(x2=[], y2=[]))

    # marcadores moviles que arrancan en el absolute maximum
    # l5=graf.circle('x5', 'y5', source=source5, color="lawngreen", line_width=8, line_alpha=0.7 )
    # l4=graf.circle('x4', 'y4', source=source4, color="lime", line_width=8, line_alpha=0.7)
    # l3=graf.circle('x3', 'y3', source=source3, color="yellow", line_width=8, line_alpha=0.7)
    # l2=graf.circle('x2', 'y2', source=source2, color="blue", line_width=8, line_alpha=0.7)

    # custom markers
    #markers_rel_dict = {}
    markers = []
    colors = ["yellow", "red", "pink", "lime"]
    for i in range(0, CANT_MARKERS):
        x_label = 'x_mark_' + str(i + 1)
        y_label = 'y_mark_' + str(i + 1)
        source_markers.data[x_label] = [x_axis[max_abs_x]]
        source_markers.data[y_label] = [max_abs_y]
        markers.append(
            graf.circle(x_label,
                        y_label,
                        source=source_markers,
                        color=colors[i],
                        line_width=8,
                        line_alpha=0.7))

    #l1=graf.circle(x_axis[max_rel_x[0]] , y_npa[max_rel_x[0]], color="yellowgreen", **props)

    # max abs marker
    source_markers.data['x_abs'] = [x_axis[max_abs_x]]
    source_markers.data['y_abs'] = [max_abs_y]
    marker_abs = graf.circle(x='x_abs',
                             y='y_abs',
                             source=source_markers,
                             color="red",
                             line_width=8,
                             line_alpha=0.7)

    #marker_abs=graf.circle(x_axis[max_abs_x],max_abs_y, color="green", **props)

    ###############################################################################
    # presentacion del maximo
    #maximo=str('%.2f' % max_abs_y)+"V @ "+str('%.2f' % x_axis[max_abs_x]+" rad")

    # presentacion de maximos relativos
    max_rel = ["a" for i in range(len(max_rel_x[0]))]

    for i in range(len((max_rel_x[0]))):
        max_rel[i] = (str('%.2f' % y_npa[max_rel_x[0][i]]) + "V @ " +
                      str('%.2f' % x_axis[max_rel_x[0][i]] + " rad"))

    ###############################################################################
    # Sliders de marcadores

    #callback unico para todos los sliders
    with open("static/js/callback_sm.js", "r") as f:
        callback_sm_code = f.read()

    callback_sm = CustomJS(args=dict(source_table=source_table,
                                     source=source,
                                     source_markers=source_markers,
                                     sliders=sliders,
                                     markers=markers,
                                     graf=graf,
                                     props=props),
                           code=callback_sm_code)

    for i in range(0, CANT_MARKERS):
        sliders[i].js_on_change('value', callback_sm)

    ###############################################################################

    # Acciones relativas a los checkbox
    checkbox_labels = ["Max. Abs"]
    # checkbox_labels = ["Max. Abs", "Max. Rel"]
    checkbox_preset = CheckboxGroup(labels=checkbox_labels,
                                    active=[],
                                    width=CHECKBOX_WIDTH)

    checkbox_mark = CheckboxGroup(
        labels=["Mark 1", "Mark 2", "Mark 3", "Mark 4"],
        active=[],
        width=CHECKBOX_WIDTH)

    #checkbox.active=[] <- indica los índices de los elementos "activados" (para activar el 1: [1], para activar el 0 y el 3: [0 3])
    #checkbox.active=[]
    #checkbox.active[0]=False
    marker_abs.visible = False
    #checkbox.active[1]=False
    for i in range(0, CANT_MARKERS):
        markers[i].visible = False
        pass

    #checkbox_mark.active=[]
    #checkbox_mark.active[0]=False
    # marker[i].visible=False
    #checkbox_mark.active[1]=False
    # marker[i].visible=False
    #checkbox_mark.active[2]=False
    # marker[i].visible=False
    #checkbox_mark.active[3]=False
    # marker[i].visible=False
    ##---------------------------------------------------------------------------##
    with open("static/js/checkbox_callback.js", "r") as f:
        checkbox_code = f.read()

    cjs = CustomJS(args=dict(marker_abs=marker_abs,
                             markers=markers,
                             checkbox_preset=checkbox_preset,
                             checkbox_mark=checkbox_mark,
                             source_table=source_table,
                             source=source,
                             source_markers=source_markers,
                             source_table_share=source_table_share,
                             sliders=sliders),
                   code=checkbox_code)
    checkbox_preset.js_on_click(cjs)

    checkbox_mark.js_on_click(cjs)

    ##---------------------------------------------------------------------------##

    sliders_col = column(sliders)

    # Ploteos
    layout_graf = gridplot([[graf]],
                           sizing_mode='scale_width',
                           toolbar_location="right")
    layout_widgets = widgetbox(row(checkbox_preset, checkbox_mark, sliders_col,
                                   data_table),
                               sizing_mode='scale_width')
    layout_seteos = widgetbox(row(info_table_an, info_table_gen,
                                  info_table_powm),
                              sizing_mode='scale_width')
    analyzer_layout = layout(
        [layout_graf, layout_widgets, set_div, layout_seteos],
        sizing_mode='scale_width')

    return components(analyzer_layout)