def input_toggles(_ts, inputs): """ dash callback controlling showing/hiding of chart-specific inputs (for example z-axis) as well as chart formatting inputs (sorting for bars in bar chart, bar chart style (stacked) or y-axis ranges. """ [chart_type, agg] = [inputs.get(p) for p in ['chart_type', 'agg']] show_input = show_input_handler(chart_type) y_multi_style = { 'display': 'block' if show_input('y', 'multi') else 'none' } y_single_style = {'display': 'block' if show_input('y') else 'none'} z_style = {'display': 'block' if show_input('z') else 'none'} group_style = {'display': 'block' if show_input('group') else 'none'} rolling_style = {'display': 'inherit' if agg == 'rolling' else 'none'} cpg_style = { 'display': 'block' if show_chart_per_group(**inputs) else 'none' } bar_style = bar_input_style(**inputs) yaxis_style = { 'display': 'block' if show_yaxis_ranges(**inputs) else 'none' } return (y_multi_style, y_single_style, z_style, group_style, rolling_style, cpg_style, bar_style, bar_style, yaxis_style)
def input_toggles(_ts, inputs, pathname): """ dash callback controlling showing/hiding of chart-specific inputs (for example z-axis) as well as chart formatting inputs (sorting for bars in bar chart, bar chart style (stacked) or y-axis ranges. """ [chart_type, agg] = [inputs.get(p) for p in ["chart_type", "agg"]] show_input = show_input_handler(chart_type) y_multi_style = {"display": "block" if show_input("y", "multi") else "none"} y_single_style = {"display": "block" if show_input("y") else "none"} z_style = {"display": "block" if show_input("z") else "none"} group_style = {"display": "block" if show_input("group") else "none"} rolling_style = {"display": "inherit" if agg == "rolling" else "none"} cpg_style = {"display": "block" if show_chart_per_group(**inputs) else "none"} bar_style, barsort_style = bar_input_style(**inputs) yaxis_style = {"display": "block" if show_yaxis_ranges(**inputs) else "none"} data_id = get_data_id(pathname) df = global_state.get_data(data_id) animate_style, animate_by_style, animate_opts = animate_styles(df, **inputs) return ( y_multi_style, y_single_style, z_style, group_style, rolling_style, cpg_style, bar_style, barsort_style, yaxis_style, animate_style, animate_by_style, animate_opts, )