|
| 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. |
0 commit comments