You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* chore: CHARTS-3840 Added quickstart to readme. Removed global install instructions for authenticated jwt
* chore: CHARTS-3840 Fixed issue where example code was using a non-existent field `id` instead of `chartId`
* chore: CHARTS-3840 Added `quickstart` section to all readme's in the examples directory
* chore: CHARTS-3840 Updated global readme links to include all examples. Added a parent Readme in the example level directory.
* chore: CHARTS-3840 Added hyperlinking to the bottom of example Readme's.
Copy file name to clipboardExpand all lines: examples/authenticated-custom-jwt/readme.md
+19-16Lines changed: 19 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,18 @@ This sample shows how to use the JavaScript Embedding SDK to render **authentica
18
18
- 🔒 Only render charts to valid users
19
19
- 🔑 Custom JWT authentication via `jsonwebtoken`
20
20
21
+
## Quickstart
22
+
_The following steps presume the use of npm, though yarn works as well._
23
+
24
+
1. Ensure you have Node installed. You can confirm with `node --version`. On some operating systems, Node available as the `nodejs` binary instead.
25
+
26
+
2. Clone the Git repository or download the code to your computer.
27
+
28
+
3. Run `npm install` to install the package dependencies.
29
+
30
+
4. Run `npm start` to start the application. This will utilise parcel.js
31
+
- Optional Parcel.js documentation https://parceljs.org/ for more information on what this is
32
+
21
33
## Preparing your Chart for Embedding
22
34
23
35
This sample is preconfigured to render a specific chart. You can run the sample as-is, or you can modify it to render your own chart by completing the following steps:
@@ -46,24 +58,15 @@ This sample is preconfigured to render a specific chart. You can run the sample
46
58
- Signing Algorithm: `HS256`_Note, this is the default signing algorithm for the `jsonwebtoken` library and many others_
47
59
- Signing Key: `topsecret`_Note, this key must correlate with the key found in `config.js`_
48
60
49
-
## Running this Sample
50
-
51
-
_The following steps presume the use of npm, though yarn works as well._
52
-
53
-
1. Ensure you have Node installed. You can confirm with `node --version`. On some operating systems, Node available as the `nodejs` binary instead.
54
-
55
-
2. Clone the Git repository or download the code to your computer.
61
+
## Running this Sample with your data
56
62
57
-
3.**Optional**
63
+
1.
58
64
If you do not wish to use our sample data and have completed the above steps to prepare your own chart for embedding,
59
65
- Open the _index.js_ file (`src/index.js`)
60
-
- Replace the `baseUrl` string on with the base URL you copied from the MongoDB Charts Embedded Chart menu (look for "\~REPLACE\~" in the comments)
61
-
- Replace the `chartId` string on with the chart ID you copied from the MongoDB Charts Embedded Chart menu (look for "\~REPLACE\~" in the comments)
62
-
- Replace the second `chartId`string with the same ID. (look for "\~REPLACE\~" in the comments)
63
-
4. Run `npm install` to install the package dependencies.
64
-
5. Run `npm install -g parcel-bundler` to install Parcel. You may need to run `sudo npm install -g parcel-bundler` if you lack permissions.
65
-
- Optional Parcel.js documentation https://parceljs.org/ for more information on what this is
66
-
6. Run `npm start` to start the application.
66
+
- Replace the `baseUrl` string with the base URL you copied from the MongoDB Charts Embedded Chart menu (look for "\~REPLACE\~" in the comments)
67
+
- Replace the `chartId` string with the chart ID you copied from the MongoDB Charts Embedded Chart menu. (look for "\~REPLACE\~" in the comments)
68
+
2. Run `npm install` to install the package dependencies.
69
+
3. Run `npm start` to start the application.
67
70
68
71
This should create a local server running the Charts demo. Open a web browser and navigate to `http://localhost:1234` in the url bar to see the sample. Along with this, a local jwt authentication server will be spun up on `http://localhost:8000`.
69
72
@@ -77,6 +80,6 @@ Once you gain an understanding of the API, consider the following
77
80
78
81
- Take on the optional steps to prepare and manipulate your own data source rather than the sample.
79
82
- Change the login logic to adapt to your project's security workflow.
80
-
- Think whether an authenticated chart is the feature you're after. If you're simply looking for a way to show off your data, unauthenticated embedding simplifies the workflow even further.
83
+
- Think whether an authenticated chart is the feature you're after. If you're simply looking for a way to show off your data, [unauthenticated embedding](https://github.com/mongodb-js/charts-embed-sdk/tree/master/examples/unauthenticated) simplifies the workflow even further.
Copy file name to clipboardExpand all lines: examples/authenticated-google/readme.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -93,6 +93,6 @@ Once you gain an understanding of the API, consider the following
93
93
-
94
94
- This will only allow users from your company domain to view the chart data 🔒
95
95
96
-
- Think whether an authenticated chart is the feature you're after. If you're simply looking for a way to show off your data, unauthenticated embedding simplifies the workflow even further.
96
+
- Think whether an authenticated chart is the feature you're after. If you're simply looking for a way to show off your data, [unauthenticated embedding](https://github.com/mongodb-js/charts-embed-sdk/tree/master/examples/unauthenticated) simplifies the workflow even further.
Copy file name to clipboardExpand all lines: examples/authenticated-realm/readme.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,7 @@ _The following steps presume the use of npm, though yarn works as well._
31
31
32
32
3. Run `npm install` to install the package dependencies.
33
33
34
-
4. Run `parcel index.html` to start the application.
34
+
4. Run `npm start` to start the application. This will utilise parcel.js
35
35
- Optional Parcel.js documentation https://parceljs.org/ for more information on what this is
36
36
37
37
This should create a local server running the Charts demo. Open a web browser and navigate to `http://localhost:1234` in the url bar to see the sample.
@@ -137,6 +137,6 @@ Once you gain an understanding of the API, consider the following
137
137
138
138
- Take on the optional steps to prepare and manipulate your own data source rather than the sample.
139
139
- Play with Realms Rules system, and change how different accounts see your Chart.
140
-
- Think whether an authenticated chart is the feature you're after. If you're simply looking for a way to show off your data, unauthenticated embedding simplifies the workflow even further.
140
+
- Think whether an authenticated chart is the feature you're after. If you're simply looking for a way to show off your data, [unauthenticated embedding](https://github.com/mongodb-js/charts-embed-sdk/tree/master/examples/unauthenticated) simplifies the workflow even further.
MongoDB Charts allows you to create visualizations of your MongoDB data using a simple web interface. You can view the visualizations within the Charts UI, or you can use the Embedding feature to render the charts in an external web application.
4
+
5
+
Charts can be embedded either using a simple IFRAME snippet, or by using the Charts Embedding SDK from your JavaScript code. When using the SDK, embedded charts can be either unauthenticated (meaning anyone who has the embed code can view the chart), or authenticated (whereby the user can only view the chart if they have an active authentication session linked to a Charts authentication provider).
6
+
7
+
This directory contains example applications making use of both unauthenticated and authenticated utilizations of the SDK. They are provided as a reference to kick start your development process. To run these examples, simply clone the directory, and run the following commands:
8
+
-`npm install`
9
+
-`npm start`
10
+
11
+
in the example directory of your choosing.
12
+
13
+
The [Unauthenticated](https://github.com/mongodb-js/charts-embed-sdk/blob/master/examples/unauthenticated) example is the best place to see all the current SDK features being used. Since it doesn't require authentication, it's the easiest example to set up and follow along with.
14
+
15
+
Our **authenticated** examples are great references if you need help getting started creating Authenticated Embedded Charts. We have three examples, each tailored for the three Authentication Providers now available in MongoDB Charts. The three examples are:
Copy file name to clipboardExpand all lines: examples/unauthenticated/readme.md
+20-14Lines changed: 20 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,21 @@ This sample shows how to use the JavaScript Embedding SDK to render unauthentica
26
26
- Note, filtering on a chart requires setting up white listed fields in MongoDB Charts. We have done this for our sample data.
27
27
- Get the current filter on a chart
28
28
29
+
## Quickstart
30
+
31
+
_The following steps presume the use of npm, though yarn works as well._
32
+
33
+
1. Ensure you have Node installed. You can confirm with `node --version`. On some operating systems, Node is available as the `nodejs` binary instead.
34
+
35
+
2. Clone the Git repository or download the code to your computer.
36
+
37
+
3. Run `npm install` to install the package dependencies.
38
+
39
+
4. Run `npm start` to start the application. This will utilise parcel.js
40
+
- Optional Parcel.js documentation https://parceljs.org/ for more information on what this is
41
+
42
+
This should create a local server running the Charts demo. Open a web browser and navigate to `http://localhost:1234` in the url bar to see the sample.
43
+
29
44
## Preparing your Chart for Embedding
30
45
31
46
This sample is preconfigured to render a specific chart. You can run the sample as-is, or you can modify it to render your own chart by completing the following steps:
@@ -50,24 +65,15 @@ This sample is preconfigured to render a specific chart. You can run the sample
50
65
- Update the query **field** in `src/index.js`
51
66
- Update the query **values** in `index.html`
52
67
53
-
## Running this Sample
54
-
55
-
_The following steps presume the use of npm, though yarn works as well._
56
-
57
-
1. Ensure you have Node installed. You can confirm with `node --version`. On some operating systems, Node available as the `nodejs` binary instead.
58
-
59
-
2. Clone the Git repository or download the code to your computer.
68
+
## Running this Sample with your data
60
69
61
-
3.**Optional**
62
-
If you do not wish to use our sample data and have completed the above steps to prepare your own chart for embedding,
70
+
1. If you do not wish to use our sample data and have completed the above steps to prepare your own chart for embedding,
63
71
- Open the _index.js_ file (`src/index.js`)
64
72
- Replace the `baseUrl` string on with the base URL you copied from the MongoDB Charts Embedded Chart menu (look for "\~REPLACE\~" in the comments)
65
73
- Replace the `chartId` string on with the chart ID you copied from the MongoDB Charts Embedded Chart menu (look for "\~REPLACE\~" in the comments)
66
74
- Replace `address.country` in the `setFilter` code with your whitelisted field (look for "\~REPLACE\~" in the comments)
67
-
4. Run `npm install` to install the package dependencies.
68
-
5. Run `npm install -g parcel-bundler` to install Parcel. You may need to run `sudo npm install -g parcel-bundler` if you lack permissions.
69
-
- Optional Parcel.js documentation https://parceljs.org/ for more information on what this is
70
-
6. Run `parcel index.html` to launch the sample application
75
+
2. Run `npm install` to install the package dependencies.
76
+
3. Run `npm start` to launch the sample application
71
77
72
78
This should create a local server running the Charts demo. Open a web browser and navigate to `http://localhost:1234` in the url bar to see the sample.
73
79
@@ -76,7 +82,7 @@ This should create a local server running the Charts demo. Open a web browser an
76
82
Once you gain an understanding of the API, consider the following
77
83
78
84
- Take on the optional steps to prepare and manipulate your own data source rather than the sample.
79
-
- Think whether an unauthenticated chart is the feature you're after. Embedding iframes from Charts is a great way to showcase your data if you don't need the user to interact with the chart.
85
+
- Think whether an unauthenticated chart is the feature you're after. [Embedding iframes](https://docs.mongodb.com/charts/master/embedded-chart-options/) from Charts is a great way to showcase your data if you don't need the user to interact with the chart.
80
86
- Consider the data you're making available, and the queries you're allowing. If the data is sensitive and you need to ensure the charts can only be accessed by authorized people, you should look at using authenticated embedding.
0 commit comments