Problem with Pie Chart
-
I suggest you also check the network tab and refresh the page.
filter out point-value requests and check to see if you've got values coming through for a start. Once we have those, we can apply the changes you've inputted with those string based functions to ensure the pie charts are actually getting real numerical values...
Not enough info here to work out what you've done/changed since the info that Phil gave you. -
^ This
which could be aided by printing what the values you're passing to the pie chart directive is, like,
{{ P_Reativa_A.renderedValue.slice(0, P_Reativa_A.renderedValue.indexOf(' ')) }}
somewhere on the page.
-
I have already updated the page, restart the server, check the internet and everything ok. I did a chart pie only with the values of the points "point.value" and showed everything correctly. I did not move in any configuration of the point, it was working correctly and the point is still being updated the values, just does not show the graph anymore. So much so that the "Total" is the sum of all the points that compose the char pie.
I did not make any major changes to the code that was passed to me just added some items that are not part of the chart pie. On the chart pie I just added the caption.
-
@leoboeng said in Problem with Pie Chart:
I did a chart pie only with the values of the points "point.value" and showed everything correctly.
Then why not just stick to using '.value' rather than using '.renderedValue' and making it more complicated than necessary?
-
@mattfox said in Problem with Pie Chart:
Then why not just stick to using '.value' rather than using '.renderedValue' and making it more complicated than necessary?
For it is about electrical measurements and the better visually go accompanied by their units. In addition, the meter pulls data with 4 houses after the comma, for example 5.0892, and I want to work with only 2 houses.
In the matter of decimals it is quieter because the "point.renderedValue" only works with this type. It stops working when I add the Unit of measurement and this for me is very important because there are other graphs, and lists that work with it, so I can not take it. And it is not at all feasible for me to create 2 points just to make that point distinction with unit of measure and point without unity.
-
So you're telling me the data comes in as comma separated values???
Could you please output the individual points data line by line so I can see how it sits within your markup? -
@mattfox said in Problem with Pie Chart:
So you're telling me the data comes in as comma separated values???
Could you please output the individual points data line by line so I can see how it sits within your markup?I have no more in front of the server for this, and even apologize for my English, I'm from Brazil and here the separation is made by commas (,), in the case of you points (.).
The values come in the following format, for example:
Electric_current_Phase_A:
5.0490
5.9382
4.0983In my formatting by Mango, it shows as follows:
Electric_current_Phase_A:
5.04 A
5.93 A
4.09 AThat is why I say that the need for units is important to me, in the case of exemple the Amper (A), and this is what has been complicating my Pie Chart.
-
So first off, the units come in looking like
5,0490 5,9382 4,0983
the comma for each measurement's decimal place and a space to separate each house. And this is for each datapointSecondly, you only want the units to be 3 significant figures long, without rounding.
Thirdly, you want to be able to use the Unit on the pie chart.
I'm I hitting the nail on the head?if so, this is how I'd do it and just add the unit to the text.
A_AtivoDiario_P.renderedValue.split(' ')[0]), text: 'Fase A (A)'
if it's because it's a string you may have to use
parseFloat( A_AtivoDiario_P.renderedValue.split(' ')[0]) )
With some of this stuff here I sometimes think you over complicate things too much. If what is currently available in mango allows multiple axes gauge charts, that can do the same thing and you can label it as required...
https://www.amcharts.com/kbase/animating-angular-gauge-bands/ -
@mattfox said in Problem with Pie Chart:
So first off, the units come in looking like 5,0490 5.9382 4,0983 the comma for each measurement's decimal place and a space to separate each house.
Secondly, you only want the units to be 3 significant figures long, without rounding.
Thirdly, you want to be able to use the Unit on the pie chart.
I'm I hitting the nail on the head?Yes that's right.
The formatting with 3 significant units but I already got it.
In the pie chart without the Units of Measurements it is possible to make a "point.renderedValue", but when units are added the pie chart does not work.
So I used the "Slice", as I was shown, it worked about 2-3 days and today started to present that problem.
-
@mattfox said in Problem with Pie Chart:
if so, this is how I'd do it and just add the unit to the text
But doing so I would have to take the unit out of the point configuration, correct?
-
Don't see how its different from using splice, it's still visible in the text label
-
I tried the following ways and even then continued showing a pie chart in "white"
<ma-get-point-value point-xid="DP_530359" point="P_Ativa_A"></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: parseFloat( P_Ativa_A.renderedValue.split(' ')[0]), text: 'Fase B', color: 'black' },]" options="{depth3D:15,angle:30}"></ma-pie-chart>
<ma-get-point-value point-xid="DP_530359" point="P_Ativa_A"></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.split(' ')[0], text: 'Fase A (A)', color: 'black' },]" options="{depth3D:15,angle:30}"></ma-pie-chart>
All two codes showed the graphic in "white":
My points are configured as follows:
It pulls the data as follows:
-
If your .value has to many decimals use toFixed() to reduce it.
values="[ { value: myPoint.value.toFixed(2), text: 'Consumo na Ponta (kW)', color: 'red' }
Trying to get the unit on the value seems to be giving more problems than it is worth. Is it not enough to put the unit in the text?
-
@craigweb said in Problem with Pie Chart:
Trying to get the unit on the value seems to be giving more problems than it is worth. Is it not enough to put the unit in the text?
Hello,
Yes, but the problem I was facing is that even the decimal place I was able to put rendered, ie the value of the point came with 4 decimal places and just wanted to show 2, but your formula that passed me has already served and worked.
It would be nice to have the unit follow up but I'll text it.
Ah, thanks for the help.
-
Try this for your text
text: 'Phase A ' + myPoint.unit,
-
@craigweb that's what I've been trying to get him to do all along. I was going to suggest using toFixed or even parseFloat but he wanted significant figures without rounding.