Brian Dunning's FileMaker Custom Functions

chartDoughnut ( width ; height ; defaultArray ; dataArray )

Displays a multi-segment doughnut chart using SVG, with support for custom colours, stroke width, segment padding, and end caps.

  Be the first to rate this function Log in to vote

Jonni™   Jonni™ - Show more from this author

  Sample input:
chartDoughnut ( 400 ; 400 ; $defaultArray ; $dataArray )
  Sample output:
Generates svg doughnut chart to display in a web widget

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

The chartDoughnut function renders a scalable, circular doughnut chart with multiple segments, each defined by value and colour. Segments are proportionally distributed across the ring based on value totals, with optional padding between slices. Stroke thickness, background fill, and end cap style (round, square, or butt) are fully customisable. Works seamlessly across FileMaker Pro, WebDirect, and FileMaker Go using responsive SVG.

Default Array Example

JSONSetElement ( "" ;

[ "stroke" ; 40 ; 2 ] ;
[ "endCap" ; "round" ; 1 ] ;
[ "padding" ; 20 ; 2 ] ; // degrees between segments
[ "background.fill" ; "#FFFFFF" ; 1 ] ;
[ "color.background" ; "#FFFFFF" ; 1 ] ;
[ "radius" ; 150 ; 2 ]

)

Data Array Example

JSONSetElement ( "" ;

[ "segments[+]value" ; 30 ; 2 ] ;
[ "segments[:]color" ; "#DF2F5D" ; 1 ] ;
[ "segments[+]value" ; 50 ; 2 ] ;
[ "segments[:]color" ; "#67BD46" ; 1 ] ;
[ "segments[+]value" ; 20 ; 2 ] ;
[ "segments[:]color" ; "#01B1DE" ; 1 ]

)

 

Comments

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 21 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: