layerPiechart
layerPiechart(
options?):FragmentLayer
Defined in: packages/node-piechart/src/layer.ts:187
Creates a piechart layer that renders slices around a shape. The piechart follows the contour of whatever SDF shape is used.
Parameters
options?
FactoryOptionsFromSchema<{ defaultColor: PropertySchema<string, "color", false>; offset: PropertySchema<number, "number", true>; slices: ArrayPropertySchema<{ color: PropertySchema<string, "color", true>; value: PropertySchema<number, "number", true>; }>; }>
Piechart configuration options
Returns
FragmentLayer definition
Example
// Simple piechart with fixed colorsconst piechartLayer = layerPiechart({ slices: [ { color: "#ff0000", value: { attribute: "value1" } }, { color: "#00ff00", value: { attribute: "value2" } }, { color: "#0000ff", value: { attribute: "value3" } }, ],});
// Use with createNodeProgramconst program = createNodeProgram({ shapes: [sdfCircle()], layers: [piechartLayer],});