<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Encapsule chart.js plugins?]]></title><description><![CDATA[<p dir="auto">Hi everyone, this is my first post here.</p>
<p dir="auto">I started to set up my MM one month ago.<br />
Initialy I set up some basic modules, but I had trouble finding modules that could handle what I wanted to display on my MM.<br />
I have very little experience with coding, but it’s 2024 and I use AI a lot at work. I have mostly used AI to guide me in making my custom modules, and AI can help with a lot (but not everything).</p>
<p dir="auto">I have made 4-5 custom modules now, three of them focus on electricity info, the rest is updated weather-modules that uses the new <a href="http://Yr.no" target="_blank" rel="noopener noreferrer nofollow ugc">Yr.no</a> API.</p>
<p dir="auto">The problem I have now is with chart.js plugins.<br />
I have one module to display prices the next few days. It uses chart.js annotations.<br />
<img src="/assets/uploads/files/1706991802022-screenshot_20240124_214637_samsung-internet.jpg" alt="Screenshot_20240124_214637_Samsung Internet.jpg" class=" img-fluid img-markdown" /></p>
<p dir="auto">The other module display my daily consumption for the month, and it uses chart.js datalabels.<br />
My problem is that if both modules are active, the module drawn “last” removes the plugin on the other. So the price-module loose the annotations.<br />
<img src="/assets/uploads/files/1706991939139-screenshot_20240201_121844_samsung-internet.jpg" alt="Screenshot_20240201_121844_Samsung Internet.jpg" class=" img-fluid img-markdown" /></p>
<p dir="auto">Is there a way to “encapsule” chart.js inside each module? Or any other way to make sure they don’t interfer with eachother?<br />
I don’t have much experience with the “depths” on how MM works, so any enlightenment is highly apprechiated!</p>
<p dir="auto">Both modules have different canvas-id, both have chart.umd.js installed and start them from the node_modules (I have tried a vendors folder too, but no luck).<br />
I can paste/attach the code if needed.</p>
]]></description><link>https://forum.magicmirror.builders/topic/18477/encapsule-chart-js-plugins</link><generator>RSS for Node</generator><lastBuildDate>Sun, 12 Apr 2026 08:36:57 GMT</lastBuildDate><atom:link href="https://forum.magicmirror.builders/topic/18477.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 03 Feb 2024 22:23:34 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Encapsule chart.js plugins? on Sun, 04 Feb 2024 13:51:23 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ashaman" aria-label="Profile: Ashaman">@<bdi>Ashaman</bdi></a>  cool.  understand that this problem happens whenever multiple modules use the same script library.</p>
<p dir="auto">I discovered it with QR code.  my module and WiFipassword collided over different versions. wifipassword  uses an older version and hasn’t been updated.i wanted to use a feature in a newer version</p>
<p dir="auto">so much fun…</p>
]]></description><link>https://forum.magicmirror.builders/post/115258</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/115258</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Sun, 04 Feb 2024 13:51:23 GMT</pubDate></item><item><title><![CDATA[Reply to Encapsule chart.js plugins? on Sun, 04 Feb 2024 13:26:33 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sdetweil" aria-label="Profile: sdetweil">@<bdi>sdetweil</bdi></a> Yes, I see that now. I also think I have a strategy if I ever need more modules using chart.js. Make sure they run the same version, and initialize in the “first” module only.</p>
<p dir="auto">Thank you so much for your help!</p>
]]></description><link>https://forum.magicmirror.builders/post/115257</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/115257</guid><dc:creator><![CDATA[Ashaman]]></dc:creator><pubDate>Sun, 04 Feb 2024 13:26:33 GMT</pubDate></item><item><title><![CDATA[Reply to Encapsule chart.js plugins? on Sat, 03 Feb 2024 23:31:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ashaman" aria-label="Profile: Ashaman">@<bdi>Ashaman</bdi></a> why?  cause the initialization order matters to chartjs.</p>
<p dir="auto">again, they would never see two apps on the same web page in normal life. in different tabs, sure, but those are different instances</p>
]]></description><link>https://forum.magicmirror.builders/post/115253</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/115253</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Sat, 03 Feb 2024 23:31:29 GMT</pubDate></item><item><title><![CDATA[Reply to Encapsule chart.js plugins? on Sat, 03 Feb 2024 23:27:49 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sdetweil" aria-label="Profile: sdetweil">@<bdi>sdetweil</bdi></a><br />
Some further testing:<br />
If i define the chart.umd.js in the price module, and comment out the  line for chart.umd.js in the consumption-module, the modules work in the order I want!</p>
<p dir="auto">getScripts: function() {<br />
return [<br />
this.file(‘vendor/chart.umd.js’),</p>
<p dir="auto">If the module that is listed “on top” in the config gets the chart.umd.js script, it will fix both modules.</p>
<p dir="auto">(The lables is placed wrong in the consumption-module if it is above the price-module, but I guess that can be fixed somehow.)</p>
<p dir="auto">Problem is solved, but I don’t know why! :grinning_face_with_sweat:</p>
]]></description><link>https://forum.magicmirror.builders/post/115252</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/115252</guid><dc:creator><![CDATA[Ashaman]]></dc:creator><pubDate>Sat, 03 Feb 2024 23:27:49 GMT</pubDate></item><item><title><![CDATA[Reply to Encapsule chart.js plugins? on Sat, 03 Feb 2024 23:16:19 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ashaman" aria-label="Profile: Ashaman">@<bdi>Ashaman</bdi></a> awesome</p>
]]></description><link>https://forum.magicmirror.builders/post/115251</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/115251</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Sat, 03 Feb 2024 23:16:19 GMT</pubDate></item><item><title><![CDATA[Reply to Encapsule chart.js plugins? on Sat, 03 Feb 2024 23:15:28 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ashaman" aria-label="Profile: Ashaman">@<bdi>Ashaman</bdi></a> I don’t know. but I suspect no. I would guess they clear the list on a new instance.</p>
<p dir="auto">I have not used any plugins</p>
<p dir="auto">yes for combining modules</p>
]]></description><link>https://forum.magicmirror.builders/post/115249</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/115249</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Sat, 03 Feb 2024 23:15:28 GMT</pubDate></item><item><title><![CDATA[Reply to Encapsule chart.js plugins? on Sat, 03 Feb 2024 23:13:54 GMT]]></title><description><![CDATA[<p dir="auto">I tried to swap the order of the modules and have the consumption-module first, then the price-module, and they suddenly work as intended!!</p>
<p dir="auto">I havw tried that before, but it’s been a while since I tested that, so I have probably changed something.<br />
Not optimal, but a workaround I can live with.<br />
Still apprechiate any feedback if someone have a suggestion!</p>
]]></description><link>https://forum.magicmirror.builders/post/115250</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/115250</guid><dc:creator><![CDATA[Ashaman]]></dc:creator><pubDate>Sat, 03 Feb 2024 23:13:54 GMT</pubDate></item><item><title><![CDATA[Reply to Encapsule chart.js plugins? on Sat, 03 Feb 2024 23:02:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sdetweil" aria-label="Profile: sdetweil">@<bdi>sdetweil</bdi></a> Can chart.js run on two different modules with different plugins without interfering with one another?</p>
<p dir="auto">Both modules have chart.js 4.4.1 installed.<br />
Both use chartjs.umd.js (min was not installed with npm, as I understand, this was changed last year?).</p>
<p dir="auto">I might try to just combine the two modules into one module, if you think it is worth a try?</p>
]]></description><link>https://forum.magicmirror.builders/post/115248</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/115248</guid><dc:creator><![CDATA[Ashaman]]></dc:creator><pubDate>Sat, 03 Feb 2024 23:02:58 GMT</pubDate></item><item><title><![CDATA[Reply to Encapsule chart.js plugins? on Sat, 03 Feb 2024 22:27:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ashaman" aria-label="Profile: Ashaman">@<bdi>Ashaman</bdi></a> no  cannot encapsulate a lib to only one module</p>
]]></description><link>https://forum.magicmirror.builders/post/115247</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/115247</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Sat, 03 Feb 2024 22:27:09 GMT</pubDate></item></channel></rss>