spotify / chartify

Python library that makes it easy for data scientists to create charts.
Apache License 2.0
3.54k stars 324 forks source link

"Bokeh was not loaded in time" #126

Open githubuser441 opened 3 years ago

githubuser441 commented 3 years ago

Running the following chartify code: import chartify data = chartify.examples.example_data() price_by_date = ( data.groupby('date')['total_price'].sum() .reset_index() # Move 'date' from index to column ) print(price_by_date.head()) ch = chartify.Chart(blank_labels=True, x_axis_type='datetime') ch.set_title("Line charts") ch.set_subtitle("Plot two numeric values connected by an ordered line.") ch.plot.line(

Data must be sorted by x column

data_frame=price_by_date.sort_values('date'),
x_column='date',
y_column='total_price')

ch.save('test.svg', 'svg')

Returns the error: Traceback (most recent call last): File "c:\Users\User12\Documents\test-script.py", line 16, in <module> ch.save('test.svg', 'svg') File "C:\Users\User12\AppData\Local\Programs\Python\Python39\lib\site-packages\chartify\_core\chart.py", line 415, in save image = self._figure_to_svg() File "C:\Users\User12\AppData\Local\Programs\Python\Python39\lib\site-packages\chartify\_core\chart.py", line 480, in wrapper return f(self, *args, **kwargs) File "C:\Users\User12\AppData\Local\Programs\Python\Python39\lib\site-packages\chartify\_core\chart.py", line 503, in _figure_to_svg wait_until_render_complete(driver, 10) File "C:\Users\User12\AppData\Local\Programs\Python\Python39\lib\site-packages\bokeh\io\export.py", line 330, in wait_until_render_complete raise RuntimeError('Bokeh was not loaded in time. Something may have gone wrong.') from e RuntimeError: Bokeh was not loaded in time. Something may have gone wrong.

VishalGawade1 commented 1 month ago

Hello @tjofas ,

I would like to contribute on this isssue. A potential fix could involve increasing the wait time or ensuring Bokeh is fully loaded before rendering the SVG. Let me know if that works!