-
Hi, I'm trying to make a pie chart based on a point but I can not do it. I did the following but it did not work:
<ma-get-point-value point-xid="DP_698831" point="myPoint"></ma-get-point-value> <ma-pie-chart style="height: 300px; width: 600px" values="[ { value: myPoint, text: 'hot', color: '#ff9300' }, { value: 5, text: 'cold', color: '#942192' } ]" options="{depth3D:15,angle:30}"></ma-pie-chart>
In the API it says that the value has to be number, someone knows to tell me how do I use the Point value instead of a number?
-
<ma-get-point-value point-xid="DP_698831" point="myPoint"></ma-get-point-value>
<ma-pie-chart style="height: 300px; width: 600px" values="[ { value: myPoint, text: 'hot', color: '#ff9300' }, { value: 5, text: 'cold', color: '#942192' } ]"
options="{depth3D:15,angle:30}"></ma-pie-chart>Hi Leoboeng
<ma-get-point-value point-xid="DP_698831" point="myPoint"></ma-get-point-value>
Returns you an object. So you need to reference the myPoint.value to the pie chart.
<ma-get-point-value point-xid="MBB_KNZ_4SML_LEV" point="myPoint"></ma-get-point-value> <ma-pie-chart style="height: 300px; width: 600px" values="[ { value: myPoint.value, text: 'hot', color: '#ff9300' }, { value: 5, text: 'cold', color: '#942192' } ]" options="{depth3D:15,angle:30}"></ma-pie-chart>
I used one of my XiDs and it works. You could use .name or .deviceName in the pie chart text if you like as well.
-
Thank you!!
And how do I show the rendered value? I tried the following but it did not work:<ma-get-point-value point-xid="DP_530359" point="P_Ativa_A"></ma-get-point-value> <ma-get-point-value point-xid="DP_807622" point="P_Ativa_B"></ma-get-point-value> <ma-get-point-value point-xid="DP_515819" point="P_Ativa_C"></ma-get-point-value> <ma-pie-chart id="63759ca9-e465-45e3-80b8-89cda82627fe" style="height: 303px; width: 612px; position: absolute; left: 0px; top: 30px;" values="[ { value: P_Ativa_A.renderedValue, text: 'Fase A', color: 'red' }, { value: P_Ativa_B.renderedValue, text: 'Fase B', color: 'black' }, { value: P_Ativa_C.renderedValue, text: 'Fase C', color: 'white' } ]" options="{depth3D:15,angle:30}"></ma-pie-chart> </div>
-
Hi leoboeng,
I tried what you have posted and it worked on my point that did not have any units or a suffix in the text renderer. However, when I added a unit like "Hz" to the point, the rendered value no longer worked.
You could do something like this to slice off the units from the rendered value string, but it's not ideal:
<ma-pie-chart id="63759ca9-e465-45e3-80b8-89cda82627fe" style="height: 303px; width: 612px; position: absolute; left: 0px; top: 30px;" values="[ { value: P_Ativa_A.renderedValue.slice(0, P_Ativa_C.renderedValue.indexOf(' ')), text: 'Fase A', color: 'red' }, { value: P_Ativa_B.renderedValue.slice(0, P_Ativa_C.renderedValue.indexOf(' ')), text: 'Fase B', color: 'black' }, { value: P_Ativa_C.renderedValue.slice(0, P_Ativa_C.renderedValue.indexOf(' ')), text: 'Fase C', color: 'white' } ]" options="{depth3D:15,angle:30}"></ma-pie-chart>
Why can't you use the value in the value field, and put part of the rendered value into the text or something? This is a numeric point, right? Aren't the value and the rendered value differing by the presence of units, or are you using a range rendered or scaling one unit to another or something? If so, you would need the output of the rendered value to be a number or to slice it down to being a number.
-
It looks to me like you are displaying the active power of a 3 phase power monitor. In the Pie chart API it says :
"This directive will display a pie chart for visualizing ratios." That is why the pie chart values do not correspond to the actual value and are displayed as a %. I would maybe look at using a different chart if you want to see actual KVA values. If I am wrong about the power monitor then just ignore me :) -
@phildunlap Yes it is a numerical point rendered with unity. They are power measurements, no conversions are made, the values are pulled directly from a ModBus TCP / IP meter.