def toppage(): return dbc.Container([ dbc.Row([ dcc.DatePickerRange(id='toppage-date-picker-range', min_date_allowed=dt(2020, 4, 30), initial_visible_month=dt.today(), start_date=datetime.date(2020, 4, 30), end_date=datetime.date(dt.now().year, dt.now().month, dt.now().day)), wp.dbc_top_title("Dashboard top") ], className="h-30"), dcc.Loading(id="top-loading", children=[html.Div(id="top_dashoboard")]) ], style={"height": "90vh"}, fluid=True)
def return_analytics(): return dbc.Container([ dbc.Row([ dcc.DatePickerRange(id='return-analytics-date-picker-range', min_date_allowed=dt(2019, 12, 1), initial_visible_month=dt.today(), start_date=datetime.date(2020, 4, 30), end_date=datetime.date(dt.now().year, dt.now().month, dt.now().day)), wp.dbc_top_title("return analytics") ], className="h-30"), dcc.Loading(id="return-analytics-loading", children=[html.Div(id="return_analytics")]) ], style={"height": "90vh"}, fluid=True)
def race_info(): return dbc.Container([ dbc.Row([ dcc.DatePickerSingle(id='raceinfo-date-picker-single', min_date_allowed=dt(2019, 12, 1), initial_visible_month=dt.today(), date=datetime.date(dt.now().year, dt.now().month, dt.now().day)), dcc.Dropdown(id="raceinfo-dropdown-keibajo", options=[], value=""), dcc.Dropdown(id="raceinfo-dropdown-raceid", options=[], value=""), wp.dbc_top_title("race info") ], className="h-30"), dcc.Loading(id="race-info-loading", children=[html.Div(id="raceinfo-race-detail")]) ], style={"height": "90vh"}, fluid=True)
def graph_example(): fig01 = gp.simple_line() fig02 = gp.line_with_column_encoding_color() fig03 = gp.label_lines_with_annotations() fig04 = gp.filled_line() fig05 = gp.bar_chart() fig06 = gp.customized_bar_chart() fig07 = gp.facetted_subplots() fig08 = gp.basic_bar_chart_with_plotly() fig09 = gp.grouped_bar_chart() fig10 = gp.stacked_bar_chart() fig11 = gp.bar_chart_with_hover_text() fig12 = gp.bar_chart_with_direct_labels() fig13 = gp.controlling_text_fontsize_with_uniformtext() fig14 = gp.pie_chart() fig15 = gp.buble_chart() fig16 = gp.basic_dot_plot() fig17 = gp.styled_categorical_dot_plot() fig18 = gp.basic_horizontal_bar_chart() fig19 = gp.color_palette_for_bar_chart() fig20 = gp.bar_chart_with_line_plot() fig21 = gp.sunburst_of_a_rectangular() fig22 = gp.sankey_diagram() fig23 = gp.treemap() fig24 = gp.bar_chart_with_error_bars() fig25 = gp.display_the_underlying_data() fig26 = gp.choosing_the_algorithm() fig27 = gp.difference_between_quartile_algorithms() fig28 = gp.basic_horizontal_box_plot() fig29 = gp.grouped_box_plot() fig30 = gp.rainbow_box_plot() return \ dbc.Container([ dbc.Row([ wp.dbc_top_title("グラフサンプル") ],className="h-30"), dbc.Row([ wp.dbc_title("simple_line", 4), wp.dbc_title("line_with_column_encoding_color", 4), wp.dbc_title("label_lines_with_annotations", 4), ], className="h-8"), dbc.Row([ wp.dbc_graph("fig01", 4, fig01), wp.dbc_graph("fig02", 4, fig02), wp.dbc_graph("fig03", 4, fig03), ], className="h-50"), dbc.Row([ wp.dbc_title("filled_line", 4), wp.dbc_title("bar_chart", 4), wp.dbc_title("customized_bar_chart", 4), ], className="h-8"), dbc.Row([ wp.dbc_graph("fig04", 4, fig04), wp.dbc_graph("fig05", 4, fig05), wp.dbc_graph("fig06", 4, fig06), ], className="h-50"), dbc.Row([ wp.dbc_title("facetted_subplots", 4), wp.dbc_title("basic_bar_chart_with_plotly", 4), wp.dbc_title("grouped_bar_chart", 4), ], className="h-8"), dbc.Row([ wp.dbc_graph("fig07", 4, fig07), wp.dbc_graph("fig08", 4, fig08), wp.dbc_graph("fig09", 4, fig09), ], className="h-50"), dbc.Row([ wp.dbc_title("stacked_bar_chart", 4), wp.dbc_title("bar_chart_with_hover_text", 4), wp.dbc_title("bar_chart_with_direct_labels", 4), ], className="h-8"), dbc.Row([ wp.dbc_graph("fig10", 4, fig10), wp.dbc_graph("fig11", 4, fig11), wp.dbc_graph("fig12", 4, fig12), ], className="h-50"), dbc.Row([ wp.dbc_title("controlling_text_fontsize_with_uniformtext", 4), wp.dbc_title("pie_chart", 4), wp.dbc_title("buble_chart", 4), ], className="h-8"), dbc.Row([ wp.dbc_graph("fig13", 4, fig13), wp.dbc_graph("fig14", 4, fig14), wp.dbc_graph("fig15", 4, fig15), ], className="h-50"), dbc.Row([ wp.dbc_title("basic_dot_plot", 4), wp.dbc_title("styled_categorical_dot_plot", 4), wp.dbc_title("basic_horizontal_bar_chart", 4), ], className="h-8"), dbc.Row([ wp.dbc_graph("fig16", 4, fig16), wp.dbc_graph("fig17", 4, fig17), wp.dbc_graph("fig18", 4, fig18), ], className="h-50"), dbc.Row([ wp.dbc_title("color_palette_for_bar_chart", 4), wp.dbc_title("bar_chart_with_line_plot", 4), wp.dbc_title("sunburst_of_a_rectangular", 4), ], className="h-8"), dbc.Row([ wp.dbc_graph("fig19", 4, fig19), wp.dbc_graph("fig20", 4, fig20), wp.dbc_graph("fig21", 4, fig21), ], className="h-50"), dbc.Row([ wp.dbc_title("sankey_diagram", 4), wp.dbc_title("treemap", 4), wp.dbc_title("bar_chart_with_error_bars", 4), ], className="h-8"), dbc.Row([ wp.dbc_graph("fig22", 4, fig22), wp.dbc_graph("fig23", 4, fig23), wp.dbc_graph("fig24", 4, fig24), ], className="h-50"), dbc.Row([ wp.dbc_title("display_the_underlying_data", 4), wp.dbc_title("choosing_the_algorithm", 4), wp.dbc_title("difference_between_quartile_algorithms", 4), ], className="h-8"), dbc.Row([ wp.dbc_graph("fig25", 4, fig25), wp.dbc_graph("fig26", 4, fig26), wp.dbc_graph("fig27", 4, fig27), ], className="h-50"), dbc.Row([ wp.dbc_title("basic_horizontal_box_plot", 4), wp.dbc_title("grouped_box_plot", 4), wp.dbc_title("rainbow_box_plot", 4), ], className="h-8"), dbc.Row([ wp.dbc_graph("fig28", 4, fig28), wp.dbc_graph("fig29", 4, fig29), wp.dbc_graph("fig30", 4, fig30), ], className="h-50"), ], style={"height": "90vh"}, fluid=True )
def race_trend(): race_df = GetData.get_race_data_real().query("データ区分 == '7'") raceuma_df = GetData.get_raceuma_data_real().query("データ区分 == '7'") raceuma_df.loc[:, "競走馬コード"] = raceuma_df.apply(lambda x : str(x["競走コード"]) + str(x["馬番"]).zfill(2), axis=1) bet_df = GetData.get_bet_data_real() haraimodoshi_dict = GetData.get_haraimodoshi_dict_real() if len(race_df.index) == 0 or len(raceuma_df.index) == 0: return html.P("no data") # 得点1位着順 fig1 = wp.cp_pie_chart_score_1(raceuma_df) # 単勝回収率 fig2_df = raceuma_df[raceuma_df["馬券評価順位"] == 1].copy() fig2_value = fig2_df["単勝配当"].mean() fig2_reference = 0 fig2 = gp.add_steps_threshold_anda_delta(fig2_value, fig2_reference) # 複勝回収率 fig3_df = raceuma_df[raceuma_df["馬券評価順位"] == 1].copy() fig3_value = fig3_df["複勝配当"].mean() fig3_reference = 0 fig3 = gp.add_steps_threshold_anda_delta(fig3_value, fig3_reference) # 1番人気 fig4 = wp.cp_pie_chart_ninki_1(raceuma_df) # 単勝回収率 fig5_df = raceuma_df[raceuma_df["単勝人気"] == 1].copy() fig5_value = fig5_df["単勝配当"].mean() fig5_reference = 0 fig5 = gp.add_steps_threshold_anda_delta(fig5_value, fig5_reference) # 複勝回収率 fig6_df = raceuma_df[raceuma_df["単勝人気"] == 1].copy() fig6_value = fig6_df["複勝配当"].mean() fig6_reference = 0 fig6 = gp.add_steps_threshold_anda_delta(fig6_value, fig6_reference) # 場所別単複回収率・的中率 fig7 = wp.cp_multiple_line_and_bar_chart_place_tanpuku_return(race_df, raceuma_df) if len(bet_df.index) != 0: # 場所別馬券回収率・的中率 fig8 = wp.cp_multiple_line_and_bar_chart_place_bet_return(bet_df) # 券種別結果 summary_bet_df = cd.get_summary_bet_df(bet_df) fig9 = wp.cp_simple_waterfall_chart_balance_change(summary_bet_df) else: fig8 = "" fig9 = "" # 単勝配当分布 #fig10 = wp.cp_pie_chart_tansho_dist(haraimodoshi_dict) # 複勝配当分布 #fig11 = wp.cp_pie_chart_fukusho_dist(haraimodoshi_dict) # 馬連配当分布 #fig12 = wp.cp_pie_chart_umaren_dist(haraimodoshi_dict) # 馬単配当分布 #fig13 = wp.cp_pie_chart_umatan_dist(haraimodoshi_dict) # ワイド配当分布 #fig14 = wp.cp_pie_chart_wide_dist(haraimodoshi_dict) # 三連複配当分布 #fig15 = wp.cp_pie_chart_sanrenpuku_dist(haraimodoshi_dict) # 馬連的中1 fig20 = wp.cp_stacked_funnel_plot_umaren_1(race_df, raceuma_df, haraimodoshi_dict) # 馬連的中2 fig21 = wp.cp_stacked_funnel_plot_umaren_2(race_df, raceuma_df, haraimodoshi_dict) # 馬単的中1 fig22 = wp.cp_stacked_funnel_plot_umatan_1(race_df, raceuma_df, haraimodoshi_dict) # 馬単的中2 fig23 = wp.cp_stacked_funnel_plot_umatan_2(race_df, raceuma_df, haraimodoshi_dict) # 馬単的中3 fig24 = wp.cp_stacked_funnel_plot_umatan_3(race_df, raceuma_df, haraimodoshi_dict) # ワイド的中1 fig25 = wp.cp_stacked_funnel_plot_wide_1(race_df, raceuma_df, haraimodoshi_dict) return dcc.Loading(id="racetrend-loading", children=[ dbc.Container([ dbc.Row([ wp.dbc_top_title("todays race trend") ], className="h-30"), dbc.Row([ wp.dbc_graph("fig1", 2, fig1, "得点1位着順", 130), wp.dbc_graph("fig2", 2, fig2, "単勝回収率", 130), wp.dbc_graph("fig3", 2, fig3, "複勝回収率", 130), wp.dbc_graph("fig4", 2, fig4, "1番人気", 130), wp.dbc_graph("fig5", 2, fig5, "単勝回収率", 130), wp.dbc_graph("fig6", 2, fig6, "複勝回収率", 130), ], className="h-20", no_gutters=True), # dbc.Row([ # wp.dbc_graph("fig10", 2, fig10, "単勝配当分布", 200), # wp.dbc_graph("fig11", 2, fig11, "複勝配当分布", 200), # wp.dbc_graph("fig12", 2, fig12, "馬連配当分布", 200), # wp.dbc_graph("fig13", 2, fig13, "馬単配当分布", 200), # wp.dbc_graph("fig14", 2, fig14, "ワイド配当分布", 200), # wp.dbc_graph("fig15", 2, fig15, "三連複配当分布", 200), # ], className="h-20", no_gutters=True), dbc.Row([ wp.dbc_graph("fig7", 4, fig7, "場所別単複回収率・的中率", 300), wp.dbc_graph("fig8", 4, fig8, "場所別馬券回収率・的中率", 300), wp.dbc_graph("fig9", 4, fig9, "券種別結果", 300), ], className="h-30", no_gutters=True), dbc.Row([ wp.dbc_graph("fig20", 2, fig20, "馬連的中1", 400), wp.dbc_graph("fig21", 2, fig21, "馬連的中2", 400), wp.dbc_graph("fig22", 2, fig22, "馬単的中1", 400), wp.dbc_graph("fig23", 2, fig23, "馬単的中2", 400), wp.dbc_graph("fig24", 2, fig24, "馬単的中3", 400), wp.dbc_graph("fig25", 2, fig25, "ワイド的中1", 400), ], className="h-30", no_gutters=True), ], style={"height": "90vh"}, fluid=True )])