Conic-Gradient Degree Segments Pie Fractions
Convert nonnegative pie weights into consecutive conic-gradient angle stops totaling one turn.
Description
A pie-style conic gradient assigns each category a share of one 360-degree turn.
A pie-style conic gradient assigns each category a share of one 360-degree turn. Zero weights occupy zero angular width, while positive weights divide the turn in proportion to their values.1
Convert nonnegative pie weights into consecutive conic-gradient angle stops totaling one turn.
When to use Conic-Gradient Degree Segments Pie Fractions
Use this tool to convert nonnegative pie weights into consecutive conic-gradient angle stops totaling one turn.
Choose the CSS values, dimensions or counts for this calculation. Supply resolved numeric measurements in matching units and the explicit reference box or writing mode where required.
How to use Conic-Gradient Degree Segments Pie Fractions and understand its results
- Choose the CSS values, dimensions or counts for this calculation. Supply resolved numeric measurements in matching units and the explicit reference box or writing mode where required.
- Enter weights using the field table and calculation rules, then run the tool.
- Read startDegrees, endDegrees, fractions. The explanation below defines the units, signs, ordering and any flags or placeholder values.
- If the tool reports an input issue, correct the values and run it again. Apply the stated assumptions when interpreting a successfully returned result.
| Input field | Meaning | Value type; see rules below | Requirement |
|---|---|---|---|
| weights | Pie segment weights | list of number; minimum: 0; minimum entries: 1; maximum entries: 1000 | Required |
Enter one through 1,000 nonnegative weights with at least one positive value. The tool scales by the maximum to avoid overflowing the sum, normalizes fractions and accumulates consecutive start/end degree lists in input order. The first segment starts at 0 and the final end is forced to 360. Zero-weight entries remain in the aligned lists as zero-width segments.
fraction_i = weight_i/Σweights; segment span_i = 360° × fraction_i Units, indexing, boundary conditions and exceptional cases are defined in the calculation rules above.
| Output field | Meaning | Value type |
|---|---|---|
| startDegrees | Segment start angles | list of number; minimum: 0 |
| endDegrees | Segment end angles | list of number; minimum: 0 |
| fractions | Normalized segment fractions | list of number; minimum: 0 |
{
"input": {
"weights": [
1,
1,
2
]
},
"output": {
"startDegrees": [
0,
90,
180
],
"endDegrees": [
90,
180,
360
],
"fractions": [
0.25,
0.25,
0.5
]
}
} Limitations and assumptions
It returns numeric stops rather than CSS, colors or rendered artwork. A gradient's rotation and center are separate choices. Floating-point arithmetic can reduce extremely small weights to negligible spans; the tool does not impose a minimum visible segment.
Numeric inputs must be finite. Follow the calculation-specific rules for overflow, underflow and exceptional cases. Missing required fields, extra fields, wrong value types and violations of the calculation rules are input errors.
Alternative or Complementary methods
Use Gradient Angle Compass Direction Map: Convert an exact compass direction to its CSS linear-gradient angle, measured clockwise from upward. For a complementary task, use Keyframe Percent Even Split Calculator: Generate evenly spaced keyframe percentages including 0 and 100 from a count of at least two, returning full number precision and limiting materialization to 10,000 offsets.
References
Similar or alternative tools
- Gradient Angle Compass Direction Map
Convert an exact compass direction to its CSS linear-gradient angle, measured clockwise from upward.
- Keyframe Percent Even Split Calculator
Generate evenly spaced keyframe percentages including 0 and 100 from a count of at least two, returning full number precision and limiting materialization to 10,000 offsets.