PieSizeAndPosition

To define the possible options for how a pie chart should appear, we use an enumerated data type design pattern that was previously introduced in this chapter. The code required is shown in Figure 15-37.

Figure 15-36. PieChart.cartesian-to-polar method listing.
{method protected {cartesian-to-polar x:Distance,
    y:Distance}:(angle:Angle, magnitude:Distance)

    let magnitude:Distance = {sqrt x * x + y * y}
    let angle:Angle = {atan y / x}
    {return angle, magnitude}
}
Figure 15-37. PieSizeAndPosition enumerated listing.
{define-enum public PieSizeAndPosition
    eLargeCenter,
    eSmallCenter,
    eSmallTopLeft,
    eSmallTopRight,
    eSmallBottomLeft,
    eSmallBottomRight
}

The values contained in the PieSizeAndPosition enumerated class will be used ...

Get Enterprise Curl now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.