<?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[[Help!] svg Graph in module MMM-Strava]]></title><description><![CDATA[<p dir="auto">HI all,</p>
<p dir="auto">I was trying to add an svg graph to the MMM-Strava module made by <a class="plugin-mentions-user plugin-mentions-a" href="/user/ianperrin" aria-label="Profile: ianperrin">@<bdi>ianperrin</bdi></a>.</p>
<p dir="auto">The idea was to have a yearly or 4-week goal for an activity and having a progress bar showing how much of this goal you reached already .<br />
So I wanted to implement this progress bar:<br />
<a href="https://codepen.io/davatron5000/pen/jzMmME" target="_blank" rel="noopener noreferrer nofollow ugc">https://codepen.io/davatron5000/pen/jzMmME</a></p>
<p dir="auto">Since we’re bound to Javascript from my understanding I have to set the DOM elements and attributes in the .js file.<br />
I’ve tried it like this:</p>
<pre><code>    createProgressBar: function() {
      var progressWrapper = document.createElement("div");
      //this.log("Created Progress Bar Div")
      progressWrapper.className = "progressBarDiv small";
      var svg = document.createElement("svg");
      svg.className = "progressSVG";
      svg.setAttribute("xmlns", "http://www.w3.org/2000/svg");
      svg.setAttribute("height", "300px");
      svg.setAttribute("width", "300px");
      svg.setAttribute("viewBox", "0 0 300 300");
      svg.setAttribute("data-value", "40");
      progressBG = document.createElement("path");
      progressBG.className = "bg";
      progressBG.setAttribute("stroke", "#ccc");
      progressBG.setAttribute("d", "M41 149.5a77 77 0 1 1 117.93 0");
      progressBG.setAttribute("fill", "none");
      svg.appendChild(progressBG);
      progressWrapper.appendChild(svg);

      return progressWrapper;
    },
</code></pre>
<p dir="auto">and this is the css:</p>
<pre><code>.MMM-Strava .progressBarDiv {
    display: block;
    width: 300px;
    height: 300px;
}

.MMM-Strava svg {
    width: 300px;
    height: 300px;
}

.MMM-Strava .bg {
    will-change: auto;
    stroke-width: 20px;
    stroke-miterlimit: round;
    transition: stroke-dashoffset 850ms ease-in-out;
}

.MMM-Strava .progressWrapper {
  display: grid;
  justify-content: center;
  align-items: center;
}
</code></pre>
<p dir="auto">Function is called and the wrapper div is returned without errors, but all i get is an empty div 300x300. The svg has a height/width of 0 and does not show anything.<br />
What have I overseen.</p>
<p dir="auto">Any help highly appreciated!</p>
]]></description><link>https://forum.magicmirror.builders/topic/9820/help-svg-graph-in-module-mmm-strava</link><generator>RSS for Node</generator><lastBuildDate>Sun, 07 Jun 2026 02:17:52 GMT</lastBuildDate><atom:link href="https://forum.magicmirror.builders/topic/9820.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 17 Feb 2019 19:31:18 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [Help!] svg Graph in module MMM-Strava on Thu, 18 Apr 2019 07:05:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ianperrin" aria-label="Profile: ianperrin">@<bdi>ianperrin</bdi></a> Ian, I haven’t seen your latest reply, sorry, but meanwhile I’ve learnt how to deal with the templates and am implementing the progress bar myself.<br />
The nunjucks environment makes it much easier for me in the end.<br />
Look for a PR soon :-)<br />
Thanks again for your work on this! Having much fun with the API and would like to bloat the module much further. (–&gt;motivation for summer)</p>
]]></description><link>https://forum.magicmirror.builders/post/56100</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/56100</guid><dc:creator><![CDATA[lavolp3]]></dc:creator><pubDate>Thu, 18 Apr 2019 07:05:29 GMT</pubDate></item><item><title><![CDATA[Reply to [Help!] svg Graph in module MMM-Strava on Wed, 27 Feb 2019 13:52:27 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/lavolp3" aria-label="Profile: lavolp3">@<bdi>lavolp3</bdi></a> - no worries. I’ve created a branch to develop this feature. Take a look at <a href="https://github.com/ianperrin/MMM-Strava/tree/feature/progress_chart" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/ianperrin/MMM-Strava/tree/feature/progress_chart</a></p>
<p dir="auto">Once you checkout the branch, add/use the following configuration with either the legacy <code>strava_id</code> and <code>access_token</code> options, or the new <code>client_id</code> and <code>client_secret</code> options:</p>
<pre><code>		{
			module: "MMM-Strava",
			position: "top_right",
			header: "Progress Chart",
			config: {
				activities: ["ride"],
				period: "ytd",
				mode: "progress"
			},
		},
