Jump to content

dxDrawCircle chart


saca

Recommended Posts

Hello saca,

do you know about the dxDrawCircle function? You can use the startAngle and stopAngle parameters to specify the intervals of the pie-chart colors. For example...

addEventHandler("onClientRender", root,
    function()
        dxDrawCircle(100, 100, 100, 100, 0, 90, tocolor(255, 255, 255, 255));
        dxDrawCircle(100, 100, 100, 100, 90, 180, tocolor(255, 0, 0, 255));
        dxDrawCircle(100, 100, 100, 100, 180, 270, tocolor(0, 255, 0, 255));
        dxDrawCircle(100, 100, 100, 100, 270, 360, tocolor(0, 0, 255, 255));
    end
);

This method may not create the best-approximated circle due to triangle-based approximation. You can use shaders and custom math using sin/cos to create a smoother circle. Basically, you use the euler distance equation to determine if the point is inside the circle to draw it, and then you use smart quadrant-based inversion of the sinus function to determine the angle of the pixel. Then you can simply look-up the color from shader values to draw for the circle angle intervals.

Good luck!

  • Like 1
Link to comment

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...