Extracts the HTML from a SeleniumBase-generated chart. @Params chart_name - If creating multiple charts at the same time, use this to select the one you wish to use.
(self, chart_name=None)
| 13354 | time.sleep(0.1) |
| 13355 | |
| 13356 | def extract_chart(self, chart_name=None): |
| 13357 | """Extracts the HTML from a SeleniumBase-generated chart. |
| 13358 | @Params |
| 13359 | chart_name - If creating multiple charts at the same time, |
| 13360 | use this to select the one you wish to use.""" |
| 13361 | if not chart_name: |
| 13362 | chart_name = "default" |
| 13363 | if chart_name not in self._chart_data: |
| 13364 | raise Exception("Chart {%s} does not exist!" % chart_name) |
| 13365 | the_html = "" |
| 13366 | for chart_data_point in self._chart_data[chart_name]: |
| 13367 | the_html += chart_data_point |
| 13368 | the_html += """ |
| 13369 | ] |
| 13370 | }] |
| 13371 | }); |
| 13372 | </script> |
| 13373 | """ |
| 13374 | axis = "xAxis: {\n" |
| 13375 | axis += " labels: {\n" |
| 13376 | axis += " useHTML: true,\n" |
| 13377 | axis += " style: {\n" |
| 13378 | axis += " fontSize: '14px',\n" |
| 13379 | axis += " },\n" |
| 13380 | axis += " },\n" |
| 13381 | axis += "categories: [" |
| 13382 | for label in self._chart_label[chart_name]: |
| 13383 | axis += "'%s'," % label |
| 13384 | axis += "], crosshair: false}," |
| 13385 | the_html = the_html.replace("xAxis: { },", axis) |
| 13386 | self._chart_xcount += 1 |
| 13387 | the_html = the_html.replace( |
| 13388 | "chartcontainer_num_", "chartcontainer_%s_" % self._chart_xcount |
| 13389 | ) |
| 13390 | return the_html |
| 13391 | |
| 13392 | ############ |
| 13393 |
no outgoing calls