Skip to content

Commit 1b83caa

Browse files
(DOCSP-6310): Adding docs for auto refresh embedded charts (#218)
* (DOCSP-6310): Adding docs for auto refresh embedded charts * Updates per Jon's comments * Update source/embedded-chart-options.txt Co-Authored-By: jdestefano-mongo <[email protected]>
1 parent 0a28d9c commit 1b83caa

File tree

3 files changed

+86
-2
lines changed

3 files changed

+86
-2
lines changed

config/sphinx_local.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ theme:
2424
- /chart-type-reference/data-table
2525
- /chart-type-reference/geo-spatial
2626
- /chart-type-reference/choropleth
27-
- /customize-charts
2827
- /chart-type-reference/grid-charts
28+
- /customize-charts
29+
- /embedding-charts
2930
sidebars:
3031
'**':
3132
- 'pagenav.html'

source/embedded-chart-options.txt

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
======================
2+
Embedded Chart Options
3+
======================
4+
5+
.. default-domain:: mongodb
6+
7+
.. contents:: On this page
8+
:local:
9+
:backlinks: none
10+
:depth: 1
11+
:class: singlecol
12+
13+
You can customize your embedded charts by appending various
14+
query parameters to their iframe URLs.
15+
16+
.. note::
17+
18+
To embed charts from your dashboards, you must configure embedding
19+
options on your data sources. For instructions, see
20+
:ref:`embedding-charts`.
21+
22+
Specify Refresh Interval
23+
------------------------
24+
25+
Use the ``autorefresh`` query parameter to define the interval,
26+
in seconds, at which the chart refreshes with the latest data from
27+
its :ref:`data source <data-sources>`. If you do not specify
28+
this option, your embedded chart loads once when the iframe
29+
loads and does not automatically refresh.
30+
31+
Example
32+
~~~~~~~
33+
34+
The following iframe embeds a chart which automatically refreshes
35+
every 30 seconds as defined by the ``autorefresh=30`` query parameter:
36+
37+
.. code-block:: none
38+
39+
<iframe style="border: none;border-radius: 2px;box-shadow: 0 2px
40+
10px 0 rgba(70, 76, 79, .2);" width="640" height="480" src="
41+
{charts-host}/embed/charts?id=b3ca720f-4b4a-40b4-a726-e7dc0c49aa1c&
42+
tenant=c184f559-a6d6-4c17-a524-fde31193e498&autorefresh=30"></iframe>
43+
44+
Considerations
45+
~~~~~~~~~~~~~~
46+
47+
- The minimum automatic refresh interval is 10 seconds. If you specify
48+
an ``autorefresh`` value less than 10, the chart refreshes every 10
49+
seconds.
50+
51+
- If you specify an ``autorefresh`` value which is not an integer or
52+
less than 0, an :ref:`error <embedded-errors>` is returned.
53+
54+
- If your data source requires a
55+
:ref:`Verified Signature <embedding-procedure>`, the signature
56+
validity (including the expiry date) is checked on each refresh. If
57+
the signature's expiry date passed, the host web page must
58+
regenerate a new signature to continue rendering charts. For
59+
code examples using verified signatures, see
60+
`MongoDB Charts Embedding Examples <https://github.com/mongodb/charts-embedding-examples>`__
61+
on GitHub.
62+
63+
.. example::
64+
65+
If you specify an automatic refresh interval of one minute and the
66+
expiry date of the signature is in 1 hour, the chart refreshes
67+
every minute for an hour. Once one hour has elapsed, the chart
68+
will not render and an error will be displayed as the signature is
69+
no longer valid. The host web page must regenerate a new signature
70+
to resume rendering the chart.

source/embedding-charts.txt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Embed Charts in Your Web Application
99
.. contents:: On this page
1010
:local:
1111
:backlinks: none
12-
:depth: 2
12+
:depth: 1
1313
:class: singlecol
1414

1515
Overview
@@ -57,6 +57,8 @@ Procedure
5757

5858
.. include:: /includes/steps/embed-chart-verified.rst
5959

60+
.. _embedded-errors:
61+
6062
Embedded Charts Error Codes
6163
---------------------------
6264

@@ -93,3 +95,14 @@ If an embedded chart fails to render, an error code is displayed:
9395
* - ``5``
9496
- Invalid payload. Your application server is not creating a
9597
usable :ref:`signature <admin-settings>`.
98+
99+
* - ``6``
100+
- Invalid ``autorefresh`` value specified. The ``autorefresh``
101+
value must be an integer greater than 0.
102+
103+
.. class:: hidden
104+
105+
.. toctree::
106+
:titlesonly:
107+
108+
/embedded-chart-options

0 commit comments

Comments
 (0)