def get_component(min_date, max_date, default_end_date, columns, show_faults, templates=None): """Return the configuration component for the map view. Keyword arguments: min_date -- The minimum date allowed to pick with the datepicker. max_date -- The maximum date allowed to pick with the datepicker. default_end_date -- The default end date for the datepicker. The default start date is the `min_date`. columns -- The available columns in the uploaded data show_faults -- Whether to display the faults toggler templates -- A list of template IDs to select from. """ return html.Div([ date_picker.get_component(min_date, max_date, default_end_date), timestep_picker.get_component(), size_picker.get_component(columns), color_picker.get_component(columns), template_picker.get_component(templates), interval_picker.get_component(), uncertainty_toggler.get_component(), faults_toggler.get_component(show_faults), opacity_toggler.get_component(), dbc.Button("Apply", id='apply', outline=True, color="success") ])
def get_component(session_id): """Return the main component of the cluster view. The component is composed by a header, a datepicker and a placeholder Keyword arguments: session_id -- string with the session_id """ data = get_data(session_id) mindate, maxdate = data.get_daterange() if maxdate - mindate <= datetime.timedelta(days=1): maxdate = maxdate + datetime.timedelta(days=1) items = [] items.append(html.H1("Clustering")) items.append(html.H3("Select a date range")) items.append( html.Div([ date_picker.get_component(mindate, maxdate, None), html.Div( id='intermediate-value', style={'display': 'none'}, children=[session_id] ), html.Div(id='output-container-date-picker-range') ]) ) return html.Div(items)
def get_component(min_date, max_date, columns, default_x, default_y, nbins_x, nbins_y): """Return the configuration component for the heatmap plot view. Keyword arguments: min_date -- The minimum date allowed to pick with the datepicker. max_date -- The maximum date allowed to pick with the datepicker. columns -- The available columns in the uploaded data default_x -- Column to use for x-axis by default default_y -- Column to use for y-axis by default nbins_x -- Number of bins used for the x-axis nbins_y -- Number of bins used for the y-axis """ return html.Div([ date_picker.get_component(min_date, max_date, max_date), axis_picker.get_component(columns, default_x), axis_picker.get_component(columns, default_y, False), html.Div([ html.Div(className='config-label', children='Number of bins for x'), dbc.Input(id='nbins-x', type='number', min=1, step=1, value=40), ], title='Select the number of bins used for x'), html.Div([ html.Div(className='config-label', children='Number of bins for y'), dbc.Input(id='nbins-y', type='number', min=1, step=1, value=40), ], title='Select the number of bins used for y'), dbc.Button('Apply', id='apply', outline=True, color='success') ])
def get_component(min_date, max_date, default_end_date): """Return the configuration component for the map view. Keyword arguments: min_date -- The minimum date allowed to pick with the datepicker. max_date -- The maximum date allowed to pick with the datepicker. default_end_date -- The default end date for the datepicker. The default start date is the `min_date`. """ return html.Div([ date_picker.get_component(min_date, max_date, default_end_date), timestep_picker.get_component(), dbc.Button("Apply", id='apply', outline=True, color="success") ])
def get_component(mindate, maxdate, session_id, id="1"): """Return the configuration component for the clustering view. that includesthe calendar, the input text box for the threshold value and the apply button Keyword arguments: mindate -- minimum date available for the data maxdate -- maximum date available session_id -- session-id used to track the session id -- id to differenciate between the two possible tabs in the app """ id_component = "date-pick-{}".format(id) date_component = date_picker.get_component( mindate, maxdate, None, id_component) threshold_component = html.Div([ dbc.Input(id="thr_{}".format(id), type="number", value=1e-5, step=1e-5), dbc.Button('Apply', id='apply_thr_{}'.format( id), outline=True, color='success') ]) return html.Div([ html.Div(children=[ date_component, html.Div(children="Threshold value:", className="config-label"), threshold_component], title='Select the threshold value, which is used to determine the' ' maximum distance between earthquakes in one cluster' ), html.Div( id='intermediate-value', style={'display': 'none'}, children=[session_id] ), dcc.Loading( id="loading-"+id, type="default", children=html.Div(id='output-clustering-'+id, )) ])
def get_component(min_date, max_date, default_end_date, columns, numeric_columns, default_x, default_y, default_size): """Return the configuration component for the scatter plot view. Keyword arguments: min_date -- The minimum date allowed to pick with the datepicker. max_date -- The maximum date allowed to pick with the datepicker. default_end_date -- The default end date for the datepicker. The default start date is the `min_date`. columns -- The available columns in the uploaded data numeric_columns -- Available numeric columns default_x -- Column to use for x-axis by default default_y -- Column to use for y-axis by default default_size -- Column to use for sizes by default """ return html.Div([ date_picker.get_component(min_date, max_date, default_end_date), axis_picker.get_component(columns, default_x), axis_picker.get_component(columns, default_y, False), size_picker.get_component(numeric_columns, default_size), color_picker.get_component(numeric_columns), dbc.Button('Apply', id='apply', outline=True, color='success') ])
def get_component(columns, min_date, max_date, default_end_date, default_column): """ Return the configuration component for the histogram view. Keyword arguments: columns -- The available columns in the uploaded data min_date -- The minimum date allowed to pick with the datepicker max_date -- The maximum date allowed to pick with the datepicker default_end_date -- The default end date for the datepicker. The default start date is the `min_date`. default_column -- The default column used for the histogram """ return html.Div([ date_picker.get_component(min_date, max_date, default_end_date), axis_picker.get_component(columns, default_column, is_histogram=True), html.Div([ html.Div(className='config-label', children='Maximum number of bins'), dbc.Input(id='nbins', type='number', min=2, step=1, value=10), ], title='Select the maximum number of bins used'), dbc.Button('Apply', id='apply', outline=True, color='success') ])