Ejemplo n.º 1
0
def get_scale_toggle(pane_id: str) -> html.Div:
    """Get y-axis scale toggle.

    Arguments:
        pane_id: DOM ID of pane.

    Returns:
        HTML component with scale toggle.
    """
    scale_options = [{
        'label': localize('log-scale'),
        'value': 'log'
    }, {
        'label': localize('linear-scale'),
        'value': 'linear'
    }]

    return html.Div(id=f'{pane_id}-scale-toggle',
                    className='scale-toggle',
                    children=[
                        html.Span(localize('y-axis') + ': ',
                                  id=f'scale-toggle-label',
                                  className='scale-toggle-label'),
                        dcc.RadioItems(id=f'scale-toggle-options',
                                       className='scale-toggle-options',
                                       options=scale_options,
                                       value='log')
                    ])
def get_chart_figure(selected_countries=None, dummy_url: str = None):
    """Gets Scoring Time figure for use by graph object.

    Arguments:
        selected_countries: Countries to include in the chart.
        dummy_url: URL of active pane, used to track changes and re-trigger callback.

    Returns:
        Object with chart data and layout.
    """
    chart_data = get_data('chart_data')

    # Filter data by selected countries.
    if selected_countries is None or not selected_countries:
        chart_data = [series for series in chart_data]
    else:
        chart_data = [
            series for series in chart_data
            if series.get('name') in selected_countries
        ]

    figure = {
        'data': chart_data,
        'layout': {
            'title': localize('deaths'),
            'hovermode': 'closest',
        },
    }
    return figure
def localize_heading(dummy_url: str = None) -> str:
    return localize('recovered')
def localize_summary_welcome(dummy_url: str = None) -> str:
    return localize('title')
def localize_data_update(dummy_url: str = None) -> str:
    return localize('data-update')
def localize_geoip_credit(dummy_url: str = None) -> str:
    return localize('geoip-credit')
def localize_summary_description(dummy_url: str = None) -> str:
    return localize('summary-description')
def localize_data_credit(dummy_url: str = None) -> str:
    return localize('data-credit')
def localize_summary_intro(dummy_url: str = None) -> str:
    return localize('summary-intro')
Ejemplo n.º 10
0
def localize_summary_welcome(dummy_url: str = None) -> str:
    return localize('summary-dashboard')
Ejemplo n.º 11
0
def localize_summary_description(dummy_url: str = None) -> str:
    return localize('recovered')
Ejemplo n.º 12
0
def localize_summary_intro(dummy_url: str = None) -> str:
    return localize('confirmed')
Ejemplo n.º 13
0
def localize_heading(dummy_url: str = None) -> str:
    return localize('confirmed')