mirror of
https://github.com/flobz/psa_car_controller.git
synced 2026-08-22 09:26:16 +00:00
add card to webui
This commit is contained in:
committed by
Florian BEZANNIER
parent
8209af5726
commit
a293a81277
+14
-33
@@ -62,6 +62,12 @@ info = ""
|
||||
battery_info = ERROR_DIV
|
||||
battery_table = None
|
||||
|
||||
SUMMARY_CARDS = {"Average consumption": {"text": None, "src": "static/images/consumption.svg"},
|
||||
"Average emission": {"text": None, "src": "static/images/pollution.svg"},
|
||||
"Average charge speed": {"text": None, "src": "static/images/battery-charge-line.svg"},
|
||||
"Electricity consumption": {"text": None, "src": "static/images/electricity bill.svg"}
|
||||
}
|
||||
|
||||
|
||||
# pylint: disable=too-many-locals
|
||||
def get_figures(trips: Trips, charging: List[dict]):
|
||||
@@ -115,7 +121,8 @@ def get_figures(trips: Trips, charging: List[dict]):
|
||||
)
|
||||
# consumption_fig
|
||||
consumption_df = DataFrame.from_records(trips.get_long_trips())
|
||||
consumption_fig = px.line(consumption_df, x="date", y="consumption", title='Consumption of the car')
|
||||
consumption_fig = px.histogram(consumption_df, x="date", y="consumption", title='Consumption of the car',
|
||||
histfunc="avg")
|
||||
consumption_fig.update_layout(yaxis_title="Consumption kWh/100Km")
|
||||
|
||||
consumption_fig_by_speed = px.histogram(consumption_df, x="speed", y="consumption_km", histfunc="avg",
|
||||
@@ -143,38 +150,11 @@ def get_figures(trips: Trips, charging: List[dict]):
|
||||
price_kw = 0
|
||||
total_elec = 0
|
||||
|
||||
battery_info = html.Div(children=[
|
||||
html.Tr(
|
||||
[
|
||||
html.Td('Average emission:', rowSpan=2),
|
||||
html.Td("{:.1f} g/km".format(co2_per_km))]),
|
||||
html.Tr(
|
||||
[
|
||||
"{:.1f} g/kWh".format(co2_per_kw),
|
||||
]
|
||||
),
|
||||
html.Tr([
|
||||
html.Td("Average charge speed:", style=PADDING_TOP),
|
||||
html.Td("{:.3f} kW".format(charge_speed))
|
||||
]),
|
||||
html.Tr(html.Td(" ", colSpan=2)),
|
||||
html.Tr([
|
||||
html.Td('Average Price:', rowSpan=2, style=PADDING_TOP),
|
||||
html.Td("{:.2f} {}/100km".format(price_kw * kw_per_km, ElecPrice.currency)),
|
||||
]),
|
||||
html.Tr([
|
||||
"{:.2f} {}/kWh".format(price_kw, ElecPrice.currency),
|
||||
]),
|
||||
html.Tr(html.Td(" ", colSpan=2)),
|
||||
html.Tr([
|
||||
html.Td('Electricity consumption:', rowSpan=2, style=PADDING_TOP),
|
||||
html.Td("{:.0f} kWh".format(total_elec)),
|
||||
]),
|
||||
html.Tr([
|
||||
"{:.0f} {}".format(total_elec * price_kw, ElecPrice.currency),
|
||||
]),
|
||||
])
|
||||
|
||||
SUMMARY_CARDS["Average charge speed"]["text"] = f"{charge_speed:.2f} kW"
|
||||
SUMMARY_CARDS["Average emission"]["text"] = [html.P(f"{co2_per_km:.1f} g/km"), html.P(f"{co2_per_kw:.1f} g/kWh")]
|
||||
SUMMARY_CARDS["Electricity consumption"]["text"] = [f"{total_elec:.0f} kWh", html.Br(), \
|
||||
f"{total_elec * price_kw:.0f} {ElecPrice.currency}"]
|
||||
SUMMARY_CARDS["Average consumption"]["text"] = f"{consumption_df['consumption_km'].mean():.1f} kWh/100km"
|
||||
battery_table = dash_table.DataTable(
|
||||
id='battery-table',
|
||||
sort_action='native',
|
||||
@@ -220,6 +200,7 @@ def get_figures(trips: Trips, charging: List[dict]):
|
||||
consumption_graph_by_temp = html.Div(Graph(style={'display': 'none'}), id="consumption_graph_by_temp")
|
||||
return True
|
||||
|
||||
|
||||
def __calculate_co2_per_kw(charging_data):
|
||||
try:
|
||||
co2_data = charging_data[charging_data["co2"] > 0]
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
x="0px"
|
||||
y="0px"
|
||||
viewBox="0 0 83.599998 100"
|
||||
xml:space="preserve"
|
||||
id="svg22"
|
||||
sodipodi:docname="battery-charge-line.svg"
|
||||
width="83.599998"
|
||||
height="100"
|
||||
inkscape:version="1.0.2 (e86c870879, 2021-01-15, custom)"><metadata
|
||||
id="metadata28"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs26" /><sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1890"
|
||||
inkscape:window-height="1051"
|
||||
id="namedview24"
|
||||
showgrid="false"
|
||||
inkscape:zoom="7.04"
|
||||
inkscape:cx="41.8"
|
||||
inkscape:cy="62.5"
|
||||
inkscape:window-x="30"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg22" /><g
|
||||
id="g16"
|
||||
transform="translate(-8.2)"><g
|
||||
id="g10"><g
|
||||
id="g4"><path
|
||||
d="m 50,84.1 c -15.3,0 -27.8,-12.5 -27.8,-27.8 0,-7.5 2.9,-14.5 8.3,-19.8 0.4,-0.4 1.1,-0.4 1.6,0 0.4,0.4 0.4,1.1 0,1.6 -4.9,4.8 -7.6,11.3 -7.6,18.2 0,14.1 11.5,25.6 25.6,25.6 14.1,0 25.6,-11.5 25.6,-25.6 0,-5.3 -1.6,-10.3 -4.6,-14.6 -0.3,-0.5 -0.2,-1.2 0.3,-1.5 0.5,-0.3 1.2,-0.2 1.5,0.3 3.3,4.7 5,10.2 5,15.9 C 77.8,71.7 65.3,84.1 50,84.1 Z"
|
||||
id="path2" /></g><g
|
||||
id="g8"><path
|
||||
d="M 58,100 H 42 L 41.1,96.9 C 39.8,92.5 36.8,88.8 32.7,86.4 l -0.1,-0.1 c -4.1,-2.4 -8.8,-3.1 -13.3,-2 l -3.1,0.8 -8,-13.8 2.2,-2.3 c 3.2,-3.3 4.9,-7.7 4.9,-12.5 v -0.2 c 0,-4.8 -1.7,-9.2 -4.9,-12.5 l -2.2,-2.3 8,-13.8 3.2,0.8 c 3.8,0.9 7.8,0.6 11.5,-1.1 0.6,-0.2 1.2,0 1.5,0.6 0.2,0.6 0,1.2 -0.6,1.5 -4.1,1.8 -8.7,2.3 -12.9,1.2 l -1.5,-0.4 -6.4,10.8 1.1,1.1 c 3.6,3.7 5.5,8.7 5.5,14.1 v 0.2 c 0,5.3 -1.9,10.3 -5.5,14 l -1.1,1.1 6.3,10.9 1.5,-0.4 c 5,-1.2 10.3,-0.4 14.9,2.2 l 0.1,0.1 c 4.6,2.7 8,6.9 9.4,11.8 l 0.4,1.5 h 12.6 l 0.4,-1.5 C 58,91.3 61.4,87.1 66,84.4 l 0.6,0.9 -0.6,-0.9 h 0.1 C 70.7,81.7 76,80.9 81,82.2 l 1.5,0.4 6.5,-11 -1.1,-1.1 C 84.3,66.8 82.4,61.8 82.4,56.4 v -0.2 c 0,-5.3 1.9,-10.3 5.5,-14 L 89,41.1 82.7,30.2 81.2,30.6 c -1.5,0.4 -3,0.6 -4.5,0.6 0,0 0,0 0,0 -0.6,0 -1.1,-0.5 -1.1,-1.1 0,-0.6 0.5,-1.1 1.1,-1.1 1.4,0 2.7,-0.2 4,-0.5 l 3.1,-0.8 8,13.8 -2.2,2.3 c -3.2,3.3 -4.9,7.7 -4.9,12.5 v 0.2 c 0,4.8 1.7,9.2 4.9,12.5 l 2.2,2.3 -8,13.8 -3.2,-0.8 c -4.4,-1.1 -9.2,-0.4 -13.3,2 l -0.1,0.1 c -4.1,2.4 -7.1,6.1 -8.4,10.5 z"
|
||||
id="path6" /></g></g><g
|
||||
id="g14"><path
|
||||
d="M 41.7,77.1 50,45.3 c 0.2,-0.9 0,-1.8 -0.5,-2.5 -0.6,-0.7 -1.4,-1.2 -2.3,-1.2 H 34.7 L 36.9,0 h 27.3 l -5.5,22.2 c -0.2,0.9 0,1.8 0.5,2.5 0.6,0.7 1.4,1.1 2.3,1.1 h 6.3 c 2.1,0 4.1,1.2 5,3.1 1,1.9 0.8,4.2 -0.5,5.9 z M 37,39.4 h 10.1 c 1.6,0 3.1,0.8 4.1,2 1,1.3 1.3,2.9 0.9,4.4 L 46.7,66.3 70.6,33.5 c 0.8,-1.1 0.9,-2.4 0.3,-3.6 C 70.3,28.7 69.1,28 67.8,28 h -6.3 c -1.6,0 -3.1,-0.7 -4.1,-2 -1,-1.3 -1.3,-2.9 -0.9,-4.4 L 61.3,2.2 H 39 Z"
|
||||
id="path12" /></g></g></svg>
|
||||
|
After Width: | Height: | Size: 3.5 KiB |
@@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
x="0px"
|
||||
y="0px"
|
||||
viewBox="0 0 64.217186 88.793861"
|
||||
enable-background="new 0 0 100 100"
|
||||
xml:space="preserve"
|
||||
id="svg86"
|
||||
sodipodi:docname="consumption.svg"
|
||||
inkscape:version="1.0.2 (e86c870879, 2021-01-15, custom)"
|
||||
width="64.217186"
|
||||
height="88.793861"><metadata
|
||||
id="metadata92"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs90" /><sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1890"
|
||||
inkscape:window-height="1051"
|
||||
id="namedview88"
|
||||
showgrid="false"
|
||||
inkscape:zoom="6.808"
|
||||
inkscape:cx="49.869999"
|
||||
inkscape:cy="36.411015"
|
||||
inkscape:window-x="30"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg86"
|
||||
inkscape:document-rotation="0" /><g
|
||||
id="g105"
|
||||
transform="translate(-17.891814,-5.6031348)"><path
|
||||
d="m 25.861,57.04 c 0.24,0.103 0.489,0.15 0.738,0.15 0.577,0 1.137,-0.267 1.5,-0.751 l 20.5,-27.334 c 0.427,-0.568 0.494,-1.329 0.178,-1.963 C 48.458,26.508 47.81,26.106 47.1,26.106 H 39.064 L 42.116,7.788 C 42.259,6.935 41.799,6.096 41.005,5.756 40.208,5.412 39.286,5.664 38.767,6.357 l -20.5,27.334 c -0.427,0.568 -0.494,1.329 -0.178,1.963 0.319,0.634 0.967,1.036 1.677,1.036 h 8.037 L 24.75,55.007 c -0.143,0.854 0.316,1.692 1.111,2.033 z M 23.516,32.94 37.154,14.758 35,27.673 c -0.092,0.542 0.062,1.099 0.419,1.52 0.355,0.421 0.879,0.663 1.43,0.663 h 6.5 L 29.712,48.038 31.865,35.122 c 0.092,-0.542 -0.062,-1.099 -0.419,-1.52 -0.355,-0.421 -0.879,-0.663 -1.43,-0.663 h -6.5 z"
|
||||
id="path76" /><path
|
||||
d="m 67.659,51.708 c -0.732,-0.732 -1.919,-0.732 -2.651,0 l -7.942,7.947 C 56.048,59.1 54.9,58.758 53.663,58.758 c -3.964,0 -7.191,3.226 -7.191,7.189 0,3.963 3.226,7.189 7.191,7.189 3.962,0 7.189,-3.226 7.189,-7.189 0,-1.362 -0.403,-2.624 -1.064,-3.712 L 67.66,54.36 c 0.731,-0.733 0.731,-1.92 -10e-4,-2.652 z M 53.662,69.385 c -1.897,0 -3.441,-1.542 -3.441,-3.439 0,-1.897 1.544,-3.439 3.441,-3.439 1.897,0 3.439,1.542 3.439,3.439 0,1.897 -1.542,3.439 -3.439,3.439 z"
|
||||
id="path78" /><path
|
||||
d="m 53.662,37.495 c -1.036,0 -1.875,0.839 -1.875,1.875 v 5.317 c 0,1.036 0.839,1.875 1.875,1.875 1.036,0 1.875,-0.839 1.875,-1.875 V 41.34 c 12.123,0.917 21.81,10.607 22.727,22.731 H 74.92 c -1.036,0 -1.875,0.839 -1.875,1.875 0,1.036 0.839,1.875 1.875,1.875 h 3.344 C 77.347,79.945 67.66,89.635 55.537,90.552 v -3.347 c 0,-1.036 -0.839,-1.875 -1.875,-1.875 -1.036,0 -1.875,0.839 -1.875,1.875 v 3.347 C 39.664,89.635 29.974,79.945 29.056,67.821 h 3.346 c 1.036,0 1.875,-0.839 1.875,-1.875 0,-1.036 -0.839,-1.875 -1.875,-1.875 h -5.316 c -1.036,0 -1.875,0.839 -1.875,1.875 0,15.688 12.762,28.451 28.451,28.451 15.685,0 28.447,-12.762 28.447,-28.451 0,-15.689 -12.762,-28.451 -28.447,-28.451 z"
|
||||
id="path80" /></g></svg>
|
||||
|
After Width: | Height: | Size: 3.5 KiB |
@@ -0,0 +1,224 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:ooo="http://xml.openoffice.org/svg/export"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.2"
|
||||
width="27.249998mm"
|
||||
height="37mm"
|
||||
viewBox="0 0 2724.9999 3700"
|
||||
preserveAspectRatio="xMidYMid"
|
||||
fill-rule="evenodd"
|
||||
stroke-width="28.222"
|
||||
stroke-linejoin="round"
|
||||
xml:space="preserve"
|
||||
id="svg77"
|
||||
sodipodi:docname="electricity bill.svg"
|
||||
inkscape:version="1.0.2 (e86c870879, 2021-01-15, custom)"><metadata
|
||||
id="metadata81"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1890"
|
||||
inkscape:window-height="1051"
|
||||
id="namedview79"
|
||||
showgrid="false"
|
||||
inkscape:zoom="6.2927928"
|
||||
inkscape:cx="51.59055"
|
||||
inkscape:cy="42.017758"
|
||||
inkscape:window-x="30"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="g73" />
|
||||
<defs
|
||||
class="ClipPathGroup"
|
||||
id="defs8">
|
||||
<clipPath
|
||||
id="presentation_clip_path"
|
||||
clipPathUnits="userSpaceOnUse">
|
||||
<rect
|
||||
x="0"
|
||||
y="0"
|
||||
width="2730"
|
||||
height="3700"
|
||||
id="rect2" />
|
||||
</clipPath>
|
||||
<clipPath
|
||||
id="presentation_clip_path_shrink"
|
||||
clipPathUnits="userSpaceOnUse">
|
||||
<rect
|
||||
x="2"
|
||||
y="3"
|
||||
width="2725"
|
||||
height="3693"
|
||||
id="rect5" />
|
||||
</clipPath>
|
||||
</defs>
|
||||
<defs
|
||||
class="TextShapeIndex"
|
||||
id="defs12">
|
||||
<g
|
||||
ooo:slide="id1"
|
||||
ooo:id-list="id3"
|
||||
id="g10" />
|
||||
</defs>
|
||||
<defs
|
||||
class="EmbeddedBulletChars"
|
||||
id="defs44">
|
||||
<g
|
||||
id="bullet-char-template-57356"
|
||||
transform="matrix(4.8828125e-4,0,0,-4.8828125e-4,0,0)">
|
||||
<path
|
||||
d="M 580,1141 1163,571 580,0 -4,571 Z"
|
||||
id="path14" />
|
||||
</g>
|
||||
<g
|
||||
id="bullet-char-template-57354"
|
||||
transform="matrix(4.8828125e-4,0,0,-4.8828125e-4,0,0)">
|
||||
<path
|
||||
d="M 8,1128 H 1137 V 0 H 8 Z"
|
||||
id="path17" />
|
||||
</g>
|
||||
<g
|
||||
id="bullet-char-template-10146"
|
||||
transform="matrix(4.8828125e-4,0,0,-4.8828125e-4,0,0)">
|
||||
<path
|
||||
d="M 174,0 602,739 174,1481 1456,739 Z M 1358,739 309,1346 659,739 Z"
|
||||
id="path20" />
|
||||
</g>
|
||||
<g
|
||||
id="bullet-char-template-10132"
|
||||
transform="matrix(4.8828125e-4,0,0,-4.8828125e-4,0,0)">
|
||||
<path
|
||||
d="M 2015,739 1276,0 H 717 l 543,543 H 174 v 393 h 1086 l -543,545 h 557 z"
|
||||
id="path23" />
|
||||
</g>
|
||||
<g
|
||||
id="bullet-char-template-10007"
|
||||
transform="matrix(4.8828125e-4,0,0,-4.8828125e-4,0,0)">
|
||||
<path
|
||||
d="m 0,-2 c -7,16 -16,29 -25,39 l 381,530 c -94,256 -141,385 -141,387 0,25 13,38 40,38 9,0 21,-2 34,-5 21,4 42,12 65,25 l 27,-13 111,-251 280,301 64,-25 24,25 c 21,-10 41,-24 62,-43 C 886,937 835,863 770,784 769,783 710,716 594,584 L 774,223 c 0,-27 -21,-55 -63,-84 l 16,-20 C 717,90 699,76 672,76 641,76 570,178 457,381 L 164,-76 c -22,-34 -53,-51 -92,-51 -42,0 -63,17 -64,51 -7,9 -10,24 -10,44 0,9 1,19 2,30 z"
|
||||
id="path26" />
|
||||
</g>
|
||||
<g
|
||||
id="bullet-char-template-10004"
|
||||
transform="matrix(4.8828125e-4,0,0,-4.8828125e-4,0,0)">
|
||||
<path
|
||||
d="M 285,-33 C 182,-33 111,30 74,156 52,228 41,333 41,471 c 0,78 14,145 41,201 34,71 87,106 158,106 53,0 88,-31 106,-94 l 23,-176 c 8,-64 28,-97 59,-98 l 735,706 c 11,11 33,17 66,17 42,0 63,-15 63,-46 V 965 c 0,-36 -10,-64 -30,-84 L 442,47 C 390,-6 338,-33 285,-33 Z"
|
||||
id="path29" />
|
||||
</g>
|
||||
<g
|
||||
id="bullet-char-template-9679"
|
||||
transform="matrix(4.8828125e-4,0,0,-4.8828125e-4,0,0)">
|
||||
<path
|
||||
d="M 813,0 C 632,0 489,54 383,161 276,268 223,411 223,592 c 0,181 53,324 160,431 106,107 249,161 430,161 179,0 323,-54 432,-161 108,-107 162,-251 162,-431 0,-180 -54,-324 -162,-431 C 1136,54 992,0 813,0 Z"
|
||||
id="path32" />
|
||||
</g>
|
||||
<g
|
||||
id="bullet-char-template-8226"
|
||||
transform="matrix(4.8828125e-4,0,0,-4.8828125e-4,0,0)">
|
||||
<path
|
||||
d="m 346,457 c -73,0 -137,26 -191,78 -54,51 -81,114 -81,188 0,73 27,136 81,188 54,52 118,78 191,78 73,0 134,-26 185,-79 51,-51 77,-114 77,-187 0,-75 -25,-137 -76,-188 -50,-52 -112,-78 -186,-78 z"
|
||||
id="path35" />
|
||||
</g>
|
||||
<g
|
||||
id="bullet-char-template-8211"
|
||||
transform="matrix(4.8828125e-4,0,0,-4.8828125e-4,0,0)">
|
||||
<path
|
||||
d="M -4,459 H 1135 V 606 H -4 Z"
|
||||
id="path38" />
|
||||
</g>
|
||||
<g
|
||||
id="bullet-char-template-61548"
|
||||
transform="matrix(4.8828125e-4,0,0,-4.8828125e-4,0,0)">
|
||||
<path
|
||||
d="m 173,740 c 0,163 58,303 173,419 116,115 255,173 419,173 163,0 302,-58 418,-173 116,-116 174,-256 174,-419 0,-163 -58,-303 -174,-418 C 1067,206 928,148 765,148 601,148 462,206 346,322 231,437 173,577 173,740 Z"
|
||||
id="path41" />
|
||||
</g>
|
||||
</defs>
|
||||
<g
|
||||
id="g49">
|
||||
<g
|
||||
id="id2"
|
||||
class="Master_Slide">
|
||||
<g
|
||||
id="bg-id2"
|
||||
class="Background" />
|
||||
<g
|
||||
id="bo-id2"
|
||||
class="BackgroundObjects" />
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
class="SlideGroup"
|
||||
id="g75">
|
||||
<g
|
||||
id="g73">
|
||||
<g
|
||||
id="container-id1">
|
||||
<g
|
||||
id="id1"
|
||||
class="Slide"
|
||||
clip-path="url(#presentation_clip_path)">
|
||||
<g
|
||||
class="Page"
|
||||
id="g69">
|
||||
<g
|
||||
class="Graphic"
|
||||
id="g67">
|
||||
<title
|
||||
id="title51">electricity cost bill copy
|
||||
</title>
|
||||
<desc
|
||||
id="desc53">Created with Sketch.
|
||||
</desc>
|
||||
<g
|
||||
id="id3">
|
||||
<rect
|
||||
class="BoundingBox"
|
||||
stroke="none"
|
||||
fill="none"
|
||||
x="0"
|
||||
y="0"
|
||||
width="2725"
|
||||
height="4597"
|
||||
id="rect55" />
|
||||
<defs
|
||||
id="defs60">
|
||||
<clipPath
|
||||
id="clip_path_1"
|
||||
clipPathUnits="userSpaceOnUse">
|
||||
<path
|
||||
d="M 0,0 H 2724 V 4596 H 0 Z"
|
||||
id="path57" />
|
||||
</clipPath>
|
||||
</defs>
|
||||
<g
|
||||
clip-path="url(#clip_path_1)"
|
||||
id="g64">
|
||||
<path
|
||||
fill="#000000"
|
||||
stroke="none"
|
||||
d="m 1696,3491 v 160 H 982 V 2879 H 718 V 2556 C 718,2384 618,2250 416,2155 26,1971 0,1579 0,1148 v -79 C 0,940 105,835 234,835 H 558 V 128 C 558,57 615,0 686,0 757,0 815,57 815,128 V 835 H 1830 V 139 c 0,-71 58,-128 128,-128 71,0 129,57 129,128 v 696 h 323 c 130,0 235,105 235,234 v 79 c 0,331 -16,640 -200,848 169,159 273,385 273,635 0,482 -390,872 -872,872 -51,0 -101,-4 -150,-12 z m 150,-67 c 438,0 793,-355 793,-793 0,-439 -355,-794 -793,-794 -438,0 -794,355 -794,794 0,438 356,793 794,793 z m 328,-648 c 0,59 -21,109 -63,152 -42,42 -102,69 -182,81 v 54 c 0,35 -28,64 -63,64 -35,0 -64,-29 -64,-64 v -49 c -52,-4 -102,-13 -149,-27 -30,-9 -56,-20 -79,-31 -22,-11 -32,-38 -22,-61 1,0 1,-1 1,-2 l 35,-77 c 8,-18 29,-26 47,-18 1,0 2,1 3,1 2,1 3,2 5,3 23,12 49,22 76,30 44,13 87,20 129,20 80,0 120,-20 120,-60 0,-21 -11,-37 -34,-47 -23,-10 -60,-21 -110,-32 -56,-12 -102,-25 -140,-39 -37,-13 -69,-35 -96,-66 -26,-30 -40,-71 -40,-122 0,-61 22,-112 66,-156 43,-43 106,-70 188,-79 v -53 c 0,-35 29,-63 64,-63 35,0 63,28 63,63 v 51 c 40,3 79,10 116,21 26,7 50,16 72,27 2,1 4,2 6,3 12,6 17,20 12,32 l -48,115 c -4,10 -15,14 -25,10 0,0 -1,0 -1,0 -4,-2 -7,-4 -9,-5 -61,-29 -120,-43 -178,-43 -41,0 -72,6 -91,18 -18,13 -28,29 -28,48 0,20 11,35 34,45 22,10 59,20 108,30 57,12 103,25 140,39 37,14 69,35 96,65 27,30 41,71 41,122 z"
|
||||
id="path62" />
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 7.3 KiB |
@@ -0,0 +1,77 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
data-name="Layer 2"
|
||||
viewBox="0 0 57.906296 52"
|
||||
x="0px"
|
||||
y="0px"
|
||||
version="1.1"
|
||||
id="svg286"
|
||||
sodipodi:docname="pollution.svg"
|
||||
inkscape:version="1.0.2 (e86c870879, 2021-01-15, custom)"
|
||||
width="57.906296"
|
||||
height="52">
|
||||
<metadata
|
||||
id="metadata292">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs290" />
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1890"
|
||||
inkscape:window-height="1051"
|
||||
id="namedview288"
|
||||
showgrid="false"
|
||||
inkscape:zoom="11"
|
||||
inkscape:cx="29.101087"
|
||||
inkscape:cy="35.550759"
|
||||
inkscape:window-x="30"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg286"
|
||||
inkscape:document-rotation="0" />
|
||||
<title
|
||||
id="title266">12, cloud, smoke, polution, CO2, ecology, enviroment,</title>
|
||||
<path
|
||||
d="m 45.601087,17 h -3.5 A 17,17 0 0 0 8.1010871,17 c 0,0.3 0,0.5 0,0.8 A 12.5,12.5 0 0 0 12.601087,42 h 17.1 a 13,13 0 0 0 19.2,-0.5 12.5,12.5 0 0 0 -3.3,-24.5 z m 2.5,22.7 -0.5,0.3 a 11,11 0 0 1 -16.6,0.3 1,1 0 0 0 -0.7,-0.3 h -17.7 a 10.5,10.5 0 0 1 -3.0999999,-20.5 1,1 0 0 0 0.6999999,-1 c 0,-0.5 -0.1,-1 -0.1,-1.4 a 15,15 0 0 1 30,0 c 0,0.2 0,0.5 0,0.7 V 18 a 1,1 0 0 0 1,1.1 h 4.6 a 10.5,10.5 0 0 1 2.4,20.6 z"
|
||||
id="path268" />
|
||||
<path
|
||||
d="m 49.101087,15 a 4,4 0 1 0 -4,-4 4,4 0 0 0 4,4 z m 0,-6 a 2,2 0 1 1 -2,2 2,2 0 0 1 2,-2 z"
|
||||
id="path270" />
|
||||
<path
|
||||
d="M 4.1010871,8 A 4,4 0 1 0 0.10108706,4 4,4 0 0 0 4.1010871,8 Z m 0,-6 a 2,2 0 1 1 -2,2 2,2 0 0 1 2,-2 z"
|
||||
id="path272" />
|
||||
<path
|
||||
d="m 21.101087,52 a 4,4 0 1 0 -4,-4 4,4 0 0 0 4,4 z m 0,-6 a 2,2 0 1 1 -2,2 2,2 0 0 1 2,-2 z"
|
||||
id="path274" />
|
||||
<path
|
||||
d="m 31.101087,17 a 5,5 0 0 0 -5,5 v 5 a 5,5 0 0 0 10,0 v -5 a 5,5 0 0 0 -5,-5 z m 3,10 a 3,3 0 0 1 -6,0 v -5 a 3,3 0 0 1 6,0 z"
|
||||
id="path276" />
|
||||
<path
|
||||
d="m 20.101087,19 a 3,3 0 0 1 3,3 1,1 0 0 0 2,0 5,5 0 0 0 -10,0 v 5 a 5,5 0 0 0 10,0 1,1 0 0 0 -2,0 3,3 0 0 1 -6,0 v -5 a 3,3 0 0 1 3,-3 z"
|
||||
id="path278" />
|
||||
<path
|
||||
d="m 44.101087,32 h -3.6 l 0.5,-0.5 c 1,-1 2.1,-2 2.1,-3.5 a 3,3 0 0 0 -3,-3 3.2,3.2 0 0 0 -3,3 1,1 0 0 0 2,0 1.2,1.2 0 0 1 1,-1 1,1 0 0 1 1,1 c 0,0.6 -0.7,1.3 -1.5,2.1 l -2.2,2.2 a 1,1 0 0 0 0.7,1.7 h 6 a 1,1 0 0 0 0,-2 z"
|
||||
id="path280" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.0 KiB |
+41
-17
@@ -4,6 +4,7 @@ from typing import List
|
||||
|
||||
import dash_bootstrap_components as dbc
|
||||
from dash.dependencies import Output, Input, MATCH, State
|
||||
from dash.development.base_component import Component
|
||||
from dash.exceptions import PreventUpdate
|
||||
import dash_core_components as dcc
|
||||
import dash_html_components as html
|
||||
@@ -61,9 +62,8 @@ def create_callback(): # noqa: MC0001
|
||||
Output('consumption_fig', 'figure'),
|
||||
Output('consumption_fig_by_speed', 'figure'),
|
||||
Output('consumption_graph_by_temp', 'children'),
|
||||
Output('consumption', 'children'),
|
||||
Output('summary-cards', 'children'),
|
||||
Output('tab_trips_fig', 'children'),
|
||||
Output('tab_battery_fig', 'children'),
|
||||
Output('tab_charge', 'children'),
|
||||
Output('date-slider', 'max'),
|
||||
Output('date-slider', 'step'),
|
||||
@@ -78,11 +78,9 @@ def create_callback(): # noqa: MC0001
|
||||
filtered_trips.append(trip)
|
||||
filtered_chargings = Charging.get_chargings(mini, maxi)
|
||||
figures.get_figures(filtered_trips, filtered_chargings)
|
||||
consumption = "Average consumption: {:.1f} kWh/100km".format(
|
||||
float(figures.consumption_df["consumption_km"].mean()))
|
||||
return figures.trips_map, figures.consumption_fig, figures.consumption_fig_by_speed, \
|
||||
figures.consumption_graph_by_temp, consumption, figures.table_fig, figures.battery_info, \
|
||||
figures.battery_table, max_millis, step, marks
|
||||
figures.consumption_graph_by_temp, create_card(figures.SUMMARY_CARDS), \
|
||||
figures.table_fig, figures.battery_table, max_millis, step, marks
|
||||
|
||||
@dash_app.callback(Output(EMPTY_DIV, "children"),
|
||||
[Input("battery-table", "data_timestamp")],
|
||||
@@ -268,7 +266,7 @@ def update_trips():
|
||||
return
|
||||
# update for slider
|
||||
try:
|
||||
logger.debug("min_date:%s - max_date:%s",min_date, max_date)
|
||||
logger.debug("min_date:%s - max_date:%s", min_date, max_date)
|
||||
min_millis = figures.unix_time_millis(min_date)
|
||||
max_millis = figures.unix_time_millis(max_date)
|
||||
step = (max_millis - min_millis) / 100
|
||||
@@ -280,6 +278,7 @@ def update_trips():
|
||||
logger.debug("position table is probably empty :", exc_info=True)
|
||||
return
|
||||
|
||||
|
||||
def __get_control_tabs():
|
||||
tabs = []
|
||||
for car in myp.vehicles_list:
|
||||
@@ -299,14 +298,35 @@ def __get_control_tabs():
|
||||
return tabs
|
||||
|
||||
|
||||
def create_card(card: dict):
|
||||
res = []
|
||||
for tile, value in card.items():
|
||||
text = value["text"]
|
||||
# if isinstance(text, str):
|
||||
# text = html.H3(text)
|
||||
res.append(html.Div(
|
||||
dbc.Card([
|
||||
html.H4(tile, className="card-title text-center"),
|
||||
dbc.Row([
|
||||
dbc.Col(dbc.CardBody(text, style={"white-space": "nowrap", "font-size": "160%"}),
|
||||
className="text-center"),
|
||||
dbc.Col(dbc.CardImg(src=value.get("src", Component.UNDEFINED), style={"max-height": "7rem"}))
|
||||
],
|
||||
className="align-items-center flex-nowrap")
|
||||
], className="h-100 p-2"),
|
||||
className="col-sm-12 col-md-6 col-lg-3 py-2"
|
||||
))
|
||||
return res
|
||||
|
||||
|
||||
def serve_layout():
|
||||
global cached_layout
|
||||
if cached_layout is None:
|
||||
logger.debug("Create new layout")
|
||||
try:
|
||||
figures.get_figures(trips, chargings)
|
||||
summary_tab = [html.H2(id="consumption",
|
||||
children=figures.info),
|
||||
summary_tab = [dbc.Container(dbc.Row(id="summary-cards",
|
||||
children=create_card(figures.SUMMARY_CARDS)), fluid=True),
|
||||
dcc.Graph(figure=figures.consumption_fig, id="consumption_fig"),
|
||||
dcc.Graph(figure=figures.consumption_fig_by_speed, id="consumption_fig_by_speed"),
|
||||
figures.consumption_graph_by_temp]
|
||||
@@ -323,7 +343,7 @@ def serve_layout():
|
||||
except (IndexError, TypeError, NameError):
|
||||
summary_tab = figures.ERROR_DIV
|
||||
maps = figures.ERROR_DIV
|
||||
logger.warning("Failed to generate figure, there is probably not enough data yet")
|
||||
logger.warning("Failed to generate figure, there is probably not enough data yet", exc_info_debug=True)
|
||||
range_slider = html.Div()
|
||||
data_div = html.Div([
|
||||
range_slider,
|
||||
@@ -347,20 +367,24 @@ def serve_layout():
|
||||
size="xl",
|
||||
)
|
||||
]),
|
||||
dbc.Tab(label="Battery", tab_id="battery", id="tab_battery",
|
||||
children=[html.Div(id="tab_battery_fig", children=[figures.battery_info]),
|
||||
dbc.Tab(label="Charge", tab_id="charge", id="tab_charge",
|
||||
children=[figures.battery_table,
|
||||
dbc.Modal(
|
||||
[
|
||||
dbc.ModalHeader("Charging speed"),
|
||||
dbc.ModalBody(html.Div(id="tab_battery_popup_graph")),
|
||||
dbc.ModalHeader(
|
||||
"Charging speed"),
|
||||
dbc.ModalBody(html.Div(
|
||||
id="tab_battery_popup_graph")),
|
||||
dbc.ModalFooter(
|
||||
dbc.Button("Close", id="tab_battery_popup-close", className="ml-auto")
|
||||
dbc.Button("Close",
|
||||
id="tab_battery_popup-close",
|
||||
className="ml-auto")
|
||||
),
|
||||
],
|
||||
id="tab_battery_popup",
|
||||
size="xl",
|
||||
)]),
|
||||
dbc.Tab(label="Charge", tab_id="charge", id="tab_charge", children=[figures.battery_table]),
|
||||
)
|
||||
]),
|
||||
dbc.Tab(label="Map", tab_id="map", children=[maps]),
|
||||
dbc.Tab(label="Control", tab_id="control", children=dbc.Tabs(id="control-tabs",
|
||||
children=__get_control_tabs()))],
|
||||
|
||||
Reference in New Issue
Block a user