How to use the zvt.app.app.callback function in zvt

To help you get started, we’ve selected a few zvt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zvtvz / zvt / zvt / apps / data_app.py View on Github external
@app.callback(
    [Output('data_table_content', "data"),
     Output('chart-container', "children")],
    [Input('data_table_content', "page_current"),
     Input('data_table_content', "page_size"),
     Input('data_table_content', "sort_by"),
     Input('data_table_content', "filter_query"),
     Input('chart-selector', "value")])
def update_table_and_graph(page_current, page_size, sort_by, filter, chart):
    if chart:
        dff = current_df

        if filter:
            filtering_expressions = filter.split(' && ')
            for filter_part in filtering_expressions:
                col_name, operator, filter_value = split_filter_part(filter_part)
github zvtvz / zvt / zvt / apps / data_app.py View on Github external
@app.callback(
    Output('schema-selector', 'options'),
    [Input('provider-selector', 'value')])
def update_schema_selector(provider):
    if provider:
        return [{'label': schema.__name__, 'value': schema.__name__} for schema in
                get_schemas(provider=provider)]
    raise dash.exceptions.PreventUpdate()
github zvtvz / zvt / zvt / apps / data_app.py View on Github external
@app.callback(
    [Output('data-table-content', "data"),
     Output('chart-container', "children")],
    [Input('data-table-content', "page_current"),
     Input('data-table-content', "page_size"),
     Input('data-table-content', "sort_by"),
     Input('data-table-content', "filter_query"),
     Input('intent-selector', "value"),
     Input('chart-selector', "value"),
     Input('col-setting-table', 'data'),
     Input('col-setting-table', 'columns')])
def update_table_and_graph(page_current, page_size, sort_by, filter, intent, chart, rows, columns):
    if chart:
        property_map = {}
        for row in rows:
            property_map[row['property']] = {
                'y_axis': row['y_axis'],
github zvtvz / zvt / zvt / apps / data_app.py View on Github external
@app.callback(
    Output('schema-selector', 'options'),
    [Input('provider-selector', 'value')])
def update_schema_selector(provider):
    if provider:
        return [{'label': schema.__name__, 'value': schema.__name__} for schema in
                get_schemas(provider=provider)]
    raise dash.exceptions.PreventUpdate()
github zvtvz / zvt / zvt / apps / data_app.py View on Github external
@app.callback(
    [Output('properties-selector', 'options'),
     Output('properties-selector', 'value')],
    [Input('schema-column-selector', 'value')],
    state=[State('provider-selector', 'value'),
           State('schema-selector', 'value'),
           State('properties-selector', 'options'),
           State('properties-selector', 'value')])
def update_selected_properties(selected_cols, provider, schema_name, options, value):
    if selected_cols and provider and schema_name:
        current_options = options
        current_value = value

        added_labels = []
        added_values = []
        for col in selected_cols:
            added_labels.append(col)
github zvtvz / zvt / zvt / apps / data_app.py View on Github external
@app.callback(
    [Output('data-table-container', 'children'),
     Output('table-type-label', 'children'),
     Output('intent-selector', 'options'),
     Output('intent-selector', 'value')],
    [Input('btn-load-data', 'n_clicks')],
    state=[State('properties-selector', 'value'),
           State('input-code-filter', 'value'),
           State('date-picker-range', 'start_date'),
           State('date-picker-range', 'end_date')])
def update_data_table(n_clicks, properties, codes: str, start_date, end_date):
    if n_clicks and properties:
        props = []
        for prop in properties:
            props.append(json.loads(prop))

        readers = properties_to_readers(properties=props, codes=codes, start_date=start_date,
github zvtvz / zvt / zvt / apps / data_app.py View on Github external
@app.callback(
    [Output('chart-selector', 'options'),
     Output('chart-selector', 'value')],
    [Input('intent-selector', 'value')])
def update_chart_selector(intent):
    if intent:
        charts = NormalData.get_charts_by_intent(intent=intent)
        options = [
            {'label': chart.value, 'value': chart.value} for chart in charts
        ]
        value = charts[0].value

        return options, value
    raise dash.exceptions.PreventUpdate()
github zvtvz / zvt / zvt / index.py View on Github external
@app.callback(Output('tabs-content-classes', 'children'),
              [Input('tabs-with-classes', 'value')])
def render_content(tab):
    if tab == 'data':
        return data_app.layout
    # elif tab == 'factor':
    #     return factor_app.layout
    elif tab == 'trader':
        return trader_app.serve_layout()
github zvtvz / zvt / zvt / apps / data_app.py View on Github external
@app.callback(
    Output('schema-column-selector-container', 'children'),
    [Input('schema-selector', 'value')],
    state=[State('provider-selector', 'value')])
def update_column_selector(schema_name, provider):
    if provider and schema_name:
        schema = get_schema_by_name(name=schema_name)
        cols = get_schema_columns(schema=schema)

        return dcc.Dropdown(
            id='schema-column-selector',
            options=[
                {'label': col, 'value': col} for col in cols
            ],
            value=get_schema_by_name(name=schema_name).important_cols(),
            multi=True
        )
github zvtvz / zvt / zvt / apps / data_app.py View on Github external
@app.callback(
    Output('schema-column-selector-container', 'children'),
    [Input('schema-selector', 'value')],
    state=[State('provider-selector', 'value')])
def update_column_selector(schema_name, provider):
    if provider and schema_name:
        schema = get_schema_by_name(name=schema_name)
        cols = get_schema_columns(schema=schema)

        return dcc.Dropdown(
            id='schema-column-selector',
            options=[
                {'label': col, 'value': col} for col in cols
            ],
            value=get_important_column(schema_name=schema_name),
            multi=True
        )