Brian Dunning's FileMaker Custom Functions

progressBarStacked ( width ; height ; radius ; backgroundColor ; segmentArray )

Creates a horizontal progress bar composed of multiple coloured segments, defined by a JSON input with individual percentage values.

  Be the first to rate this function Log in to vote

Jonni™   Jonni™ - Show more from this author

  Sample input:
progressBarStacked ( 500 ; 16 ; 5 ; "#f4f4f4" ; $jsonArray )
  Sample output:
SVG for a webviewer depicting a stacked progress bar

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

This function renders a horizontal, stacked-style SVG progress bar where each segment represents a distinct stage or category of progress. The segments are defined via a JSON object that specifies a colour and percentage for each part. The function calculates the relative widths and assembles each segment in sequence. A background colour fills the bar behind the segments, and rounded corners are applied through SVG clipping.

JSON ARRAY EXAMPLE

JSONSetElement ( "" ;

[ "stack[+]color" ; "#211732" ; 1 ] ;
[ "stack[:]percent" ; 10 ; 2 ] ;
[ "stack[+]color" ; "#ad9fcd" ; 1 ] ;
[ "stack[:]percent" ; 20 ; 2 ] ;
[ "stack[+]color" ; "#7962a8" ; 1 ] ;
[ "stack[:]percent" ; 40 ; 2 ] ;
[ "stack[+]color" ; "#e8deee" ; 1 ] ;
[ "stack[:]percent" ; 70 ; 2 ]

)

NOTE : The segments are stacked, so make sure to order the array starting with the lowest percentages

The result is Base64-encoded and suitable for use in container fields or web viewers within FileMaker solutions.

 

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: