How to integrate Apache ECharts in NiceGUI, but slightly customized.
Based on the zauberzeug/nicegui discussion apache echart always renders twice, why? #4501.
Example illustrating the problem https://depley.github.io/nicegui-custom-echarts/
TL;DR:
- just subclass ui.element and implement a corresponding Vue component
- currently echarts is integrated mainly via
nicegui/elements/echart.py,nicegui/elements/echart.js
how to
- nicegui docs Configuration & Deployment: custom_vue_components
- nicegui example: Custom Vue Component
current implementation
- search 'echart' in nicegui repo, the interesting results:
-
setup
uv init uv add nicegui
-
create new package
custom_elementswith 1:1 copies of the original echart integration (nicegui/elements/echart.py,nicegui/elements/echart.js)src/custom_elements/my_echart.pysrc/custom_elements/my_echart.js
-
install new package editable
uv pip install -e . -
code
- edits at custom_elements each indicated in comments between
SECTION .. !SECTION - create
main.pyto run it
- edits at custom_elements each indicated in comments between
-
🚀