Sign in to follow this  
jamesd128

making a pie chart

Recommended Posts

jamesd128    122
I want to make a pie chart that changes as the relative values change. More specifically, I want to take a circular image I have and overlay the colors on it. The only way I can think of to do this is basically create a Line class then draw it 360 times with increasing angles on top of the image with a lower opacity and change the colors accordingly. Is there a better way to do this?

Share this post


Link to post
Share on other sites
ET3D    810
I'd suggest drawing triangles and not lines, since you'll have to change the number of lines if you change the size, in order to make them cover the circle.

You could create a vertex buffer containing the centre point of the circle and the list of points on the circumference, and an index buffer. Then for each slice of the pie draw the relevant range of the index buffer. The colour could be set as a shader constant or the texture factor (depending on how you draw).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this