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™ - Show more from this author |
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
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.