Package Exports
- @mongodb-js/charts-embed-dom
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@mongodb-js/charts-embed-dom) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
MongoDB Charts Embedding SDK
The official JavaScript library for embedding MongoDB Charts into your application.
Note: This library is under active development, and is not recommended for use in production instances before a 1.0.0 release
For the existing approaches to support embedding charts, you can find the relevant documentation here: https://docs.mongodb.com/charts/master/embedding-charts/
Installing
General
- Add the
@mongodb-js/charts-embed-dom
package
# yarn
yarn add @mongodb-js/charts-embed-dom
# npm
npm install @mongodb-js/charts-embed-dom --save
- Use the package
import ChartsEmbed from '@mongodb-js/charts-embed-dom';
const options = {
baseUrl: 'https://charts.mongodb.com/example-project',
tenantId: 'example-tenant-id',
chartId: 'example-chart-id',
};
const chart = await ChartsEmbed.embedChart(options, document.body);
// Refresh a chart
chart.refresh();