• Recent
    • Tags
    • Popular
    • Register
    • Login

    Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website

    <ma-pie-chart example does not work?

    Dashboard Designer & Custom AngularJS Pages
    3
    9
    2.2k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      Phillip Weeks
      last edited by

      This example copied straight from the pie chart example in the API docs does not render anything in the play area.

      <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}"></ma-pie-chart>

      1 Reply Last reply Reply Quote 0
      • phildunlapP
        phildunlap
        last edited by

        Hi Phillip,

        Huh, that's not what it looks like inside my API Docs tab for ma-pie-chart from Mango 3. I see this:

        <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}"></ma-pie-chart>
        

        The error in the one you posted is probably the double quote around the values object while double quoting all the keys / values inside it too. I see

        0_1494876673845_pie.png

        1 Reply Last reply Reply Quote 0
        • P
          Phillip Weeks
          last edited by

          Thanks Phil, it was a cache issue causing the pie-chart not to render.
          My goal is to input 2 stats objects values as inputs for the value field of the values array list. I do not understand how to pass the parameter correctly..

          <ma-point-statistics point="points[0]" from="from" to="to" statistics="statsObj1"></ma-point-statistics>
          <ma-point-statistics point="points[1]" from="from" to="to" statistics="statsObj2"></ma-point-statistics>

          <ma-pie-chart style="height: 300px; width: 600px" values="[ { value: statsObj1.sum.value, text: 'hot', color: '#ff9300' }, { value: statsObj2.sum.value, text: 'cold', color: '#942192' } ]"
          options="{depth3D:15,angle:30}"></ma-pie-chart>

          I believe this breaks because statsObj2.sum.value is returning a string that has the unit descriptor. ie. "251.00 LP5M" and value expects a number which I do not know how to convert to 251 inside the directive as in {{statsObj2.sum.value | limitTo:5}}

          can I use <ma-calc here somehow?

          1 Reply Last reply Reply Quote 0
          • Jared WiltshireJ
            Jared Wiltshire
            last edited by

            Assuming you are running Mango v3, you can add rendered="false" to <ma-point-statistics> to get the stats as a number rather than a string.

            Sorry some of our documentation is not quite up to date, we are working on that for the UI 3.0.2 release.

            Developer at Radix IoT

            1 Reply Last reply Reply Quote 0
            • P
              Phillip Weeks
              last edited by Phillip Weeks

              Well that would be another good reason to move to mango 3
              We are v2.8 and this is my wip dashboard .. can't I simply convert the string to a number somehow and enter that value?

              0_1494947320817_upload-b070560f-ecd1-4d52-bc4c-f4508a514440

              1 Reply Last reply Reply Quote 0
              • phildunlapP
                phildunlap
                last edited by

                I suspect this thread may have a workaround for you: https://forum.infiniteautomation.com/topic/2700/problem-with-statistics/9

                It uses the slice() function on the value.

                1 Reply Last reply Reply Quote 0
                • P
                  Phillip Weeks
                  last edited by Phillip Weeks

                  OK look like what I need. the number with suffix is "250.50 LP5M"
                  OMG this actually worked thank Gawd.. And thank-you for your help guys. :)

                  <ma-pie-chart style="height: 300px; width: 40%" values="[ { value: statsObj1.sum.value.slice(0,-5), text: 'hot', color: 'orange' }, { value: statsObj2.sum.value.slice(0,-5), text: 'cold', color: 'blue' } ]"
                  	options="{depth3D:15,angle:30}"></ma-pie-chart> <br>
                  
                  1 Reply Last reply Reply Quote 0
                  • phildunlapP
                    phildunlap
                    last edited by phildunlap

                    Try

                    <ma-pie-chart style="height: 300px; width: 40%" values="[ { value: statsObj0.sum.value.split(' ')[0], text: 'hot', color: 'orange' }, { value: statsObj1.sum.value.split(' ')[0], text: 'cold', color: 'blue' } ]" options="{depth3D:15,angle:30}"></ma-pie-chart>

                    Meaning no parseFloat(), no number(), no {{ }}, and I don't think you can assign to a variable name like 'statsObj[0]' since that has the meaning item "0" in the statsObj obj (which is probably a list index). Although from your earlier post it looks like the points are the ones in a list? So that's an issue, the name for the statsObj is different in the ma-point-statistics tags earlier in the thread.

                    1 Reply Last reply Reply Quote 0
                    • P
                      Phillip Weeks
                      last edited by Phillip Weeks

                      Yes that was it... :) Works with both methods. I like split better. Yes that was just me trying the statsObj array output as well as individual point method to see if there was a difference in how it worked. Thanks again Guys.

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post