streamlit-nightly 1.34.1.dev20240522__py2.py3-none-any.whl → 1.35.1.dev20240523__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -97,11 +97,110 @@ VegaLiteSpec: TypeAlias = "dict[str, Any]"
97
97
 
98
98
  class VegaLiteState(TypedDict, total=False):
99
99
  """
100
- A dictionary representing the current selection state of the VegaLite chart.
100
+ The schema for the Vega-Lite event state.
101
+
102
+ The event state is stored in a dictionary-like object that suports both
103
+ key and attribute notation. Event states cannot be programmatically
104
+ changed or set through Session State.
105
+
106
+ Only selection events are supported at this time.
107
+
101
108
  Attributes
102
109
  ----------
103
110
  selection : AttributeDictionary
104
- The state of the `on_select` event.
111
+ The state of the ``on_select`` event. The name of each selection
112
+ parameter becomes an attribute in the ``selection`` attribute
113
+ dictionary. The format of the data within each attribute is determined
114
+ by the selection parameter definition within Vega-Lite.
115
+
116
+ Examples
117
+ --------
118
+ The following two examples have equivalent definitions. Each one has a
119
+ point and interval selection parameter include in the chart definition.
120
+ The point seleciton parameter is named ``"point_selection"``. The interval
121
+ or box selection parameter is named ``"interval_selection"``.
122
+
123
+ The follow example uses ``st.altair_chart``:
124
+
125
+ >>> import streamlit as st
126
+ >>> import pandas as pd
127
+ >>> import numpy as np
128
+ >>> import altair as alt
129
+ >>>
130
+ >>> if "data" not in st.session_state:
131
+ >>> st.session_state.data = pd.DataFrame(
132
+ ... np.random.randn(20, 3), columns=["a", "b", "c"]
133
+ ... )
134
+ >>> df = st.session_state.data
135
+ >>>
136
+ >>> point_selector = alt.selection_point("point_selection")
137
+ >>> interval_selector = alt.selection_interval("interval_selection")
138
+ >>> chart = (
139
+ ... alt.Chart(df)
140
+ ... .mark_circle()
141
+ ... .encode(
142
+ ... x="a",
143
+ ... y="b",
144
+ ... size="c",
145
+ ... color="c",
146
+ ... tooltip=["a", "b", "c"],
147
+ ... fillOpacity=alt.condition(point_selector, alt.value(1), alt.value(0.3)),
148
+ ... )
149
+ ... .add_params(point_selector, interval_selector)
150
+ ... )
151
+ >>>
152
+ >>> event = st.altair_chart(chart, key="alt_chart", on_select="rerun")
153
+ >>>
154
+ >>> event
155
+
156
+ The following example uses ``st.vega_lite_chart``:
157
+
158
+ >>> import streamlit as st
159
+ >>> import pandas as pd
160
+ >>> import numpy as np
161
+ >>>
162
+ >>> if "data" not in st.session_state:
163
+ >>> st.session_state.data = pd.DataFrame(
164
+ ... np.random.randn(20, 3), columns=["a", "b", "c"]
165
+ ... )
166
+ >>>
167
+ >>> spec = {
168
+ ... "mark": {"type": "circle", "tooltip": True},
169
+ ... "params": [
170
+ ... {"name": "interval_selection", "select": "interval"},
171
+ ... {"name": "point_selection", "select": "point"},
172
+ ... ],
173
+ ... "encoding": {
174
+ ... "x": {"field": "a", "type": "quantitative"},
175
+ ... "y": {"field": "b", "type": "quantitative"},
176
+ ... "size": {"field": "c", "type": "quantitative"},
177
+ ... "color": {"field": "c", "type": "quantitative"},
178
+ ... "fillOpacity": {
179
+ ... "condition": {"param": "point_selection", "value": 1},
180
+ ... "value": 0.3,
181
+ ... },
182
+ ... },
183
+ ... }
184
+ >>>
185
+ >>> event = st.vega_lite_chart(st.session_state.data, spec, key="vega_chart", on_select="rerun")
186
+ >>>
187
+ >>> event
188
+
189
+ Try selecting points in this interactive example. When you click a point,
190
+ the selection will appear under the attribute, ``"point_selection"``, which
191
+ is the name given to the point selection parameter. Similarly, when you
192
+ make an interval selection, it will appear under the attribute
193
+ ``"interval_selection"``. You can give your selection parameters other
194
+ names if desired.
195
+
196
+ If you hold ``Shift`` while selecting points, existing point selections
197
+ will be preserved. Interval selections are not preserved when making
198
+ additional selections.
199
+
200
+ .. output::
201
+ https://doc-chart-events-vega-lite-state.streamlit.app
202
+ height: 600px
203
+
105
204
  """
