Slices
A slice in jCanvas is, essentially, a slice of a circle (similar to a pizza slice).
Basic Usage
You can draw a slice using the drawSlice()
method. The size of a slice is determined by its start
, end
, and radius
properties.
The position of a slice is determined by its x
and y
properties. These coordinates lie at the tip of the slice.
Creating a pie chart
You can create a simple pie chart in jCanvas using the drawSlice()
method.
In the example below, the spread
property determines the spacing between slices. The property’s value is a multiple of the slice’s radius (from 0 to 1).
To add a text label to your pie chart, create a text layer using the drawText()
method.