<?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[How to delay graph redraws]]></title><description><![CDATA[<p dir="auto">I have a graph in a dashboard that is connected to 'from' and 'to' dates.<br />
I have a listener that watches for the 'from' date to change, and changes the 'to' date to be 24 hours after the new 'from'date.<br />
My problem: When I change the 'from' date, the graph redraws twice: once with the original 'to' date and again with the new 'to' date. This looks very unprofessional.</p>
<p dir="auto">Example:</p>
<ul>
<li>original 'from' date is 9/26/2016 midnight, original 'to' date is 9/27/2016 midnight.</li>
<li>date picker attached to 'from' date changes 'from' date to 9/22/2016 midnight.</li>
<li>'from' date listener in js code changes 'to' date to 9/23/2016 midnight.</li>
<li>graph redraws from 9/22/2016 midnight (new 'from' date) to 9/27/2016 midnight (old 'to' date).</li>
<li>graph then redraws again from 9/22/2016 midnight to 9/23/2016 midnight (new 'to' date).</li>
</ul>
<p dir="auto">If I could just tell the graph to not redraw "right away", I would be good. How do I do that?</p>
]]></description><link>https://forum.mango-os.com/topic/2476/how-to-delay-graph-redraws</link><generator>RSS for Node</generator><lastBuildDate>Fri, 12 Jun 2026 14:17:09 GMT</lastBuildDate><atom:link href="https://forum.mango-os.com/topic/2476.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 29 Sep 2016 20:39:04 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to delay graph redraws on Fri, 30 Sep 2016 21:51:47 GMT]]></title><description><![CDATA[<p dir="auto">I like that ma-calc. And I added that style to the chart. No change.</p>
]]></description><link>https://forum.mango-os.com/post/12789</link><guid isPermaLink="true">https://forum.mango-os.com/post/12789</guid><dc:creator><![CDATA[JHuckins]]></dc:creator><pubDate>Fri, 30 Sep 2016 21:51:47 GMT</pubDate></item><item><title><![CDATA[Reply to How to delay graph redraws on Fri, 30 Sep 2016 20:15:10 GMT]]></title><description><![CDATA[<p dir="auto">Also you may need to set a size on your &lt;ma-serial-chart&gt; depending on what it is contained within. Try adding the style property</p>
<p dir="auto"><code>style="width:100%; height:500px" </code></p>
<p dir="auto">and you may want to use &lt;ma-now&gt; to initialize the Day picker to yesterday or something.</p>
]]></description><link>https://forum.mango-os.com/post/12787</link><guid isPermaLink="true">https://forum.mango-os.com/post/12787</guid><dc:creator><![CDATA[Will Geller]]></dc:creator><pubDate>Fri, 30 Sep 2016 20:15:10 GMT</pubDate></item><item><title><![CDATA[Reply to How to delay graph redraws on Fri, 30 Sep 2016 20:03:28 GMT]]></title><description><![CDATA[<p dir="auto">I have a feeling you don't need to use JS to accomplish this. I just posted a similar solution using the &lt;ma-calc&gt; directive.</p>
<p dir="auto">Try adding this in your HTML and comment out the watcher from the JS:</p>
<pre><code>&lt;ma-calc input="from | moment:'add':24:'hours'" output="to"&gt;&lt;/ma-calc&gt;
</code></pre>
<p dir="auto">This should take in your from value from the date picker and output a new to value that will be 24 hours advance of from.</p>
]]></description><link>https://forum.mango-os.com/post/12786</link><guid isPermaLink="true">https://forum.mango-os.com/post/12786</guid><dc:creator><![CDATA[Will Geller]]></dc:creator><pubDate>Fri, 30 Sep 2016 20:03:28 GMT</pubDate></item><item><title><![CDATA[Reply to How to delay graph redraws on Fri, 30 Sep 2016 19:42:59 GMT]]></title><description><![CDATA[<p dir="auto">Thanks. That sounded like a great idea. Unfortunately, it did not work. I double-checked, and my watch function is the only place the 'from' and 'to' dates are set. I'm using Mango 3.2.2.</p>
]]></description><link>https://forum.mango-os.com/post/12785</link><guid isPermaLink="true">https://forum.mango-os.com/post/12785</guid><dc:creator><![CDATA[JHuckins]]></dc:creator><pubDate>Fri, 30 Sep 2016 19:42:59 GMT</pubDate></item><item><title><![CDATA[Reply to How to delay graph redraws on Fri, 30 Sep 2016 15:38:11 GMT]]></title><description><![CDATA[<p dir="auto">I think the problem is that the way you are doing it the <code>from</code> and <code>to</code> change in successive digest cycles instead of both at once. Try setting the <code>ng-model</code> of your date picker to another variable name e.g. <code>datePickerDate</code> then do</p>
<pre><code>$rootScope.$watch('datePickerDate', function() {
  $rootScope.from = $rootScope.datePickerDate;
  $rootScope.to = moment($rootScope.datePickerDate).add(1, 'days').toDate();
});
</code></pre>
]]></description><link>https://forum.mango-os.com/post/12775</link><guid isPermaLink="true">https://forum.mango-os.com/post/12775</guid><dc:creator><![CDATA[Jared Wiltshire]]></dc:creator><pubDate>Fri, 30 Sep 2016 15:38:11 GMT</pubDate></item><item><title><![CDATA[Reply to How to delay graph redraws on Fri, 30 Sep 2016 14:40:58 GMT]]></title><description><![CDATA[<p dir="auto">The idea is that the chart always shows a 24-hour period. When the 'from' date is changed by the user via the date picker, then the watch sets the 'to' date to 24 hours later.</p>
]]></description><link>https://forum.mango-os.com/post/12774</link><guid isPermaLink="true">https://forum.mango-os.com/post/12774</guid><dc:creator><![CDATA[JHuckins]]></dc:creator><pubDate>Fri, 30 Sep 2016 14:40:58 GMT</pubDate></item><item><title><![CDATA[Reply to How to delay graph redraws on Fri, 30 Sep 2016 14:39:13 GMT]]></title><description><![CDATA[<p dir="auto">&lt;!-- this is the date picker for the 'from' date --&gt;<br />
&lt;mdp-date-picker class="custom-date" mdp-open-on-click="" mdp-format="ll" ng-model="from"&gt;&lt;/mdp-date-picker&gt;</p>
<p dir="auto">&lt;!-- these are the points --&gt;<br />
&lt;ma-point-values point="Dpoint1" values="D1Static" from="from" to="to" rollup="AVERAGE" rollup-interval="1 minutes"&gt;&lt;/ma-point-values&gt;<br />
&lt;ma-point-values point="Dpoint2" values="D2Static" from="from" to="to" rollup="AVERAGE" rollup-interval="1 minutes"&gt;&lt;/ma-point-values&gt;<br />
&lt;ma-point-values point="Dpoint3" values="D3Static" from="from" to="to" rollup="AVERAGE" rollup-interval="1 minutes"&gt;&lt;/ma-point-values&gt;<br />
&lt;ma-point-values point="Dpoint4" values="D4Static" from="from" to="to" rollup="AVERAGE" rollup-interval="1 minutes"&gt;&lt;/ma-point-values&gt;<br />
&lt;ma-point-values point="Dpoint5" values="D5Static" from="from" to="to" rollup="AVERAGE" rollup-interval="1 minutes"&gt;&lt;/ma-point-values&gt;</p>
<p dir="auto">&lt;!-- this is the chart --&gt;<br />
&lt;ma-serial-chart<br />
series-1-values="D1Static" series-1-point="Dpoint1" series-1-color='#ffaa00'<br />
series-2-values="D2Static" series-2-point="Dpoint2" series-2-color='#0000aa'<br />
series-3-values="D3Static" series-3-point="Dpoint3" series-3-color='#00cc00'<br />
series-4-values="D4Static" series-4-point="Dpoint4" series-4-color='#ff66cc'<br />
series-5-values="D5Static" series-5-point="Dpoint5" series-5-color='#ff0000' series-5-axis="right"<br />
options="{legend: {}, chartCursor: {categoryBalloonDateFormat: 'YYYY-MM-DD HH:NN'}, titles:[{text: 'Dispatch', size: 15}], valueAxes:[{title:'kW/kVAR', position:'left'},{title:'SOC%', position:'right'}]}"&gt;<br />
&lt;/ma-serial-chart&gt;</p>
<p dir="auto">----------------------JS code that is executed inside maDashboards.run in maDashboards.js -------------<br />
$rootScope.$watch('from', function() {<br />
$<a href="http://rootScope.to" rel="nofollow ugc">rootScope.to</a> = moment($rootScope.from).add(1, 'days').toDate();<br />
});</p>
]]></description><link>https://forum.mango-os.com/post/12773</link><guid isPermaLink="true">https://forum.mango-os.com/post/12773</guid><dc:creator><![CDATA[JHuckins]]></dc:creator><pubDate>Fri, 30 Sep 2016 14:39:13 GMT</pubDate></item><item><title><![CDATA[Reply to How to delay graph redraws on Thu, 29 Sep 2016 22:38:01 GMT]]></title><description><![CDATA[<p dir="auto">Would you mind posting your code so we can help you? JS and HTML please.</p>
]]></description><link>https://forum.mango-os.com/post/12770</link><guid isPermaLink="true">https://forum.mango-os.com/post/12770</guid><dc:creator><![CDATA[Will Geller]]></dc:creator><pubDate>Thu, 29 Sep 2016 22:38:01 GMT</pubDate></item></channel></rss>