106
205
 
107
206
  selection: AttributeDictionary
@@ -461,16 +560,16 @@ class VegaChartsMixin:
461
560
  x: str | None = None,
462
561
  y: str | Sequence[str] | None = None,
463
562
  color: str | Color | list[Color] | None = None,
464
- width: int = 0,
465
- height: int = 0,
563
+ width: int | None = None,
564
+ height: int | None = None,
466
565
  use_container_width: bool = True,
467
566
  ) -> DeltaGenerator:
468
567
  """Display a line chart.
469
568
 
470
569
  This is syntax-sugar around ``st.altair_chart``. The main difference
471
570
  is this command uses the data's own column and indices to figure out
472
- the chart's spec. As a result this is easier to use for many "just plot
473
- this" scenarios, while being less customizable.
571
+ the chart's Altair spec. As a result this is easier to use for many
572
+ "just plot this" scenarios, while being less customizable.
474
573
 
475
574
  If ``st.line_chart`` does not guess the data specification
476
575
  correctly, try specifying your desired chart using ``st.altair_chart``.
@@ -529,15 +628,25 @@ class VegaChartsMixin:
529
628
  as the number of y values (e.g. ``color=["#fd0", "#f0f", "#04f"]``
530
629
  for three lines).
531
630
 
532
- width : int
533
- The chart width in pixels. If 0, selects the width automatically.
631
+ width : int or None
632
+ Desired width of the chart expressed in pixels. If ``width`` is
633
+ ``None`` (default), Streamlit sets the width of the chart to fit
634
+ its contents according to the plotting library, up to the width of
635
+ the parent container. If ``width`` is greater than the width of the
636
+ parent container, Streamlit sets the chart width to match the width
637
+ of the parent container.
534
638
 
535
- height : int
536
- The chart height in pixels. If 0, selects the height automatically.
639
+ height : int or None
640
+ Desired height of the chart expressed in pixels. If ``height`` is
641
+ ``None`` (default), Streamlit sets the height of the chart to fit
642
+ its contents according to the plotting library.
537
643
 
538
644
  use_container_width : bool
539
- If True, set the chart width to the column width. This takes
540
- precedence over the width argument.
645
+ Whether to override ``width`` with the width of the parent
646
+ container. If ``use_container_width`` is ``False`` (default),
647
+ Streamlit sets the chart's width according to ``width``. If
648
+ ``use_container_width`` is ``True``, Streamlit sets the width of
649
+ the chart to match the width of the parent container.
541
650
 
542
651
  Examples
543
652
  --------
@@ -623,16 +732,16 @@ class VegaChartsMixin:
623
732
  x: str | None = None,
624
733
  y: str | Sequence[str] | None = None,
625
734
  color: str | Color | list[Color] | None = None,
626
- width: int = 0,
627
- height: int = 0,
735
+ width: int | None = None,
736
+ height: int | None = None,
628
737
  use_container_width: bool = True,
629
738
  ) -> DeltaGenerator:
630
739
  """Display an area chart.
631
740
 
632
741
  This is syntax-sugar around ``st.altair_chart``. The main difference
633
742
  is this command uses the data's own column and indices to figure out
634
- the chart's spec. As a result this is easier to use for many "just plot
635
- this" scenarios, while being less customizable.
743
+ the chart's Altair spec. As a result this is easier to use for many
744
+ "just plot this" scenarios, while being less customizable.
636
745
 
637
746
  If ``st.area_chart`` does not guess the data specification
638
747
  correctly, try specifying your desired chart using ``st.altair_chart``.
@@ -691,15 +800,25 @@ class VegaChartsMixin:
691
800
  as the number of y values (e.g. ``color=["#fd0", "#f0f", "#04f"]``
692
801
  for three lines).
693
802
 
694
- width : int
695
- The chart width in pixels. If 0, selects the width automatically.
803
+ width : int or None
804
+ Desired width of the chart expressed in pixels. If ``width`` is
805
+ ``None`` (default), Streamlit sets the width of the chart to fit
806
+ its contents according to the plotting library, up to the width of
807
+ the parent container. If ``width`` is greater than the width of the
808
+ parent container, Streamlit sets the chart width to match the width
809
+ of the parent container.
696
810
 
