| 735 | |
| 736 | @property |
| 737 | def displayHTML(self): |
| 738 | import inspect |
| 739 | |
| 740 | if self._displayHTML is None: |
| 741 | for frame in inspect.getouterframes(inspect.currentframe()): |
| 742 | global_names = set(frame.frame.f_globals) |
| 743 | # Check for displayHTML plus a few others to reduce chance of a false |
| 744 | # hit. |
| 745 | if all(v in global_names for v in ["displayHTML", "display", "spark"]): |
| 746 | self._displayHTML = frame.frame.f_globals["displayHTML"] |
| 747 | break |
| 748 | |
| 749 | if self._displayHTML is None: |
| 750 | raise EnvironmentError( |
| 751 | """ |
| 752 | Unable to detect the Databricks displayHTML function. The 'databricks' renderer is only |
| 753 | supported when called from within the Databricks notebook environment.""" |
| 754 | ) |
| 755 | |
| 756 | return self._displayHTML |
| 757 | |
| 758 | def render(self, fig_dict): |
| 759 | from plotly.io import to_html |