1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| import dash import dash_table
app = dash.Dash(__name__)
app.layout = dash_table.DataTable( columns=[ {'name':'No.', 'id':'number'}, {'name':'地域', 'id':'area'}, {'name':'梅雨入り', 'id':'tsuyuiri'} ], data=[ {'number':0, 'area':'沖縄地方', 'tsuyuiri':'5/17'}, {'number':1, 'area':'九州南部', 'tsuyuiri':'5/31'}, {'number':2, 'area':'九州北部', 'tsuyuiri':'6/25'}, {'number':3, 'area':'四国地方', 'tsuyuiri':'6/27'}, {'number':4, 'area':'中国地方', 'tsuyuiri':'6/27'}, {'number':5, 'area':'近畿地方', 'tsuyuiri':'6/28'} ],
style_cell_conditional=[ { 'if':{'column_id':'number'}, 'fontSize':16, 'backgroundColor':'#FFEEE0' } ],
style_header_conditional=[ {'if':{'column_id':'area'}, 'textAlign':'center', 'width':120}, {'if':{'column_id':'tsuyuiri'}, 'backgroundColor':'#FBFFB9'} ],
style_data_conditional=[ {'if':{'row_index':'odd'}, 'backgroundColor':'#FBFFB9'}, { 'if':{'column_id':'tsuyuiri', 'filter_query':'{number} > 3'}, 'backgroundColor':'#41D3B0' } ], )
if __name__ == '__main__': app.run_server(debug=True)
|