697
- height : int
698
- The chart height in pixels. If 0, selects the height automatically.
811
+ height : int or None
812
+ Desired height of the chart expressed in pixels. If ``height`` is
813
+ ``None`` (default), Streamlit sets the height of the chart to fit
814
+ its contents according to the plotting library.
699
815
 
700
816
  use_container_width : bool
701
- If True, set the chart width to the column width. This takes
702
- precedence over the width argument.
817
+ Whether to override ``width`` with the width of the parent
818
+ container. If ``use_container_width`` is ``False`` (default),
819
+ Streamlit sets the chart's width according to ``width``. If
820
+ ``use_container_width`` is ``True``, Streamlit sets the width of
821
+ the chart to match the width of the parent container.
703
822
 
704
823
  Examples
705
824
  --------
@@ -785,16 +904,16 @@ class VegaChartsMixin:
785
904
  x: str | None = None,
786
905
  y: str | Sequence[str] | None = None,
787
906
  color: str | Color | list[Color] | None = None,
788
- width: int = 0,
789
- height: int = 0,
907
+ width: int | None = None,
908
+ height: int | None = None,
790
909
  use_container_width: bool = True,
791
910
  ) -> DeltaGenerator:
792
911
  """Display a bar chart.
793
912
 
794
913
  This is syntax-sugar around ``st.altair_chart``. The main difference
795
914
  is this command uses the data's own column and indices to figure out
796
- the chart's spec. As a result this is easier to use for many "just plot
797
- this" scenarios, while being less customizable.
915
+ the chart's Altair spec. As a result this is easier to use for many
916
+ "just plot this" scenarios, while being less customizable.
798
917
 
799
918
  If ``st.bar_chart`` does not guess the data specification
800
919
  correctly, try specifying your desired chart using ``st.altair_chart``.
@@ -853,15 +972,25 @@ class VegaChartsMixin:
853
972
  as the number of y values (e.g. ``color=["#fd0", "#f0f", "#04f"]``
854
973
  for three lines).
855
974
 
856
- width : int
857
- The chart width in pixels. If 0, selects the width automatically.
975
+ width : int or None
976
+ Desired width of the chart expressed in pixels. If ``width`` is
977
+ ``None`` (default), Streamlit sets the width of the chart to fit
978
+ its contents according to the plotting library, up to the width of
979
+ the parent container. If ``width`` is greater than the width of the
980
+ parent container, Streamlit sets the chart width to match the width
981
+ of the parent container.
858
982
 
859
- height : int
860
- The chart height in pixels. If 0, selects the height automatically.
983
+ height : int or None
984
+ Desired height of the chart expressed in pixels. If ``height`` is
985
+ ``None`` (default), Streamlit sets the height of the chart to fit
986
+ its contents according to the plotting library.
861
987
 
862
988
  use_container_width : bool
863
- If True, set the chart width to the column width. This takes
864
- precedence over the width argument.
989
+ Whether to override ``width`` with the width of the parent
990
+ container. If ``use_container_width`` is ``False`` (default),
991
+ Streamlit sets the chart's width according to ``width``. If
992
+ ``use_container_width`` is ``True``, Streamlit sets the width of
993
+ the chart to match the width of the parent container.
865
994
 
866
995
  Examples
867
996
  --------
@@ -950,16 +1079,16 @@ class VegaChartsMixin:
950
1079
  y: str | Sequence[str] | None = None,
951
1080
  color: str | Color | list[Color] | None = None,
952
1081
  size: str | float | int | None = None,
953
- width: int = 0,
954
- height: int = 0,
1082
+ width: int | None = None,
1083
+ height: int | None = None,
955
1084
  use_container_width: bool = True,
956
1085
  ) -> DeltaGenerator:
957
1086
  """Display a scatterplot chart.
958
1087
 
959
1088
  This is syntax-sugar around ``st.altair_chart``. The main difference
960
1089
  is this command uses the data's own column and indices to figure out
961
- the chart's spec. As a result this is easier to use for many "just plot
962
- this" scenarios, while being less customizable.
1090
+ the chart's Altair spec. As a result this is easier to use for many
1091
+ "just plot this" scenarios, while being less customizable.
963
1092
 
964
1093
  If ``st.scatter_chart`` does not guess the data specification correctly,
965
1094
  try specifying your desired chart using ``st.altair_chart``.
@@ -1027,15 +1156,25 @@ class VegaChartsMixin:
1027
1156
  * The name of the column to use for the size. This allows each
1028
1157
  datapoint to be represented by a circle of a different size.
1029
1158
 
1030
- width : int
1031
- The chart width in pixels. If 0, selects the width automatically.
1159
+ width : int or None
1160
+ Desired width of the chart expressed in pixels. If ``width`` is
1161
+ ``None`` (default), Streamlit sets the width of the chart to fit
1162
+ its contents according to the plotting library, up to the width of
1163
+ the parent container. If ``width`` is greater than the width of the
1164
+ parent container, Streamlit sets the chart width to match the width
1165
+ of the parent container.
1032
1166
 
1033
- height : int
1034
- The chart height in pixels. If 0, selects the height automatically.
1167
+ height : int or None
1168
+ Desired height of the chart expressed in pixels. If ``height`` is
1169
+ ``None`` (default), Streamlit sets the height of the chart to fit
1170
+ its contents according to the plotting library.
1035
1171
 
1036
1172
  use_container_width : bool
1037
- If True, set the chart width to the column width. This takes
1038
- precedence over the width argument.
1173
+ Whether to override ``width`` with the width of the parent
1174
+ container. If ``use_container_width`` is ``False`` (default),
1175
+ Streamlit sets the chart's width according to ``width``. If
1176
+ ``use_container_width`` is ``True``, Streamlit sets the width of
1177
+ the chart to match the width of the parent container.
1039
1178
 
1040
1179
  Examples
1041
1180
  --------
@@ -1155,34 +1294,88 @@ class VegaChartsMixin:
1155
1294
  on_select: Literal["rerun", "ignore"] | WidgetCallback = "ignore",
1156
1295
  selection_mode: str | Iterable[str] | None = None,
1157
1296
  ) -> DeltaGenerator | VegaLiteState:
1158
- """Display a chart using the Altair library.
1297
+ """Display a chart using the Vega-Altair library.
1298
+
1299
+ `Vega-Altair <https://altair-viz.github.io/>`_ is a declarative
1300
+ statistical visualization library for Python, based on Vega and
1301
+ Vega-Lite.
1159
1302
 
1160
1303
  Parameters
1161
1304
  ----------
1162
1305
  altair_chart : altair.Chart
1163
- The Altair chart object to display.
1306
+ The Altair chart object to display. See
1307
+ https://altair-viz.github.io/gallery/ for examples of graph
1308
+ descriptions.
1164
1309
 
1165
1310
  use_container_width : bool
1166
- If True, set the chart width to the column width. This takes
1167
- precedence over Altair's native ``width`` value.
1311
+ Whether to override the figure's native width with the width of
1312
+ the parent container. If ``use_container_width`` is ``False``
1313
+ (default), Streamlit sets the width of the chart to fit its contents
1314
+ according to the plotting library, up to the width of the parent
1315
+ container. If ``use_container_width`` is ``True``, Streamlit sets
1316
+ the width of the figure to match the width of the parent container.
1168
1317
 
1169
1318
  theme : "streamlit" or None
1170
- The theme of the chart. Currently, we only support "streamlit" for the Streamlit
1171
- defined design or None to fallback to the default behavior of the library.
1319
+ The theme of the chart. If ``theme`` is ``"streamlit"`` (default),
1320
+ Streamlit uses its own design default. If ``theme`` is ``None``,
1321
+ Streamlit falls back to the default behavior of the library.
1172
1322
 
1173
1323
  key : str
