|
@@ -40,3 +40,25 @@ def more() -> None:
|
|
|
{'data': [0.42]},
|
|
|
],
|
|
|
}, extras=['solid-gauge']).classes('w-full h-64')
|
|
|
+
|
|
|
+ @text_demo('Chart with point dragging enabled', '''
|
|
|
+ This chart allows data manipulation by dragging the series points. Data can be read via the on_change callback.
|
|
|
+ ''')
|
|
|
+ def drag() -> None:
|
|
|
+ ui.chart(
|
|
|
+ {
|
|
|
+ 'title': False,
|
|
|
+ 'plotOptions': {
|
|
|
+ 'series': {
|
|
|
+ 'stickyTracking': False,
|
|
|
+ 'dragDrop': {'draggableX': True, 'draggableY': True, 'dragPrecisionX': 1, 'dragPrecisionY': 1},
|
|
|
+ }
|
|
|
+ },
|
|
|
+ 'series': [
|
|
|
+ {'name': 'A', 'data': [{'x': 20, 'y': 10}, {'x': 30, 'y': 20}, {'x': 40, 'y': 30}]},
|
|
|
+ {'name': 'B', 'data': [{'x': 50, 'y': 40}, {'x': 60, 'y': 50}, {'x': 70, 'y': 60}]},
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ extras=['draggable-points'],
|
|
|
+ on_change=lambda e: ui.notify(f'The value changed to {e}.')
|
|
|
+ )
|