I want to make a pie chart for my game and it can’t be an image because it has changing values. How would I make this?
Hi
I don’t know how accurate the chart needs to be, but one possible way to do it is using a set of images each of which is a different sector of the chart; so something like:
Here I just used 8 images to show quickly what i mean, you could of course use more.
Each image is a white sector of the circle.
You can then change the ImageColor3 of each image to colour them as you want, so that way your code could display different chart values.
This wouldn’t work well if you need the chart to be accurate to 1 degree, cos creating 360 different images doesn’t sound a good idea. But if you maybe only wanted accuracy of 10 degress then creating 36 different images could work ok.
n.b. instead of creating lots of different images you could possibly also create one and then reuse it and rotate the image object in studio
You could use solid modelling to do this.
You will need to have two half cilinder and two negated parts.
You can make 2 semicircles of every color, using both of them would make a full circle of one color, and if you want to mix colors just rotate the semicircles accordingly and place them above and under each other.
I am writing this for anyone that needs more detailed version of piechart. Here is one I made using realmile’s method.
https://gyazo.com/123fdded6507268a2e716bad4f5eb016
Code is messy, but I hope you can clean it up.
PieChart.rbxl (33.1 KB)