Hi,
I've been trying to make apexcharts to work on the dashboard via template + ui_template nodes.
The chart works only the first time after deploy, afterwards it does not.
Heres the flow:
[{"id":"320dd3f4.959a0c","type":"ui_template","z":"d7ed593d.5dede8","group":"44218e32.34a34","name":"","order":0,"width":"24","height":"10","format":"","storeOutMessages":false,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","x":480,"y":60,"wires":[[]]},{"id":"f2298587.17ad98","type":"inject","z":"d7ed593d.5dede8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":"1","topic":"","payload":"","payloadType":"date","x":120,"y":60,"wires":[["cccc681a.03f018"]]},{"id":"cccc681a.03f018","type":"template","z":"d7ed593d.5dede8","name":"apex timeline","field":"template","fieldType":"msg","format":"html","syntax":"mustache","template":"<html>\n <head>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css\">\n <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js\"></script>\n <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js\"></script>\n <script src=\"https://cdn.jsdelivr.net/npm/apexcharts\"></script>\n </head>\n <body>\n <div id=\"chart_1\"></div>\n <script>\n var options = {\n series: [\n {\n name: 'Bob',\n data: [\n {\n x: 'Design',\n y: [\n new Date('2019-03-05').getTime(),\n new Date('2019-03-08').getTime()\n ]\n },\n {\n x: 'Code',\n y: [\n new Date('2019-03-02').getTime(),\n new Date('2019-03-05').getTime()\n ]\n },\n {\n x: 'Code',\n y: [\n new Date('2019-03-05').getTime(),\n new Date('2019-03-07').getTime()\n ]\n },\n {\n x: 'Test',\n y: [\n new Date('2019-03-03').getTime(),\n new Date('2019-03-09').getTime()\n ]\n },\n {\n x: 'Test',\n y: [\n new Date('2019-03-08').getTime(),\n new Date('2019-03-11').getTime()\n ]\n },\n {\n x: 'Validation',\n y: [\n new Date('2019-03-11').getTime(),\n new Date('2019-03-16').getTime()\n ]\n },\n {\n x: 'Design',\n y: [\n new Date('2019-03-01').getTime(),\n new Date('2019-03-03').getTime()\n ],\n }\n ]\n },\n {\n name: 'Joe',\n data: [\n {\n x: 'Design',\n y: [\n new Date('2019-03-02').getTime(),\n new Date('2019-03-05').getTime()\n ]\n },\n {\n x: 'Test',\n y: [\n new Date('2019-03-06').getTime(),\n new Date('2019-03-16').getTime()\n ],\n goals: [\n {\n name: 'Break',\n value: new Date('2019-03-10').getTime(),\n strokeColor: '#CD2F2A'\n }\n ]\n },\n {\n x: 'Code',\n y: [\n new Date('2019-03-03').getTime(),\n new Date('2019-03-07').getTime()\n ]\n },\n {\n x: 'Deployment',\n y: [\n new Date('2019-03-20').getTime(),\n new Date('2019-03-22').getTime()\n ]\n },\n {\n x: 'Design',\n y: [\n new Date('2019-03-10').getTime(),\n new Date('2019-03-16').getTime()\n ]\n }\n ]\n },\n {\n name: 'Dan',\n data: [\n {\n x: 'Code',\n y: [\n new Date('2019-03-10').getTime(),\n new Date('2019-03-17').getTime()\n ]\n },\n {\n x: 'Validation',\n y: [\n new Date('2019-03-05').getTime(),\n new Date('2019-03-09').getTime()\n ],\n goals: [\n {\n name: 'Break',\n value: new Date('2019-03-07').getTime(),\n strokeColor: '#CD2F2A'\n }\n ]\n },\n ]\n }\n ],\n chart: {\n height: 450,\n type: 'rangeBar'\n },\n plotOptions: {\n bar: {\n horizontal: true,\n barHeight: '80%'\n }\n },\n xaxis: {\n type: 'datetime'\n },\n stroke: {\n width: 1\n },\n fill: {\n type: 'solid',\n opacity: 1,\n },\n legend: {\n position: 'top',\n horizontalAlign: 'left'\n }\n };\n \n var chart_1 = new ApexCharts(document.querySelector(\"#chart_1\"), options);\n chart_1.render();\n </script>\n </body>\n</html>\n\n\n\n","output":"str","x":290,"y":60,"wires":[["320dd3f4.959a0c"]]},{"id":"44218e32.34a34","type":"ui_group","name":"1","tab":"27c6cdce.0f2ff2","order":1,"disp":true,"width":"30","collapse":false},{"id":"27c6cdce.0f2ff2","type":"ui_tab","name":"DA","icon":"dashboard","order":1,"disabled":false,"hidden":false}]
There is virtualy no info whatsoever how to implement other chart into existing dashboard. No tutorial, no explanations no nothing. This has started to get really frustrating - the problem is I only have basic js knowledge and thats it.
I have copied the code (more or less) from this video: Node-red:Apex Chart - YouTube
This is the only "tutorial" on internet I could find.
This is the error message I'm keep ketting:
VM1837:158 Uncaught ReferenceError: ApexCharts is not defined
at <anonymous>:158:27
at b (app.min.js:20)
at He (app.min.js:20)
at S.fn.init.append (app.min.js:20)
at S.fn.init.<anonymous> (app.min.js:20)
at $ (app.min.js:20)
at S.fn.init.html (app.min.js:20)
at app.min.js:592
at m.$digest (app.min.js:174)
at m.$apply (app.min.js:177)
Please can anybody help me with this one, and also with a possible solution to import scripts from local storage (C:\apexcharts-bundle\dist)
Thank you very much in advance