Brian Dunning's FileMaker Custom Functions

progressRings ( width ; height ; defaultArray ; dataArray )

Draws a multi-ring SVG progress doughnut using customisable ring data.

  Be the first to rate this function Log in to vote

Jonni™   Jonni™ - Show more from this author

  Sample input:
progressRings ( 400 ; 400 ; $defaultArray ; $dataArray )
  Sample output:
Multi-ring SVG progress doughnut

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

This function generates a static, multi-ring progress doughnut using SVG, based on values passed in a valueArray JSON object. Each ring can specify its own stroke, color, and line cap, with fallbacks provided by a defaultArray. The drawing is rendered accurately across platforms, with fixed scaling that compensates for FileMaker’s zoom level. No text labels are shown.

The function returns an SVG URI (Base64, UTF-8, or embedded HTML for FM Go) that can be directly embedded in a Web Viewer.

Default Array Example

JSONSetElement ( "" ;

[ "color.background" ; "#FFFFFF" ; 1 ] ;

[ "endCap" ; "round" ; 1 ] ; // round, butt, square - or empty
[ "stroke" ; 14 ; 2 ] ;
[ "padding" ; 4 ; 2 ]

)

Data Array Example

JSONSetElement ( "" ;

[ "ring[+]value" ; 64 ; 2 ] ;
[ "ring[:]color.foreground" ; "#DF2F5D" ; 1 ] ;
[ "ring[:]color.background" ; "#F9D4DF" ; 1 ] ;
[ "ring[:]cap" ; "round" ; 1 ] ; // round, butt, square - or empty
[ "ring[:]stroke" ; 0 ; 6 ] ;

[ "ring[+]value" ; 58 ; 2 ] ;
[ "ring[:]color.foreground" ; "#67BD46" ; 1 ] ;
[ "ring[:]color.background" ; "#E2F2D9" ; 1 ] ;
[ "ring[:]endCap" ; "" ; 1 ] ; // round, butt, square - or empty
[ "ring[:]stroke" ; 0 ; 6 ] ;

[ "ring[+]value" ; 38 ; 2 ] ;
[ "ring[:]color.foreground" ; "#01B1DE" ; 1 ] ;
[ "ring[:]color.background" ; "#D6EFF7" ; 1 ] ;
[ "ring[:]cap" ; "" ; 1 ] ; // round, butt, square - or empty
[ "ring[:]stroke" ; 14 ; 6 ]

)

 

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: