@@ -91,6 +91,44 @@ multi-indexed DataFrame:
9191 :target: https://s3.amazonaws.com/quantopian-forums/pipeline_with_qgrid.png
9292 :width: 100px
9393
94+ **Events API **:
95+ The Events API provides ``on `` and ``off `` methods which can be used to attach/detach event handlers. They're available
96+ on both the ``modin_spreadsheet `` module (see `qgrid.on <https://qgrid.readthedocs.io/en/latest/#qgrid.on >`_), and on
97+ individual SpreadsheetWidget instances (see `qgrid.QgridWidget.on <https://qgrid.readthedocs.io/en/latest/#qgrid.QgridWidget.on >`_).
98+
99+ Having the ability to attach event handlers allows us to do some interesting things in terms of using modin-spreadsheet
100+ in conjunction with other widgets/visualizations. One example is using modin-spreadsheet to filter a DataFrame that's
101+ also being displayed by another visualization.
102+
103+ Here's how you would use the ``on `` method to print the DataFrame every time there's a change made::
104+
105+ def handle_json_updated(event, spreadsheet_widget):
106+ # exclude 'viewport_changed' events since that doesn't change the DataFrame
107+ if (event['triggered_by'] != 'viewport_changed'):
108+ print(spreadsheet_widget.get_changed_df())
109+
110+ spreadsheet_widget.on('json_updated', handle_json_updated)
111+
112+ Here are some examples of how the Events API can be applied.
113+
114+ This shows how you can use modin-spreadsheet to filter the data that's being shown by a matplotlib scatter plot:
115+
116+ .. figure :: docs/images/linked_to_scatter.gif
117+ :align: left
118+ :target: docs/images/linked_to_scatter.gif
119+ :width: 600px
120+
121+ A brief demo showing modin-spreadsheet hooked up to a matplotlib plot
122+
123+ This shows how events are recorded in real-time. The demo is recorded on JupyterLab, which is not yet supported, but
124+ the functionality is the same on Jupyter Notebook.
125+
126+ .. figure :: docs/images/events_api.gif
127+ :align: left
128+ :target: docs/images/events_api.gif
129+ :width: 600px
130+
131+ A brief demo showing modin-spreadsheet's events api
94132
95133Running from source & testing your changes
96134------------------------------------------
@@ -136,46 +174,6 @@ Running automated tests
136174There is a small python test suite which can be run locally by running the command ``pytest `` in the root folder
137175of the repository.
138176
139- Events API
140- ----------
141- The Events API provides ``on `` and ``off `` methods which can be used to attach/detach event handlers. They're available
142- on both the ``modin_spreadsheet `` module (see `qgrid.on <https://qgrid.readthedocs.io/en/latest/#qgrid.on >`_), and on
143- individual SpreadsheetWidget instances (see `qgrid.QgridWidget.on <https://qgrid.readthedocs.io/en/latest/#qgrid.QgridWidget.on >`_).
144-
145- Having the ability to attach event handlers allows us to do some interesting things in terms of using modin-spreadsheet
146- in conjunction with other widgets/visualizations. One example is using modin-spreadsheet to filter a DataFrame that's
147- also being displayed by another visualization.
148-
149- Here's how you would use the ``on `` method to print the DataFrame every time there's a change made::
150-
151- def handle_json_updated(event, spreadsheet_widget):
152- # exclude 'viewport_changed' events since that doesn't change the DataFrame
153- if (event['triggered_by'] != 'viewport_changed'):
154- print(spreadsheet_widget.get_changed_df())
155-
156- spreadsheet_widget.on('json_updated', handle_json_updated)
157-
158- Here are some examples of how the Events API can be applied.
159-
160- This shows how you can use modin-spreadsheet to filter the data that's being shown by a matplotlib scatter plot:
161-
162- .. figure :: docs/images/linked_to_scatter.gif
163- :align: left
164- :target: docs/images/linked_to_scatter.gif
165- :width: 600px
166-
167- A brief demo showing modin-spreadsheet hooked up to a matplotlib plot
168-
169- This shows how events are recorded in real-time. The demo is recorded on JupyterLab, which is not yet supported, but
170- the functionality is the same on Jupyter Notebook.
171-
172- .. figure :: docs/images/events_api.gif
173- :align: left
174- :target: docs/images/events_api.gif
175- :width: 600px
176-
177- A brief demo showing modin-spreadsheet's events api
178-
179177Contributing
180178------------
181179All contributions, bug reports, bug fixes, documentation improvements, enhancements, and ideas are welcome. See the
0 commit comments