</code></pre>
<p dir="auto"><img src="/assets/uploads/files/1551275535577-progress-chart.png" alt="Progress Chart.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">I haven’t yet implement the animated path to show the progress against the goal. ;)</p>
]]></description><link>https://forum.magicmirror.builders/post/53309</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/53309</guid><dc:creator><![CDATA[ianperrin]]></dc:creator><pubDate>Wed, 27 Feb 2019 13:52:27 GMT</pubDate></item><item><title><![CDATA[Reply to [Help!] svg Graph in module MMM-Strava on Wed, 27 Feb 2019 10:54:19 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ianperrin" aria-label="Profile: ianperrin">@<bdi>ianperrin</bdi></a> Thanks Ian. I have seen what you’re doing in deelopment branch and currently just trying out locally. Will try to adept later on. Nunjucks template shouldn’t be a problem I guess.</p>
<p dir="auto">As soon as I have something I’ll send a PR and we can discuss how valuable it really is.<br />
I have been struggling with your approach a bit using “element-creating” functions and returning one element in each function.<br />
As a JS beginner, it was difficult for me to actually ADD a div/element to the body itself regardless of the users’ choice for a table or a chart. I needed first to substitute one of the other ones with a new function.<br />
However it’s very much fun :-) and I’m learning a lot</p>
]]></description><link>https://forum.magicmirror.builders/post/53295</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/53295</guid><dc:creator><![CDATA[lavolp3]]></dc:creator><pubDate>Wed, 27 Feb 2019 10:54:19 GMT</pubDate></item><item><title><![CDATA[Reply to [Help!] svg Graph in module MMM-Strava on Wed, 27 Feb 2019 08:08:51 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ianperrin" aria-label="Profile: ianperrin">@<bdi>ianperrin</bdi></a> said in <a href="/post/53284">[Help!] svg Graph in module MMM-Strava</a>:</p>
<blockquote>
<p dir="auto">However,  I’ve recently been implementing new <a href="https://developers.strava.com/docs/authentication/" target="_blank" rel="noopener noreferrer nofollow ugc">authentication flow</a> in the <em>develop</em> branch.</p>
</blockquote>
<p dir="auto">See <a href="https://forum.magicmirror.builders/topic/457/mmm-strava/37">https://forum.magicmirror.builders/topic/457/mmm-strava/37</a> for more details on the new <strong>beta</strong> version ;)</p>
]]></description><link>https://forum.magicmirror.builders/post/53288</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/53288</guid><dc:creator><![CDATA[ianperrin]]></dc:creator><pubDate>Wed, 27 Feb 2019 08:08:51 GMT</pubDate></item><item><title><![CDATA[Reply to [Help!] svg Graph in module MMM-Strava on Wed, 27 Feb 2019 07:41:49 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/lavolp3" aria-label="Profile: lavolp3">@<bdi>lavolp3</bdi></a> I found that the only way to create an SVG via the DOM was to use <code>document.createElementNS</code>. There’s a helper function (poorly named <code>getNode</code>) in the current master branch which supports the creation of an SVG tag with attributes (e.g. <code>getNode("svg", {width: 115, height: 68, class: 'chart'})</code></p>
<p dir="auto">However,  I’ve recently been implementing new <a href="https://developers.strava.com/docs/authentication/" target="_blank" rel="noopener noreferrer nofollow ugc">authentication flow</a> in the <em>develop</em> branch. Alongside that, I’ve switched to using nunjucks templating. There’s quite a few changes, including the <code>chart</code> mode now supporting the <code>period</code> option (i.e. <code>recent</code>,  <code>ytd</code>) and the ability to add multiple instances of the module to the mirror which could (should?) make implementing new views easier.</p>
<p dir="auto">My suggestion would be to add a new mode (<code>progress</code>) to the module along with a new template (<code>templates\MMM-Strava.progress.njk</code>) and start from there.</p>
<p dir="auto">Let me know how you get on and I can assist where possible.</p>
]]></description><link>https://forum.magicmirror.builders/post/53284</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/53284</guid><dc:creator><![CDATA[ianperrin]]></dc:creator><pubDate>Wed, 27 Feb 2019 07:41:49 GMT</pubDate></item></channel></rss>