예제 #1
0
 def input_data(_ts, chart_type, x, y_multi, y_single, z, group, group_val,
                agg, window, rolling_comp, pathname, query):
     """
     dash callback for maintaining chart input state and column-based dropdown options.  This will guard against
     users selecting the same column for multiple axes.
     """
     y_val = make_list(y_single if chart_type in ZAXIS_CHARTS else y_multi)
     if group_val is not None:
         group_val = [json.loads(gv) for gv in group_val]
     inputs = dict(query=query,
                   chart_type=chart_type,
                   x=x,
                   y=y_val,
                   z=z,
                   group=group,
                   group_val=group_val,
                   agg=agg,
                   window=window,
                   rolling_comp=rolling_comp)
     data_id = get_data_id(pathname)
     options = build_input_options(global_state.get_data(data_id), **inputs)
     x_options, y_multi_options, y_single_options, z_options, group_options, barsort_options, yaxis_options = options
     show_map = chart_type == 'maps'
     map_style = {} if show_map else {'display': 'none'}
     non_map_style = {'display': 'none'} if show_map else {}
     cscale_style = colorscale_input_style(chart_type=chart_type)
     return (inputs, x_options, y_single_options, y_multi_options,
             z_options, group_options, barsort_options, yaxis_options,
             non_map_style, map_style, cscale_style)
예제 #2
0
 def input_data(_ts, chart_type, x, y_multi, y_single, z, group, agg,
                window, rolling_comp, pathname, query):
     """
     dash callback for maintaining chart input state and column-based dropdown options.  This will guard against
     users selecting the same column for multiple axes.
     """
     y_val = make_list(y_single if chart_type in ZAXIS_CHARTS else y_multi)
     inputs = dict(query=query,
                   chart_type=chart_type,
                   x=x,
                   y=y_val,
                   z=z,
                   group=group,
                   agg=agg,
                   window=window,
                   rolling_comp=rolling_comp)
     data_id = get_data_id(pathname)
     options = build_input_options(global_state.get_data(data_id), **inputs)
     x_options, y_multi_options, y_single_options, z_options, group_options, barsort_options, yaxis_options = options
     return (inputs, x_options, y_single_options, y_multi_options,
             z_options, group_options, barsort_options, yaxis_options)