12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- # scale.table
- !'
- "
- Scale rendering using the table:
- "
- $func ('scale.table', 275, 420) + ' 275 / 420'
- $func ('scale.table', 400, 420) + ' 400 / 420'
- $func ('scale.table', 420, 420) + ' 420 / 420'
- $func ('scale.table', 157, 420) + ' 157 / 420'
- $func ('scale.table', 42, 420) + ' 42 / 420'
- $func ('scale.table', 0, 420) + ' 0 / 420'
- '!
- !!-----scale.table------
- args[0] = args[0] & ! the current value of the parameter
- args[1] = args[1] & ! the maximum value
- if args[2] = 0:args[2] = 200 & ! Span (tables) pixels. default 350 px
- if $ARGS[3] = "":$ARGS[3] = "FF0000" & ! the color of the filled part of the scale in the format RRGGBB. default - red
- !! at_first "create" corresponding table
- $ARGS['table'] = '<table width="<<args[2]>>" border="0" cellspacing="0" cellpadding="0"><tr>'
- !! calculate the width as a percentage of the filled part
- args['x'] = (args[0] * 100) / args[1]
- !! calculate the percentage widths ullage
- args['empty'] = 100 - args['x']
- !! If the width of the filled part of more than zero percent, added to the table cell with the specified color (red on-default)
- if args['x'] > 0:
- $ARGS['table'] += '<td width="<<args['x']>>%" bgcolor="#' + $ARGS[3] + '"> </td>'
- end
- !! If the width of the unfilled part of the scale is greater than zero percent, added to the table cell with another color (gray).
- if args['empty'] > 0:
- $ARGS['table'] + = "<td width="<<args['empty']>>%" bgcolor="#888888"> </td>"
- end
- !! "close" table
- $ARGS['table'] += '</tr></table>'
- !! the_result
- $result = $ARGS['table']
- --- scale.table ---------------------------------
|