1174
- An optional string to use as the unique key for this element when used in combination
1175
- with ```on_select```. If this is omitted, a key will be generated for the widget based
1176
- on its content. Multiple widgets of the same type may not share the same key.
1177
-
1178
- on_select : "ignore" or "rerun" or callable
1179
- Controls the behavior in response to selection events on the charts. Can be one of:
1180
- - "ignore" (default): Streamlit will not react to any selection events in the chart.
1181
- - "rerun: Streamlit will rerun the app when the user selects data in the chart. In this case,
1182
- ```st.altair_chart``` will return the selection data as a dictionary.
1183
- - callable: If a callable is provided, Streamlit will rerun and execute the callable as a
1184
- callback function before the rest of the app. The selection data can be retrieved through
1185
- session state by setting the key parameter.
1324
+ An optional string to use for giving this element a stable
1325
+ identity. If ``key`` is ``None`` (default), this element's identity
1326
+ will be determined based on the values of the other parameters.
1327
+
1328
+ Additionally, if selections are activated and ``key`` is provided,
1329
+ Streamlit will register the key in Session State to store the
1330
+ selection state. The selection state is read-only.
1331
+
1332
+ on_select : "ignore", "rerun", or callable
1333
+ How the figure should respond to user selection events. This
1334
+ controls whether or not the figure behaves like an input widget.
1335
+ ``on_select`` can be one of the following:
1336
+
1337
+ - ``"ignore"`` (default): Streamlit will not react to any selection
1338
+ events in the chart. The figure will not behave like an input
1339
+ widget.
1340
+
1341
+ - ``"rerun"``: Streamlit will rerun the app when the user selects
1342
+ data in the chart. In this case, ``st.altair_chart`` will return
1343
+ the selection data as a dictionary.
1344
+
1345
+ - A ``callable``: Streamlit will rerun the app and execute the
1346
+ ``callable`` as a callback function before the rest of the app.
1347
+ In this case, ``st.altair_chart`` will return the selection data
1348
+ as a dictionary.
1349
+
1350
+ To use selection events, the object passed to ``altair_chart`` must
1351
+ include selection paramters. To learn about defining interactions
1352
+ in Altair and how to declare selection-type parameters, see
1353
+ `Interactive Charts \
1354
+ <https://altair-viz.github.io/user_guide/interactions.html>`_
1355
+ in Altair's documentation.
1356
+
1357
+ selection_mode : str or Iterable of str
1358
+ The selection parameters Streamlit should use. If
1359
+ ``selection_mode`` is ``None`` (default), Streamlit will use all
1360
+ selection parameters defined in the chart's Altair spec.
1361
+
1362
+ When Streamlit uses a selection parameter, selections from that
1363
+ parameter will trigger a rerun and be included in the selection
1364
+ state. When Streamlit does not use a selection parameter,
1365
+ selections from that parameter will not trigger a rerun and not be
1366
+ included in the selection state.
1367
+
1368
+ Selection parameters are identified by their ``name`` property.
1369
+
1370
+ Returns
1371
+ -------
1372
+ element or dict
1373
+ If ``on_select`` is ``"ignore"`` (default), this method returns an
1374
+ internal placeholder for the chart element that can be used with
1375
+ the ``.add_rows()`` method. Otherwise, this method returns a
1376
+ dictionary-like object that supports both key and attribute
1377
+ notation. The attributes are described by the ``VegaLiteState``
1378
+ dictionary schema.
1186
1379
 
1187
1380
  Example
1188
1381
  -------
@@ -1204,10 +1397,7 @@ class VegaChartsMixin:
1204
1397
 
1205
1398
  .. output::
1206
1399
  https://doc-vega-lite-chart.streamlit.app/
1207
- height: 300px
1208
-
1209
- Examples of Altair charts can be found at
1210
- https://altair-viz.github.io/gallery/.
1400
+ height: 450px
1211
1401
 
1212
1402
  """
1213
1403
  return self._altair_chart(
@@ -1264,6 +1454,9 @@ class VegaChartsMixin:
1264
1454
  ) -> DeltaGenerator | VegaLiteState:
1265
1455
  """Display a chart using the Vega-Lite library.
1266
1456
 
1457
+ `Vega-Lite <https://vega.github.io/vega-lite/>`_ is a high-level
1458
+ grammar for defining interactive graphics.
1459
+
1267
1460
  Parameters
1268
1461
  ----------
1269
1462
  data : pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, Iterable, dict, or None
@@ -1271,34 +1464,84 @@ class VegaChartsMixin:
1271
1464
  data (which more closely follows the Vega-Lite API).
1272
1465
 
1273
1466
  spec : dict or None
1274
- The Vega-Lite spec for the chart. If the spec was already passed in
1275
- the previous argument, this must be set to None. See
1467
+ The Vega-Lite spec for the chart. If ``spec`` is ``None`` (default),
1468
+ Streamlit uses the spec passed in ``data``. You cannot pass a spec
1469
+ to both ``data`` and ``spec``. See
1276
1470
  https://vega.github.io/vega-lite/docs/ for more info.
1277
1471
 
1278
1472
  use_container_width : bool
