@@ -76,6 +76,36 @@ The example app is configured with a chart ID and base URL which are
76
76
particular to the app. Be sure to configure your own apps with the correct
77
77
chart ID and base URL.
78
78
79
+ The example app uses two SDK methods:
80
+
81
+ .. list-table::
82
+ :header-rows: 1
83
+ :widths: 15 55 15 15
84
+
85
+ * - Method
86
+ - Description
87
+ - Args
88
+ - Returns
89
+
90
+ * - ``refresh()``
91
+ - Reloads the chart with the latest data from its
92
+ :ref:`data source <data-sources>`.
93
+ - none
94
+ - Promise<void>
95
+
96
+ * - ``setFilter()``
97
+ - Filters your embedded chart based on a specified MQL
98
+ :ref:`filter document <query-bar>`.
99
+
100
+ .. note::
101
+
102
+ Any fields included in the filter must be specified in the Embed
103
+ Chart modal. See :ref:`Filter Embedded Charts with the SDK
104
+ <filter-embedded-sdk>`.
105
+
106
+ - :ref:`filter <query-bar>` object
107
+ - Promise<void>
108
+
79
109
Quick Start with HTML
80
110
~~~~~~~~~~~~~~~~~~~~~
81
111
@@ -124,6 +154,8 @@ page by including it as part of a header script tag.
124
154
</body>
125
155
</html>
126
156
157
+ .. _filter-embedded-sdk:
158
+
127
159
Filter Embedded Charts with the SDK
128
160
-----------------------------------
129
161
@@ -132,9 +164,24 @@ with the ``filter`` option. Filtering allows the chart author to only display
132
164
data in the embedded chart which matches a specified :abbr:`MQL (MongoDB
133
165
Query Language)` filter.
134
166
135
- Any fields included in the filter must be specified in the Embed Chart modal
136
- window. The Embed Chart modal window contains a dropdown menu of fields on
137
- which to allow filtering.
167
+ Any fields included in the filter must be specified in the Embed Chart modal.
168
+ The Embed Chart modal contains a dropdown menu of fields on
169
+ which to allow filtering.
170
+
171
+ The following uses the ``filter`` option to represent only documents in
172
+ which the ``total`` field is greater than ``100``:
173
+
174
+ .. code-block:: javascript
175
+
176
+ createChart({
177
+ baseUrl: '<your-base-url>',
178
+ chartId: '<your-chart-id>',
179
+ width: 500,
180
+ height: 500,
181
+ filter: { "total": { "$gt": 100 } }
182
+ })
183
+
184
+
138
185
139
186
Option Reference
140
187
----------------
@@ -179,7 +226,7 @@ method:
179
226
* - ``refreshInterval``
180
227
- number
181
228
- How often to refresh the chart, in seconds. The minimum refresh
182
- interval is 10 seconds. ``autorefresh`` is off By default.
229
+ interval is 10 seconds. ``autorefresh`` is off by default.
183
230
- no
184
231
185
232
* - ``theme``
0 commit comments