JSPM

  • Created
  • Published
  • Downloads 8821
  • Score
    100M100P100Q143282F
  • License Apache-2.0

JavaScript library for embedding MongoDB Charts

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

  1. 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
  1. Use the package
import EmbedSDK from '@mongodb-js/charts-embed-dom';

const sdk = new EmbedSDK({
  baseUrl: 'https://charts.mongodb.com/example-project',
  theme: 'dark',
});

const chart = sdk.createChart({
  chartId: 'd697f81b-12aa-4586-9bfb-4e94fd3dd866',
});

// Render the chart to DOM
await chart.render(document.body);

// Refresh a chart
await chart.refresh();