-
Hi, is it possible to have some more details on the available options? (Dynamic htmlGraphics, Dynamic htmlGraphics, etc) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Thanks for bringing this up, I'll try to update the docs to be more clear. There is a thing in docs about dynamic variables, but might not be what's unclear. Here is a link to all the options (there are some links to which variable/reference it updates, like Dynamic data) https://gapit-htmlgraphics-panel.gapit.io/docs/options A bit more information about Dynamic htmlGraphics (and the other dynamic stuff) and when to use it (I'll add it to docs later). When Dynamic htmlGraphics is true A simple example where dynamic data object is useful. Panel json (Dynamic data object = false) {
"add100Percentage": true,
"centerAlignContent": true,
"overflow": "visible",
"SVGBaseFix": true,
"codeData": "{\n \"text\": \"Random text\"\n}",
"rootCSS": "",
"css": "* {\n font-family: Open Sans;\n}\n",
"html": "<div>\n <div>Actual value: <strong id=\"actual-value\"></strong></div>\n <div>onInit Value: <strong id=\"value\"></strong></div>\n</div>\n",
"renderOnMount": true,
"onRender": "const actualValueElt = htmlNode.getElementById('actual-value');\n\nconst valueField = data.series[0]?.fields[1];\nconst length = valueField.values.length;\nconst value = valueField.values.get(length - 1)\n\nactualValueElt.textContent = value;\n",
"dynamicHtmlGraphics": true,
"dynamicData": false,
"dynamicFieldDisplayValues": false,
"dynamicProps": false,
"panelupdateOnMount": true,
"onInitOnResize": false,
"onInit": "const valueElt = htmlNode.getElementById('value');\n\nfunction update() {\n const valueField = data.series[0]?.fields[1];\n const length = valueField.values.length;\n const value = valueField.values.get(length - 1)\n valueElt.textContent = value;\n}\n\nhtmlNode.addEventListener(\"panelupdate\", update);\n"
} Panel json (Dynamic data object = true) {
"add100Percentage": true,
"centerAlignContent": true,
"overflow": "visible",
"SVGBaseFix": true,
"codeData": "{\n \"text\": \"Random text\"\n}",
"rootCSS": "",
"css": "* {\n font-family: Open Sans;\n}\n",
"html": "<div>\n <div>Actual value: <strong id=\"actual-value\"></strong></div>\n <div>onInit Value: <strong id=\"value\"></strong></div>\n</div>\n",
"renderOnMount": true,
"onRender": "const actualValueElt = htmlNode.getElementById('actual-value');\n\nconst valueField = data.series[0]?.fields[1];\nconst length = valueField.values.length;\nconst value = valueField.values.get(length - 1)\n\nactualValueElt.textContent = value;\n",
"dynamicHtmlGraphics": true,
"dynamicData": false,
"dynamicFieldDisplayValues": false,
"dynamicProps": false,
"panelupdateOnMount": true,
"onInitOnResize": false,
"onInit": "const valueElt = htmlNode.getElementById('value');\n\nfunction update() {\n const valueField = data.series[0]?.fields[1];\n const length = valueField.values.length;\n const value = valueField.values.get(length - 1)\n valueElt.textContent = value;\n}\n\nhtmlNode.addEventListener(\"panelupdate\", update);\n"
} In general the dynamic stuff is only useful if it's used in an event like panelupdate, onclick, onmouseenter ETC. Please let me know if this helped :D |
Beta Was this translation helpful? Give feedback.
Thanks for bringing this up, I'll try to update the docs to be more clear.
There is a thing in docs about dynamic variables, but might not be what's unclear.
Here is a link to all the options (there are some links to which variable/reference it updates, like Dynamic data) https://gapit-htmlgraphics-panel.gapit.io/docs/options
A bit more information about Dynamic htmlGraphics (and the other dynamic stuff) and when to use it (I'll add it to docs later).
When Dynamic htmlGraphics is true
it updates the htmlGraphics object when new data is available. new data mostly happens when a refresh happens.
The console output:
A simple example where dynamic data object is useful.
Both panels have t…