Kaynağa Gözat

- Adds basic chart element

Christoph Trappe 3 yıl önce
ebeveyn
işleme
f2476ce90d
2 değiştirilmiş dosya ile 13 ekleme ve 0 silme
  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.button import Button as button
+    from .elements.chart import Chart as chart
     from .elements.checkbox import Checkbox as checkbox
     from .elements.colors import Colors as colors
     from .elements.custom_example import CustomExample as custom_example