1279
- If True, set the chart width to the column width. This takes
1280
- precedence over Vega-Lite's native `width` value.
1473
+ Whether to override the figure's native width with the width of
1474
+ the parent container. If ``use_container_width`` is ``False``
1475
+ (default), Streamlit sets the width of the chart to fit its contents
1476
+ according to the plotting library, up to the width of the parent
1477
+ container. If ``use_container_width`` is ``True``, Streamlit sets
1478
+ the width of the figure to match the width of the parent container.
1281
1479
 
1282
1480
  theme : "streamlit" or None
1283
- The theme of the chart. Currently, we only support "streamlit" for the Streamlit
1284
- defined design or None to fallback to the default behavior of the library.
1481
+ The theme of the chart. If ``theme`` is ``"streamlit"`` (default),
1482
+ Streamlit uses its own design default. If ``theme`` is ``None``,
1483
+ Streamlit falls back to the default behavior of the library.
1285
1484
 
1286
1485
  key : str
1287
- An optional string to use as the unique key for this element when used in combination
1288
- with ```on_select```. If this is omitted, a key will be generated for the widget based
1289
- on its content. Multiple widgets of the same type may not share the same key.
1290
-
1291
- on_select : "ignore" or "rerun" or callable
1292
- Controls the behavior in response to selection events on the charts. Can be one of:
1293
- - "ignore" (default): Streamlit will not react to any selection events in the chart.
1294
- - "rerun: Streamlit will rerun the app when the user selects data in the chart. In this case,
1295
- ```st.vega_lite_chart``` will return the selection data as a dictionary.
1296
- - callable: If a callable is provided, Streamlit will rerun and execute the callable as a
1297
- callback function before the rest of the app. The selection data can be retrieved through
1298
- session state by setting the key parameter.
1486
+ An optional string to use for giving this element a stable
1487
+ identity. If ``key`` is ``None`` (default), this element's identity
1488
+ will be determined based on the values of the other parameters.
1489
+
1490
+ Additionally, if selections are activated and ``key`` is provided,
1491
+ Streamlit will register the key in Session State to store the
1492
+ selection state. The selection state is read-only.
1493
+
1494
+ on_select : "ignore", "rerun", or callable
1495
+ How the figure should respond to user selection events. This
1496
+ controls whether or not the figure behaves like an input widget.
1497
+ ``on_select`` can be one of the following:
1498
+
1499
+ - ``"ignore"`` (default): Streamlit will not react to any selection
1500
+ events in the chart. The figure will not behave like an input
1501
+ widget.
1502
+
1503
+ - ``"rerun"``: Streamlit will rerun the app when the user selects
1504
+ data in the chart. In this case, ``st.vega_lite_chart`` will
1505
+ return the selection data as a dictionary.
1506
+
1507
+ - A ``callable``: Streamlit will rerun the app and execute the
1508
+ ``callable`` as a callback function before the rest of the app.
1509
+ In this case, ``st.vega_lite_chart`` will return the selection data
1510
+ as a dictionary.
1511
+
1512
+ To use selection events, the Vega-Lite spec defined in ``data`` or
1513
+ ``spec`` must include selection parameters from the the charting
1514
+ library. To learn about defining interactions in Vega-Lite, see
1515
+ `Dynamic Behaviors with Parameters \
1516
+ <https://vega.github.io/vega-lite/docs/parameter.html>`_
1517
+ in Vega-Lite's documentation.
1518
+
1519
+ selection_mode : str or Iterable of str
1520
+ The selection parameters Streamlit should use. If
1521
+ ``selection_mode`` is ``None`` (default), Streamlit will use all
1522
+ selection parameters defined in the chart's Vega-Lite spec.
1523
+
1524
+ When Streamlit uses a selection parameter, selections from that
1525
+ parameter will trigger a rerun and be included in the selection
1526
+ state. When Streamlit does not use a selection parameter,
1527
+ selections from that parameter will not trigger a rerun and not be
1528
+ included in the selection state.
1529
+
1530
+ Selection parameters are identified by their ``name`` property.
1299
1531
 
1300
1532
  **kwargs : any
1301
- Same as spec, but as keywords.
1533
+ The Vega-Lite spec for the chart as keywords. This is an alternative
1534
+ to ``spec``.
1535
+
1536
+ Returns
1537
+ -------
1538
+ element or dict
1539
+ If ``on_select`` is ``"ignore"`` (default), this method returns an
1540
+ internal placeholder for the chart element that can be used with
1541
+ the ``.add_rows()`` method. Otherwise, this method returns a
1542
+ dictionary-like object that supports both key and attribute
1543
+ notation. The attributes are described by the ``VegaLiteState``
1544
+ dictionary schema.
1302
1545
 
