Skip to content

Commit 4233c97

Browse files
authored
DOCSP-9737: [Charts] updates to Embedding SDK (#322)
1 parent 6fd962e commit 4233c97

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

source/embedding-charts-sdk.txt

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -137,19 +137,21 @@ page by including it as part of a header script tag.
137137
<button id="refresh">Refresh Chart</button>
138138
<div id="chart"></div>
139139
<script>
140-
const sdk = new ChartsEmbedSDK;
140+
const sdk = new ChartsEmbedSDK({
141+
baseUrl: '<your-base-url>'
142+
});
141143
// when using npm:
142144
// import ChartsEmbedSDK from '@mongodb-js/charts-embed-dom';
143145

144146
const chart = sdk
145147
.createChart({
146-
baseUrl: '<your-base-url>',
147148
chartId: '<your-chart-id>',
148149
width: 500,
149150
height: 500,
150151
refreshInterval: 300
151-
})
152-
.render(document.getElementById('chart'));
152+
});
153+
154+
chart.render(document.getElementById('chart'));
153155
</script>
154156
</body>
155157
</html>
@@ -158,7 +160,8 @@ Option Reference
158160
----------------
159161

160162
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.
162165

163166
.. list-table::
164167
:header-rows: 1
@@ -181,13 +184,17 @@ method:
181184

182185
* - ``height``
183186
- 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
186191

187192
* - ``width``
188193
- 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
191198

192199
* - ``filter``
193200
- object

0 commit comments

Comments
 (0)