@@ -137,19 +137,21 @@ page by including it as part of a header script tag.
137
137
<button id="refresh">Refresh Chart</button>
138
138
<div id="chart"></div>
139
139
<script>
140
- const sdk = new ChartsEmbedSDK;
140
+ const sdk = new ChartsEmbedSDK({
141
+ baseUrl: '<your-base-url>'
142
+ });
141
143
// when using npm:
142
144
// import ChartsEmbedSDK from '@mongodb-js/charts-embed-dom';
143
145
144
146
const chart = sdk
145
147
.createChart({
146
- baseUrl: '<your-base-url>',
147
148
chartId: '<your-chart-id>',
148
149
width: 500,
149
150
height: 500,
150
151
refreshInterval: 300
151
- })
152
- .render(document.getElementById('chart'));
152
+ });
153
+
154
+ chart.render(document.getElementById('chart'));
153
155
</script>
154
156
</body>
155
157
</html>
@@ -158,7 +160,8 @@ Option Reference
158
160
----------------
159
161
160
162
The following options are available to the JavaScript ``createChart``
161
- method:
163
+ method. After the chart is created, you can control the configuration
164
+ of the chart by calling methods on its handle.
162
165
163
166
.. list-table::
164
167
:header-rows: 1
@@ -181,13 +184,17 @@ method:
181
184
182
185
* - ``height``
183
186
- number
184
- - Height of the chart, in pixels.
185
- - yes
187
+ - Height of the chart. If no height is provided, it defaults to
188
+ the height of its container. If a value is provided without units,
189
+ it is assumed to be pixels (px).
190
+ - no
186
191
187
192
* - ``width``
188
193
- number
189
- - Width of the chart, in pixels.
190
- - yes
194
+ - Width of the chart. If no width is provided, it defaults to
195
+ the width of its container. If a value is provided without units,
196
+ it is assumed to be pixels (px).
197
+ - no
191
198
192
199
* - ``filter``
193
200
- object
0 commit comments