@@ -161,18 +161,27 @@ def create_grouped_bar_charts(groups: list[ExplicitGroup]) -> list[BenchmarkChar
161
161
if height > max_height :
162
162
max_height = height
163
163
164
- ax .text (rect .get_x () + rect .get_width ()/ 2. , height + 2 ,
164
+ ax .text (rect .get_x () + rect .get_width ()/ 2. , height + 1 ,
165
165
f'{ res .value :.1f} ' ,
166
166
ha = 'center' , va = 'bottom' , fontsize = 9 )
167
167
168
168
tooltip_labels = [
169
+ f"Date: { res .date .strftime ('%Y-%m-%d %H:%M:%S' )} \n "
169
170
f"Run: { run } \n "
170
171
f"Label: { res .label } \n "
171
172
f"Value: { res .value :.2f} { res .unit } \n "
173
+ f"Stddev: { res .stddev :.2f} { res .unit } \n "
172
174
]
173
175
tooltip = mpld3 .plugins .LineHTMLTooltip (rect , tooltip_labels , css = tooltip_css ())
174
176
mpld3 .plugins .connect (ax .figure , tooltip )
175
177
178
+ # normally we'd just set legend to be outside
179
+ # the chart, but this is not supported by mpld3.
180
+ # instead, we adjust the y axis to account for
181
+ # the height of the bars.
182
+ legend_height = len (group .runs ) * 0.1
183
+ ax .set_ylim (0 , max_height * (1 + legend_height ))
184
+
176
185
ax .set_xticks ([])
177
186
ax .grid (True , axis = 'y' , alpha = 0.2 )
178
187
ax .set_ylabel (f"Value ({ group .metadata .unit } )" )
@@ -190,7 +199,7 @@ def create_grouped_bar_charts(groups: list[ExplicitGroup]) -> list[BenchmarkChar
190
199
# this is a hack to get labels to show above the legend
191
200
# we normalize the idx to transAxes transform and offset it a little.
192
201
x_norm = (idx + 0.3 - ax .get_xlim ()[0 ]) / (ax .get_xlim ()[1 ] - ax .get_xlim ()[0 ])
193
- ax .text (x_norm , 1.00 , label ,
202
+ ax .text (x_norm , 1.03 , label ,
194
203
transform = ax .transAxes ,
195
204
color = '#666666' )
196
205
0 commit comments