<ma-pie-chart example does not work?
-
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> -
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
-
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?
-
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.
-
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? -
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.
-
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>
-
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.
-
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.