Generate annotations to fill in table text :rtype (list) annotations: list of annotations for each cell of the table.
(self)
| 244 | return all_font_colors |
| 245 | |
| 246 | def make_table_annotations(self): |
| 247 | """ |
| 248 | Generate annotations to fill in table text |
| 249 | |
| 250 | :rtype (list) annotations: list of annotations for each cell of the |
| 251 | table. |
| 252 | """ |
| 253 | all_font_colors = _Table.get_table_font_color(self) |
| 254 | annotations = [] |
| 255 | for n, row in enumerate(self.table_text): |
| 256 | for m, val in enumerate(row): |
| 257 | # Bold text in header and index |
| 258 | format_text = ( |
| 259 | "<b>" + str(val) + "</b>" |
| 260 | if n == 0 or self.index and m < 1 |
| 261 | else str(val) |
| 262 | ) |
| 263 | # Match font color of index to font color of header |
| 264 | font_color = ( |
| 265 | self.font_colors[0] if self.index and m == 0 else all_font_colors[n] |
| 266 | ) |
| 267 | annotations.append( |
| 268 | graph_objs.layout.Annotation( |
| 269 | text=format_text, |
| 270 | x=self.x[m] - self.annotation_offset, |
| 271 | y=self.y[n], |
| 272 | xref="x1", |
| 273 | yref="y1", |
| 274 | align="left", |
| 275 | xanchor="left", |
| 276 | font=dict(color=font_color), |
| 277 | showarrow=False, |
| 278 | ) |
| 279 | ) |
| 280 | return annotations |
no test coverage detected