Falko Schindler 2 年之前
父节点
当前提交
79ffcad490
共有 2 个文件被更改,包括 19 次插入26 次删除
  1. 1 1
      tests/test_json.py
  2. 18 25
      website/more_documentation/plotly_documentation.py

+ 1 - 1
tests/test_json.py

@@ -43,7 +43,7 @@ def test_json():
         np.array([1.0, 0]),
         np.array([0, False, np.pi]),
         np.array(['2010-10-17 07:15:30', '2011-05-13 08:20:35', '2013-01-15 09:09:09'], dtype=np.datetime64),
-        np.array([1.0, None, "test"], dtype=np.object_)
+        np.array([1.0, None, 'test'], dtype=np.object_)
     ]
 
     for test in tests:

+ 18 - 25
website/more_documentation/plotly_documentation.py

@@ -17,40 +17,33 @@ def more() -> None:
     @text_demo('Dictionary interface', '''
         This demo shows how to use the declarative dictionary interface to create a plot.
         For plots with many traces and data points, this is more efficient than the object-oriented interface.
-        The definition corresponds to the JavaScript Plotly API, see [https://plotly.com/javascript/](https://plotly.com/javascript/).
+        The definition corresponds to the [JavaScript Plotly API](https://plotly.com/javascript/).
         Due to different defaults, the resulting plot may look slightly different from the same plot created with the object-oriented interface,
         but the functionality is the same.
     ''')
     def plot_dict_interface():
         fig = {
-            "data": [
+            'data': [
                 {
-                    "type": "scatter",
-                    "name": "Trace 1",
-                    "x": [1, 2, 3, 4],
-                    "y": [1, 2, 3, 2.5]
+                    'type': 'scatter',
+                    'name': 'Trace 1',
+                    'x': [1, 2, 3, 4],
+                    'y': [1, 2, 3, 2.5],
                 },
                 {
-                    "type": "scatter",
-                    "name": "Trace 2",
-                    "x": [1, 2, 3, 4],
-                    "y": np.array([1.4, 1.8, 3.8, 3.2]),
-                    "line": {
-                        "dash": 'dot',
-                        "width": 3
-                    }
-                }
-            ],
-            "layout": {
-                "margin": {"l": 20, "r": 0, "t": 0, "b": 15},
-                "plot_bgcolor": "#E5ECF6",
-                "xaxis": {
-                    "gridcolor": "white",
+                    'type': 'scatter',
+                    'name': 'Trace 2',
+                    'x': [1, 2, 3, 4],
+                    'y': np.array([1.4, 1.8, 3.8, 3.2]),
+                    'line': {'dash': 'dot', 'width': 3},
                 },
-                "yaxis": {
-                    "gridcolor": "white",
-                }
-            }
+            ],
+            'layout': {
+                'margin': {'l': 15, 'r': 0, 't': 0, 'b': 15},
+                'plot_bgcolor': '#E5ECF6',
+                'xaxis': {'gridcolor': 'white'},
+                'yaxis': {'gridcolor': 'white'},
+            },
         }
         ui.plotly(fig).classes('w-full h-40')