mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/cief-dashboard.git
synced 2026-08-19 04:24:13 +00:00
116 lines
4.1 KiB
Python
116 lines
4.1 KiB
Python
from app import *
|
|
|
|
# layout
|
|
layout = html.Div([
|
|
html.H1('Summery data'),
|
|
dbc.Tabs([
|
|
dbc.Tab(dcc.Graph(id='output-volume_day'), label="Day"),
|
|
dbc.Tab(dcc.Graph(id='output-volume_month'), label="Month"),
|
|
dbc.Tab(dcc.Graph(id='output-volume_year'), label="Year"),
|
|
dbc.Tab(dcc.Graph(id='output-volume_quarter'), label="Quarter"),
|
|
dbc.Tab(dcc.Graph(id='output-volume_week'), label="Week"),
|
|
dbc.Tab(dcc.Graph(id='output-volume_weekday'), label="Weekday")
|
|
]),
|
|
dbc.Tabs([
|
|
dbc.Tab(dcc.Graph(id='output-amount_day'), label="Day"),
|
|
dbc.Tab(dcc.Graph(id='output-amount_month'), label="Month"),
|
|
dbc.Tab(dcc.Graph(id='output-amount_year'), label="Year"),
|
|
dbc.Tab(dcc.Graph(id='output-amount_quarter'), label="Quarter"),
|
|
dbc.Tab(dcc.Graph(id='output-amount_week'), label="Week"),
|
|
dbc.Tab(dcc.Graph(id='output-amount_weekday'), label="Weekday")
|
|
]),
|
|
dbc.Tabs([
|
|
dbc.Tab(dcc.Graph(id='output-booking_rate'), label="Booking rate"),
|
|
dbc.Tab(dcc.Graph(id='output-n_transfer'), label="Number of transfer"),
|
|
dbc.Tab(dcc.Graph(id='output-ctn'), label="CTN"),
|
|
dbc.Tab(dcc.Graph(id='output-delivery'), label="Delivery"),
|
|
]),
|
|
dbc.Row([
|
|
dcc.Graph(id='output-place')
|
|
])
|
|
])
|
|
|
|
@app.callback(
|
|
[Output('output-booking_rate', 'figure'),
|
|
Output('output-n_transfer', 'figure'),
|
|
Output('output-ctn', 'figure'),
|
|
Output('output-delivery', 'figure'),
|
|
Output('output-place', 'figure'),
|
|
|
|
Output('output-volume_day', 'figure'),
|
|
Output('output-volume_month', 'figure'),
|
|
Output('output-volume_year', 'figure'),
|
|
Output('output-volume_quarter', 'figure'),
|
|
Output('output-volume_week', 'figure'),
|
|
Output('output-volume_weekday', 'figure'),
|
|
|
|
Output('output-amount_day', 'figure'),
|
|
Output('output-amount_month', 'figure'),
|
|
Output('output-amount_year', 'figure'),
|
|
Output('output-amount_quarter', 'figure'),
|
|
Output('output-amount_week', 'figure'),
|
|
Output('output-amount_weekday', 'figure')],
|
|
|
|
Input('data-summery', 'data'))
|
|
def update_figure(data):
|
|
cbms=data.pop('cbms')
|
|
x1_x2s=data.pop('x1_x2s')
|
|
to_df(data)
|
|
|
|
# cbm
|
|
to_df(cbms)
|
|
fig_cbms=[]
|
|
for i in range(len(cbms)):
|
|
fig_cbms.append(px.line(cbms[i], x='Date', y='CBM', title='Period CBM'))
|
|
update_theme(fig_cbms[i])
|
|
|
|
# x1 x2
|
|
to_df(x1_x2s)
|
|
fig_x1_x2s=[]
|
|
for i in range(len(x1_x2s)):
|
|
fig_x1_x2s.append(px.line(x1_x2s[i], x='Date', y='value', color='variable', title='Period Number of transfer'))
|
|
fig_x1_x2s[i].update_yaxes(title_text='RM')
|
|
update_theme(fig_x1_x2s[i])
|
|
|
|
# booking rate
|
|
booking_rate=data['booking_rate']
|
|
fig_rate=px.line(booking_rate, x='Date',y='Booking rate', title='Daily average Booking Rate')
|
|
update_theme(fig_rate)
|
|
|
|
# number of transfer
|
|
n_transfer=data['n_transfer']
|
|
fig_count=px.line(n_transfer, x='Date',y='Number of transfer', title='Monthly number of transfer')
|
|
update_theme(fig_count)
|
|
|
|
# ctn
|
|
ctn=data['ctn']
|
|
fig_ctn=px.line(ctn, x='Date',y='CTN', title='Monthly CTN')
|
|
update_theme(fig_ctn)
|
|
|
|
# place
|
|
place=data['place']
|
|
fig_place = px.scatter_mapbox(
|
|
place, lat="Latitude", lon="Longitude",
|
|
title='CBM in Malaysia',
|
|
hover_name="CBM by place", hover_data=["Place name","State name",'CBM by place'],
|
|
size='CBM by place',color='State name',
|
|
color_discrete_sequence=px.colors.diverging.Portland,
|
|
size_max=80, zoom=6,
|
|
center={'lat':3.4339, 'lon':102.1543}
|
|
)
|
|
fig_place.update_layout(
|
|
mapbox_style="stamen-terrain",
|
|
margin={"r":0,"t":0,"l":0,"b":0},
|
|
)
|
|
update_theme(fig_place)
|
|
|
|
# delivery time
|
|
delivery=data['delivery']
|
|
fig_delivery=px.line(delivery, x="Date",y="value",color="variable")
|
|
update_theme(fig_delivery)
|
|
|
|
# save
|
|
figs=[fig_rate, fig_count, fig_ctn, fig_delivery, fig_place]
|
|
figs=figs+fig_cbms+fig_x1_x2s
|
|
return(figs)
|