<?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[Adaptive Layout Page Templates: Chart Scaling Issue]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I've had an issue with using the page templates and the scaling of my charts for viewing on multiple devices. I've created an example here to explain.</p>
<p dir="auto">Using the following command we produce a pie chart:</p>
<pre><code>&lt;ma-pie-chart style="height: 300px; width: 600px" values='[ { "value": 30, "text": "hot", "color": "#ff9300" }, { "value": 70, "text": "cold", "color": "#942192" } ]' options="{depth3D:15,angle:30}"&gt;&lt;/ma-pie-chart&gt;
</code></pre>
<p dir="auto">Also, using the following command supplied by the example page templates, we can create a 4 card dashboard:</p>
<pre><code>&lt;div flex layout="column" layout-fill&gt;
    &lt;div flex layout="column" layout-gt-sm="row"&gt;
        &lt;md-card flex&gt;
            &lt;md-card-content&gt;
                Card 1
            &lt;/md-card-content&gt;
        &lt;/md-card&gt;

        &lt;md-card flex&gt;
            &lt;md-card-content&gt;
                Card 2
            &lt;/md-card-content&gt;
        &lt;/md-card&gt;
    &lt;/div&gt;
    &lt;div flex layout="column" layout-gt-sm="row"&gt;
        &lt;md-card flex&gt;
            &lt;md-card-content&gt;
                Card 3
            &lt;/md-card-content&gt;
        &lt;/md-card&gt;

        &lt;md-card flex&gt;
            &lt;md-card-content&gt;
                Card 4
            &lt;/md-card-content&gt;
        &lt;/md-card&gt;
    &lt;/div&gt;
&lt;/div&gt;
</code></pre>
<p dir="auto">I have placed a pie chart in one of the cards:</p>
<pre><code>&lt;div flex layout="column" layout-fill&gt;
    &lt;div flex layout="column" layout-gt-sm="row"&gt;
        &lt;md-card flex&gt;
            &lt;md-card-content&gt;
            &lt;ma-pie-chart style="height: 300px; width: 600px" values='[ { "value": 30, "text": "hot", "color": "#ff9300" }, { "value": 70, "text": "cold", "color": "#942192" } ]' options="{depth3D:15,angle:30}"&gt;&lt;/ma-pie-chart&gt;
            &lt;/md-card-content&gt;
        &lt;/md-card&gt;

        &lt;md-card flex&gt;
            &lt;md-card-content&gt;
                Card 2
            &lt;/md-card-content&gt;
        &lt;/md-card&gt;
    &lt;/div&gt;
    &lt;div flex layout="column" layout-gt-sm="row"&gt;
        &lt;md-card flex&gt;
            &lt;md-card-content&gt;
                Card 3
            &lt;/md-card-content&gt;
        &lt;/md-card&gt;

        &lt;md-card flex&gt;
            &lt;md-card-content&gt;
                Card 4
            &lt;/md-card-content&gt;
        &lt;/md-card&gt;
    &lt;/div&gt;
&lt;/div&gt;
</code></pre>
<p dir="auto">This produces the following output:<br />
<img src="https://camo.nodebb.org/8f3de90361315b734251d8a8aa45f6a6b59aa2df?url=https%3A%2F%2Fi.imgur.com%2FmKYtrsF.png" alt="0_1499153739621_3cc2bf16-da6b-4bd8-90b1-6bf168bb66d8-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Now modifying the width of the chart to</p>
<pre><code>style="height: 300px; width: 100%"
</code></pre>
<p dir="auto">I get the following output:<br />
<img src="https://camo.nodebb.org/71ef138f456099d5c343749bac7ff6a6bf5fcc93?url=https%3A%2F%2Fi.imgur.com%2Fb6sYPrs.png" alt="0_1499153874540_14570ba1-7fd8-42e4-8e59-fbdfff3403d7-image.png" class=" img-fluid img-markdown" /><br />
Which works, and I am happy. However, when I modify the height of the chart to autoscale, i.e.</p>
<pre><code>style="height: 100%; width: 100%"
</code></pre>
<p dir="auto">The chart effectively has 0 height, and appears like this:<br />
<img src="https://camo.nodebb.org/0f00daa344cc7e9ba4ba03c3a06d5e1b7d4cedcc?url=https%3A%2F%2Fi.imgur.com%2Flvoo8Hg.png" alt="0_1499154008110_9f862a73-8192-4e71-a869-b46868e3690b-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">This is frustrating me as I do not want to fix the height of my charts inside this template - as they look incorrect on difference devices. I'm also confused because it appears to work for pictures, but not for charts and other objects. For instance:</p>
<pre><code>&lt;div flex layout="column" layout-fill&gt;
    &lt;div flex layout="column" layout-gt-sm="row"&gt;
        &lt;md-card flex&gt;
            &lt;md-card-content&gt;
              &lt;img id="46b1f6e0-2357-4356-bcb0-198a58d52d3a" style="height: 100%;width:100%" src="http://wallpaper-gallery.net/images/image/image-13.jpg"&gt;
            &lt;/md-card-content&gt;
        &lt;/md-card&gt;

        &lt;md-card flex&gt;
            &lt;md-card-content&gt;
              &lt;img id="46b1f6e0-2357-4356-bcb0-198a58d52d3a" style="height: 100%;width:100%" src="http://wallpaper-gallery.net/images/image/image-13.jpg"&gt;
            &lt;/md-card-content&gt;
        &lt;/md-card&gt;
    &lt;/div&gt;
    &lt;div flex layout="column" layout-gt-sm="row"&gt;
        &lt;md-card flex&gt;
            &lt;md-card-content&gt;
              &lt;img id="46b1f6e0-2357-4356-bcb0-198a58d52d3a" style="height: 100%;width:100%" src="http://wallpaper-gallery.net/images/image/image-13.jpg"&gt;
            &lt;/md-card-content&gt;
        &lt;/md-card&gt;

        &lt;md-card flex&gt;
            &lt;md-card-content&gt;
              &lt;img id="46b1f6e0-2357-4356-bcb0-198a58d52d3a" style="height: 100%;width:100%" src="http://wallpaper-gallery.net/images/image/image-13.jpg"&gt;
            &lt;/md-card-content&gt;
        &lt;/md-card&gt;
    &lt;/div&gt;
