瀏覽代碼

- Adds basic chart element

Christoph Trappe 3 年之前
父節點
當前提交
f2476ce90d
共有 2 個文件被更改,包括 13 次插入0 次删除
  1. 12 0
      nicegui/elements/chart.py
  2. 1 0
      nicegui/ui.py

+ 12 - 0
nicegui/elements/chart.py

@@ -0,0 +1,12 @@
+import justpy as jp
+
+from .element import Element
+from typing import Dict
+
+
+class Chart(Element):
+    def __init__(self, options):
+        view = jp.HighCharts(classes='m-2 p-2 border', style='width: 600px')
+        self.options = jp.Dict(**options)
+        view.options = self.options
+        super().__init__(view)

+ 1 - 0
nicegui/ui.py

@@ -4,6 +4,7 @@ class Ui:
 
 
     from .elements.annotation_tool import AnnotationTool as annotation_tool
     from .elements.annotation_tool import AnnotationTool as annotation_tool
     from .elements.button import Button as button
     from .elements.button import Button as button
+    from .elements.chart import Chart as chart
     from .elements.checkbox import Checkbox as checkbox
     from .elements.checkbox import Checkbox as checkbox
     from .elements.colors import Colors as colors
     from .elements.colors import Colors as colors
     from .elements.custom_example import CustomExample as custom_example
     from .elements.custom_example import CustomExample as custom_example