1303
1546
  Example
1304
1547
  -------
@@ -1323,7 +1566,7 @@ class VegaChartsMixin:
1323
1566
 
1324
1567
  .. output::
1325
1568
  https://doc-vega-lite-chart.streamlit.app/
1326
- height: 300px
1569
+ height: 450px
1327
1570
 
1328
1571
  Examples of Vega-Lite usage without Streamlit can be found at
1329
1572
  https://vega.github.io/vega-lite/examples/. Most of those can be easily
@@ -620,20 +620,29 @@ class DataEditorMixin:
620
620
  changed through column configuration.
621
621
 
622
622
  width : int or None
623
- Desired width of the data editor expressed in pixels. If None, the width will
624
- be automatically determined.
623
+ Desired width of the data editor expressed in pixels. If ``width``
624
+ is ``None`` (default), Streamlit sets the data editor width to fit
625
+ its contents up to the width of the parent container. If ``width``
626
+ is greater than the width of the parent container, Streamlit sets
627
+ the data editor width to match the width of the parent container.
625
628
 
626
629
  height : int or None
627
- Desired height of the data editor expressed in pixels. If None, the height will
628
- be automatically determined.
630
+ Desired height of the data editor expressed in pixels. If ``height``
631
+ is ``None`` (default), Streamlit sets the height to show at most
632
+ ten rows. Vertical scrolling within the data editor element is
633
+ enabled when the height does not accomodate all rows.
629
634
 
630
635
  use_container_width : bool
631
- If True, set the data editor width to the width of the parent container.
632
- This takes precedence over the width argument. Defaults to False.
636
+ Whether to override ``width`` with the width of the parent
637
+ container. If ``use_container_width`` is ``False`` (default),
638
+ Streamlit sets the data editor's width according to ``width``. If
639
+ ``use_container_width`` is ``True``, Streamlit sets the width of
640
+ the data editor to match the width of the parent container.
633
641
 
634
642
  hide_index : bool or None
635
- Whether to hide the index column(s). If None (default), the visibility of
636
- index columns is automatically determined based on the data.
643
+ Whether to hide the index column(s). If ``hide_index`` is ``None``
644
+ (default), the visibility of index columns is automatically
645
+ determined based on the data.
637
646
 
638
647
  column_order : Iterable of str or None
639
648
  Specifies the display order of columns. This also affects which columns are
@@ -144,7 +144,8 @@ class AppSession:
144
144
  self._stop_config_listener: Callable[[], bool] | None = None
145
145
  self._stop_pages_listener: Callable[[], None] | None = None
146
146
 
147
- self.register_file_watchers()
147
+ if config.get_option("server.fileWatcherType") != "none":
148
+ self.register_file_watchers()
148
149
 
149
150
  self._run_on_save = config.get_option("server.runOnSave")
150
151
 
@@ -175,18 +175,22 @@ class BrowserWebSocketHandler(WebSocketHandler, SessionClient):
175
175
  # developmentMode-only messages used in e2e tests to test reconnect handling and
176
176
  # disabling widgets.
177
177
  if msg.WhichOneof("type") == "debug_disconnect_websocket":
178
- if config.get_option("global.developmentMode"):
178
+ if config.get_option("global.developmentMode") or config.get_option(
179
+ "global.e2eTest"
180
+ ):
179
181
  self.close()
180
182
  else:
181
183
  _LOGGER.warning(
182
- "Client tried to disconnect websocket when not in development mode."
184
+ "Client tried to disconnect websocket when not in development mode or e2e testing."
183
185
  )
184
186
  elif msg.WhichOneof("type") == "debug_shutdown_runtime":
185
- if config.get_option("global.developmentMode"):
187
+ if config.get_option("global.developmentMode") or config.get_option(
188
+ "global.e2eTest"
189
+ ):
186
190
  self._runtime.stop()
187
191
  else:
188
192
  _LOGGER.warning(
189
- "Client tried to shut down runtime when not in development mode."
193
+ "Client tried to shut down runtime when not in development mode or e2e testing."
190
194
  )
191
195
  else:
192
196
  # AppSession handles all other BackMsg types.