&lt;/div&gt;

</code></pre>
<p dir="auto">Produces:<br />
<img src="https://camo.nodebb.org/4ad0bd0a8939f86719f87f6f6c8d4df3aa92f9df?url=https%3A%2F%2Fi.imgur.com%2FFL2BRPW.png" alt="0_1499154710001_e8031a9e-ae86-4c4a-85a8-42c9cfe92d76-image.png" class=" img-fluid img-markdown" /><br />
Which is exactly what I would like to have because as you vary the size of the browser window the picture will not exceed the size of the card.</p>
<p dir="auto">Do you have any possible suggestions which will allow me to 'place' a chart in a card and vary with browser window without the chart having fixed dimensions and 'spilling' over the edge of the card?</p>
<p dir="auto">Thank you in advance!</p>
]]></description><link>https://forum.mango-os.com/topic/2838/adaptive-layout-page-templates-chart-scaling-issue</link><generator>RSS for Node</generator><lastBuildDate>Thu, 14 May 2026 13:06:42 GMT</lastBuildDate><atom:link href="https://forum.mango-os.com/topic/2838.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 04 Jul 2017 07:58:07 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Adaptive Layout Page Templates: Chart Scaling Issue on Thu, 22 Apr 2021 00:45:58 GMT]]></title><description><![CDATA[<p dir="auto">Yes, use the flex attribute - some of card examples show how it works. Just replace their md-cards with divs.<br />
Read up on angularJs material's flex. <em>Or</em> read up on using CSS grid on how to put components in the centre. css tricks has an excellent tutorial.<br />
Sorry don't have time right now to give you a complete example.<br />
Can always do so later tonight.</p>
<p dir="auto">Fox</p>
]]></description><link>https://forum.mango-os.com/post/26572</link><guid isPermaLink="true">https://forum.mango-os.com/post/26572</guid><dc:creator><![CDATA[MattFox]]></dc:creator><pubDate>Thu, 22 Apr 2021 00:45:58 GMT</pubDate></item><item><title><![CDATA[Reply to Adaptive Layout Page Templates: Chart Scaling Issue on Thu, 22 Apr 2021 00:28:15 GMT]]></title><description><![CDATA[<p dir="auto">worked like a charm, thanks always for the help <a class="plugin-mentions-user plugin-mentions-a" href="/user/mattfox" aria-label="Profile: MattFox">@<bdi>MattFox</bdi></a>.</p>
<p dir="auto">Another question that will again probably be very basic, is there a way for me to auto centre a &lt;ma-tank-level&gt; or a &lt;ma-gague-chart&gt; within a card?</p>
]]></description><link>https://forum.mango-os.com/post/26571</link><guid isPermaLink="true">https://forum.mango-os.com/post/26571</guid><dc:creator><![CDATA[zenvakil]]></dc:creator><pubDate>Thu, 22 Apr 2021 00:28:15 GMT</pubDate></item><item><title><![CDATA[Reply to Adaptive Layout Page Templates: Chart Scaling Issue on Wed, 21 Apr 2021 09:19:39 GMT]]></title><description><![CDATA[<p dir="auto">use viewport width.</p>
<pre><code>height:0.3vw;
</code></pre>
<p dir="auto">Fox</p>
]]></description><link>https://forum.mango-os.com/post/26570</link><guid isPermaLink="true">https://forum.mango-os.com/post/26570</guid><dc:creator><![CDATA[MattFox]]></dc:creator><pubDate>Wed, 21 Apr 2021 09:19:39 GMT</pubDate></item><item><title><![CDATA[Reply to Adaptive Layout Page Templates: Chart Scaling Issue on Wed, 21 Apr 2021 08:59:49 GMT]]></title><description><![CDATA[<p dir="auto">Hi Henry,</p>
<p dir="auto">May be a stupid question, but is there a way to give them an aspect ratio?</p>
]]></description><link>https://forum.mango-os.com/post/26569</link><guid isPermaLink="true">https://forum.mango-os.com/post/26569</guid><dc:creator><![CDATA[zenvakil]]></dc:creator><pubDate>Wed, 21 Apr 2021 08:59:49 GMT</pubDate></item><item><title><![CDATA[Reply to Adaptive Layout Page Templates: Chart Scaling Issue on Wed, 05 Jul 2017 17:54:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/henryblu" aria-label="Profile: henryblu">@<bdi>henryblu</bdi></a> the reason that images work is because the browser is displaying them with a fixed aspect ratio. For example the image you linked has a natural size of 1000px by 500px, so it has an aspect ratio of 1.5. The browser is laying out the cards with 50% of the width each, it works out the width of the card and calculates the height of the image as (width / 1.5).</p>
<p dir="auto">The charts do not have a natural aspect ratio so the cards end up with <code>0</code> height.</p>
<p dir="auto">I'd recommend giving the charts a fixed height and set their width to <code>100%.</code></p>
]]></description><link>https://forum.mango-os.com/post/14809</link><guid isPermaLink="true">https://forum.mango-os.com/post/14809</guid><dc:creator><![CDATA[Jared Wiltshire]]></dc:creator><pubDate>Wed, 05 Jul 2017 17:54:43 GMT</pubDate></item></channel></rss>