@@ -18,7 +18,7 @@ def chart(bars_count):
18
18
bars_count = 1
19
19
20
20
data = {"days" : [], "bugs" : [], "costs" : []}
21
- for i in range (1 , bars_count + 1 ):
21
+ for i in range (1 , bars_count + 1 ):
22
22
data ['days' ].append (i )
23
23
data ['bugs' ].append (random .randint (1 ,100 ))
24
24
data ['costs' ].append (random .uniform (1.00 , 1000.00 ))
@@ -33,6 +33,7 @@ def chart(bars_count):
33
33
34
34
35
35
def create_hover_tool ():
36
+ """Generates the HTML for the Bokeh's hover data tool on our graph."""
36
37
hover_html = """
37
38
<div>
38
39
<span class="hover-tooltip">$x</span>
@@ -41,18 +42,17 @@ def create_hover_tool():
41
42
<span class="hover-tooltip">@bugs bugs</span>
42
43
</div>
43
44
<div>
44
- <span class="hover-tooltip">$@cost {0.00}</span>
45
+ <span class="hover-tooltip">$@costs {0.00}</span>
45
46
</div>
46
47
"""
47
48
return HoverTool (tooltips = hover_html )
48
49
49
50
50
51
def create_bar_chart (data , title , x_name , y_name , hover_tool = None ,
51
52
width = 1200 , height = 300 ):
52
- """
53
- Creates a bar chart plot with the exact styling for the centcom
54
- dashboard. Pass in data as a dictionary, desired plot title,
55
- name of x axis, y axis and the hover tool HTML.
53
+ """Creates a bar chart plot with the exact styling for the centcom
54
+ dashboard. Pass in data as a dictionary, desired plot title,
55
+ name of x axis, y axis and the hover tool HTML.
56
56
"""
57
57
source = ColumnDataSource (data )
58
58
xdr = FactorRange (factors = data [x_name ])
@@ -77,21 +77,13 @@ def create_bar_chart(data, title, x_name, y_name, hover_tool=None,
77
77
plot .add_layout (Grid (dimension = 0 , ticker = xaxis .ticker ))
78
78
plot .add_layout (Grid (dimension = 1 , ticker = yaxis .ticker ))
79
79
plot .toolbar .logo = None
80
- plot .title .text_color = "white"
81
- plot .background_fill_alpha = 0.05
82
- plot .border_fill_alpha = 0
83
80
plot .min_border_top = 0
84
- plot .min_border_bottom = 0
85
81
plot .xgrid .grid_line_color = None
86
82
plot .ygrid .grid_line_color = "#999999"
87
- plot .yaxis .axis_label_text_color = "white"
88
- plot .yaxis .major_label_text_color = "white"
89
- plot .yaxis .axis_label = None
83
+ plot .yaxis .axis_label = "Bugs found"
90
84
plot .ygrid .grid_line_alpha = 0.1
91
- plot .xaxis .axis_label_text_color = "white"
92
- plot .xaxis .major_label_text_color = "white"
93
- plot .xaxis .axis_label = None
94
- plot .xaxis .major_label_orientation = .785
85
+ plot .xaxis .axis_label = "Days after app deployment"
86
+ plot .xaxis .major_label_orientation = 1
95
87
return plot
96
88
97
89
0 commit comments