예제 #1
0
def generate_page():
    grid = ConnectedCardGrid()
    bev_perc_card = GraphCard(
        id='cars-bev-percentage',
        slider=dict(
            min=0,
            max=100,
            step=5,
            value=get_variable('cars_bev_percentage'),
            marks={x: '%d %%' % x for x in range(0, 100 + 1, 10)},
        ),
    )
    per_resident_card = GraphCard(
        id='cars-mileage-per-resident',
        slider=dict(
            min=-60,
            max=20,
            step=5,
            value=get_variable('cars_mileage_per_resident_adjustment'),
            marks={x: '%d %%' % (x) for x in range(-60, 20 + 1, 10)},
        ),
    )
    mileage_card = GraphCard(
        id='cars-total-mileage',
    )
    emission_factor_card = GraphCard(
        id='cars-emission-factor',
    )
    emissions_card = GraphCard(
        id='cars-emissions',
    )
    """
    biofuel_card = GraphCard(
        id='cars-biofuel-percentage',
    )
    """
    grid.make_new_row()
    grid.add_card(bev_perc_card)
    #grid.add_card(biofuel_card)
    grid.add_card(per_resident_card)
    grid.make_new_row()
    grid.add_card(emission_factor_card)
    grid.add_card(mileage_card)
    grid.make_new_row()
    grid.add_card(emissions_card)

    bev_perc_card.connect_to(emission_factor_card)
    #biofuel_card.connect_to(emission_factor_card)
    emission_factor_card.connect_to(emissions_card)

    per_resident_card.connect_to(mileage_card)
    mileage_card.connect_to(emissions_card)

    return html.Div([
        grid.render(),
        html.Div(id='cars-sticky-page-summary-container')
    ])
예제 #2
0
def generate_page():
    grid = ConnectedCardGrid()

    existing_card = GraphCard(
        id='district-heating-existing-building-unit-heat-factor',
        slider=dict(
            min=-60,
            max=20,
            step=5,
            value=get_variable(
                'district_heating_existing_building_efficiency_change') * 10,
            marks={x: '%.1f %%' % (x / 10)
                   for x in range(-60, 20 + 1, 10)},
        ))
    new_card = GraphCard(
        id='district-heating-new-building-unit-heat-factor',
        slider=dict(
            min=-60,
            max=20,
            step=5,
            value=get_variable(
                'district_heating_new_building_efficiency_change') * 10,
            marks={x: '%.1f %%' % (x / 10)
                   for x in range(-60, 20 + 1, 10)},
        ),
    )
    geo_card = GraphCard(id='district-heating-geothermal-production',
                         link_to_page=('BuildingHeating', 'GeothermalHeating'))

    row = grid.make_new_row()
    row.add_card(existing_card)
    row.add_card(new_card)
    row.add_card(geo_card)

    consumption_card = GraphCard(
        id='district-heating-consumption',
        extra_content=html.Div(id='district-heating-unit-emissions-card'))
    existing_card.connect_to(consumption_card)
    new_card.connect_to(consumption_card)
    geo_card.connect_to(consumption_card)

    row = grid.make_new_row()
    row.add_card(consumption_card)

    emissions_card = GraphCard(id='district-heating-consumption-emissions')
    consumption_card.connect_to(emissions_card)
    row = grid.make_new_row()
    row.add_card(emissions_card)

    return html.Div([
        grid.render(),
        html.Div(id='district-heating-sticky-page-summary-container')
    ])
예제 #3
0
def render_page():
    grid = ConnectedCardGrid()

    per_capita_card = GraphCard(
        id='electricity-consumption-per-capita',
        slider=dict(
            min=-50,
            max=20,
            step=5,
            value=get_variable(
                'electricity_consumption_per_capita_adjustment'),
            marks={x: '%d %%' % (x / 10)
                   for x in range(-50, 20 + 1, 10)},
        ))
    grid.make_new_row()
    grid.add_card(per_capita_card)

    consumption_card = GraphCard(id='electricity-consumption')
    emission_factor_card = GraphCard(
        id='electricity-consumption-emission-factor')
    per_capita_card.connect_to(consumption_card)

    grid.make_new_row()
    grid.add_card(consumption_card)
    grid.add_card(emission_factor_card)

    emission_card = GraphCard(id='electricity-consumption-emissions')
    consumption_card.connect_to(emission_card)
    emission_factor_card.connect_to(emission_card)

    grid.make_new_row()
    grid.add_card(emission_card)

    return grid.render()
예제 #4
0
def render_page():
    grid = ConnectedCardGrid()

    per_capita_card = GraphCard(
        id='electricity-consumption-per-capita',
        slider=dict(
            min=-50,
            max=20,
            step=5,
            value=int(
                get_variable('electricity_consumption_per_capita_adjustment') *
                10),
            marks={x: '%d %%' % (x / 10)
                   for x in range(-50, 20 + 1, 10)},
        ))
    solar_card = GraphCard(id='electricity-consumption-solar-production',
                           link_to_page=('ElectricityConsumption',
                                         'SolarProduction'))
    grid.make_new_row()
    grid.add_card(per_capita_card)
    grid.add_card(solar_card)

    consumption_card = GraphCard(id='electricity-consumption')
    emission_factor_card = GraphCard(
        id='electricity-consumption-emission-factor')
    per_capita_card.connect_to(consumption_card)
    solar_card.connect_to(consumption_card)

    grid.make_new_row()
    grid.add_card(consumption_card)
    grid.add_card(emission_factor_card)

    emission_card = GraphCard(id='electricity-consumption-emissions')
    consumption_card.connect_to(emission_card)
    emission_factor_card.connect_to(emission_card)

    grid.make_new_row()
    grid.add_card(emission_card)

    return html.Div(children=[
        grid.render(),
        html.Div(id='electricity-consumption-summary-bar')
    ])
예제 #5
0
def generate_page():
    grid = ConnectedCardGrid()

    existing_card = GraphCard(
        id='solar-power-existing-buildings',
        slider=dict(
            min=0,
            max=90,
            step=5,
            value=get_variable('solar_power_existing_buildings_percentage'),
            marks={x: '%d %%' % x
                   for x in range(0, 90 + 1, 10)},
        ),
        extra_content=html.Div(id='solar-power-existing-kwpa'),
    )
    new_card = GraphCard(
        id='solar-power-new-buildings',
        slider=dict(
            min=20,
            max=100,
            step=5,
            value=get_variable('solar_power_new_buildings_percentage'),
            marks={x: '%d %%' % x
                   for x in range(20, 100 + 1, 10)},
        ),
        extra_content=html.Div(id='solar-power-new-kwpa'),
    )
    grid.make_new_row()
    grid.add_card(existing_card)
    grid.add_card(new_card)

    production_card = GraphCard(id='solar-power-production')
    existing_card.connect_to(production_card)
    new_card.connect_to(production_card)
    grid.make_new_row()
    grid.add_card(production_card)

    emission_card = GraphCard(id='solar-power-emission-reductions')
    production_card.connect_to(emission_card)
    grid.make_new_row()
    grid.add_card(emission_card)

    return html.Div([
        grid.render(),
        html.Div(id='solar-power-sticky-page-summary-container')
    ])