How to make a Pie or a normal Chart

How do I…

Create a Pie Chart using Object Variables and Array Variables that is dynamic.

What is the expected result

A chart graphic that is influenced by data from the game to show if one thing is bigger overall than the other.

What is the actual result

I can’t find anything for a dynamic result like this outside a Bar chart. But nothing for comparing data.

For sure you want to use shape painter for drawing chart

Next thing you want is same as HP calculation formula to get % of your current HP providing your max and current HP value

100 / MaxHealth * CurrentHealth

Where 100 here represents 100%

Now your equation would be
100 / Maximum value * Number from array var

You can now spit results to some other array vars
And now tricky part would be to draw each pie chart with shape painter on top of each other
BUT part i do not know how to do is to how to rotate other shape painter to end of previous shape painter so they line up like actual chart

For that someone else would need to come up with some idea
I would assume it would be something like equation
360 / Max value * Previous array var value
360 instead of 100 cause we want 360° here
And now we get what kind of angle we should rotate next shape painter object based on what was value of previous shape painter

This is one way to draw a pie chart on a shape painter with the coordinates set to relative.

It uses 6 variables. Values is an array and the other variables are numbers, Total, Counter, Child, Angle, LastAngle

Result
20240421_111806

You could use a string array to hold a list of colors and then change the fill color based on the Counter value or a player color.

Shape painter fill color = Colors[Counter]

The first event adds the array values, the for each child creates a total, the repeat draws the shapes. LastAngle is set to 0. So, the chart starts at 0. Be sure to reset the LastAngle each time.

1 Like

There is a pending extenstion called Chart by z900625:

However, it’s not approved or tested yet. You might wait or download it if you are in hurry.

2 Likes