-
Notifications
You must be signed in to change notification settings - Fork 0
/
figure_styles.py
78 lines (74 loc) · 1.83 KB
/
figure_styles.py
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import copy
from nba_data import team_colors, table_cols
center_style = {'textAlign': 'center'}
table_params = dict(
style_table = {
'overflowX': 'scroll',
'maxWidth': '80%',
'minWidth': '40%'
},
style_header = {
'backgroundColor': '#D3D3D3',
'fontWeight': 'bold',
'border': '1px solid black'
},
style_cell = {
'font-family':'sans-serif',
'backgroundColor': '#E6E6E6',
'textAlign': 'center'
},
fixed_columns={
'headers': True,
'data': 2
},
style_data_conditional=[{
'if': {
'column_id': 'Team',
'filter_query': '{Team} contains "' + team + '"'
},
'backgroundColor': background_color,
'border': '2px solid ' + trim_color,
'color': 'white'
} for team, background_color, trim_color in zip(team_colors.keys(),
[team_colors[d][0] for d in team_colors],
[team_colors[d][1] for d in team_colors])] + [{
'if': {
'filter_query': '{Difference} < 0.0',
'column_id': 'Difference'
},
'color': 'red'
},
{
'if': {
'filter_query': '{Difference} > 0.0',
'column_id': 'Difference'
},
'color': 'green'
}],
style_cell_conditional=[{
'if': {
'column_id': 'Record'
},
'width': '75px'
},
{
'if': {
'column_id': 'Rank'
},
'width': '55px'
}] + [{
'if': {
'column_id': col
},
'height': 31
} for col in table_cols[2:]
]
)
conf_table_params = copy.deepcopy(table_params)
conf_table_params['style_data_conditional'].append({
'if': {
'filter_query': '{Rank} < 9',
'column_id': 'Rank'
},
'fontWeight': 'bold'
})