nicegui: on air not working with ui.charts
Description
Hello,
When trying to launch an application on air (nicegui version 1.3.6, Python 3.10.1) which contains a ui.chart
object, the page does not load because the Highcharts javascript files are not available. The expectation is that on-air instances work with Highchart plots as they do with local instances.
Below is a minimal example which fails:
from nicegui import ui
chart = ui.chart({
'title': False,
'chart': {'type': 'bar'},
'xAxis': {'categories': ['A', 'B']},
'series': [
{'name': 'Alpha', 'data': [0.1, 0.2]},
{'name': 'Beta', 'data': [0.3, 0.4]},
],
}).classes('w-full h-64')
def update():
chart.options['series'][0]['data'] = chart.options['series'][0]['data'][::-1]
chart.update()
ui.button('Update', on_click=update)
ui.run(on_air=True)
The error message of the on-air website in the browser are as follows:
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
/devices/kz51SNxZ/_nicegui/1.3.6/libraries/6fa6d5d3f0b83e88a6a399dccc25b337/highcharts-3d.js:1
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
/devices/kz51SNxZ/_nicegui/1.3.6/libraries/6fa6d5d3f0b83e88a6a399dccc25b337/highcharts.js:1
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
/devices/kz51SNxZ/_nicegui/1.3.6/libraries/6fa6d5d3f0b83e88a6a399dccc25b337/highcharts-more.js:1
When trying to add additional resources like extras=['exporting']
, these files will also not be available.
It seems like the CDN of the on-air instance does not publish the Highcharts javascript files. Somewhat related (but possibly a separate issue) is that files published with app.add_static_file(s)
are also not available with on-air instances.
Thank you
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 15 (8 by maintainers)
Just noticed that release 1.3.9 is already there. I can confirm that the minimal example now works correctly.
Thank you!
I’ve already spend the morning on this and have some clue about whats going on. I hope to fix it tomorrow and create a pull request which we could release in 1.3.7.