Personal Professional Christian Stuff Photographs Miscellaneous Blog email Admin

 

GaugePlugin Specification (rough)

The GaugePlugin creates PNG graphic files displaying gauge information.

Inputs

%GAUGE% variables Required Description
type no, defaults to value defined in TYPE in TWiki.GaugePlugin describes the type of guage to be used
"thbar" Color coded bar for scorecard
"trend" Arrow up, right, down for positive, 0, negative values
name yes (no default) Name to uniquely identify the gauge either in gauge creation (creating and storing the graphics making up the gauge) or gauge referencing (accessing an already created gauge graphics)
value yes if defining a new gauge
no if referencing an already defined/created gauge
type = thbar - Defines the value the gauge is to display
type = trend - postive = arrow up, 0 = arrow right, negative = arrow down
thbar_colors no, defaults to values define in THBAR_COLORS in TWiki.GaugePlugin Two colors per scale. The first color is the dark color used for actual values. The second color is for filling out the rest of the gauge color (i.e. using scale values of "12 35 57", if a value is 7, then there would be 7 pixels of the first color and the remaining pixels (to the end of the gauge) would be the 2nd color. If a value of 37, there would be 37 pixels of the 3rd color (since 37 falls in the range of the 2nd scale) and the remaining pixels would be the 4th color)

Scale #1 uses 1st & 2nd colors
Scale #2 uses 3rd and 4th colors
Scale #3 uses 5th and 6th colors
Scale #N uses the (N*2)-1 and (N*2) colors

If type = thrend, then the 1st color defines the color of the arrow
thbar_scale no, defaults to values define in THBAR_SCALE in TWiki.GaugePlugin Defines the number and position of the thbar scales. For example a value of "12 35 57" denotes that there are three regions on the bar gauge. The 1st encompasses values of 1-12, the 2nd values 13-35, and the 3rd and last values of 36-57.
thbar_height no, defaults to values define in THBAR_HEIGHT in TWiki.GaugePlugin Defines the heigth, in pixels, of the thbar gauge (width defined as the last value from thbar_scale) and the heigth of the scale portion of the guage. For example, a value of "18 2" means that the value portion of the guage is 18 pixels in height and the scale portion of the guage is 2 pixels in height making the total graphic 18 + 2 + 1 = 21 pixels where the 1 is a 1 pixel high dividing line between the value portion and scale portion of the gauge
trend_geometry no, defaults to values define in TREND_GEOMETRY in TWiki.GaugePlugin Defines the geometry (width height) of the trend arrow
trend_color no, defaults to values define in TREND_COLOR in TWiki.GaugePlugin Defines the color of the trend arrow

Output

  • A PNG graphics file is created containing the gauge results. The file is placed in /pub/Tait/TWikiWorkSpec/_GaugePlugin_<type>_<name>.png
  • Value/string returned is the name of the file created _GaugePlugin_<type>_<name>.png. Value suitable for inclusion in an <IMG> HTML tag

Error Handling

If the required arguments are not defined, then the name of a graphic file containing an error message is returned.

Sample usage

<IMG SRC="%PUBURLPATH%/%WEB%/%TOPIC%/ %GAUGE{name="C1_customer_satisfaction" type="thbar" value="47"}%" ALT="47"><IMG SRC=%PUBURLPATH%/%WEB%/%TOPIC%/ %GAUGE{name="C1_customer_satisfaction_trend" type="trend" value="1" trend_color="#0000FF"}%">

Later improvement:

  • Hash value to enhance performance:
    • Build hash value (checksum) of each gauge based on initial settings and attributes, and store hash value.
    • Regenerate image only of hash value is different.
    • Since there are so few gauge attributes you could use the actual gauge string (expanded with initial values) as the hash value
    • Idea for hash value file name: _GaugePlugin_<type>_<name>.hash, alternatively generate one hash value file per TWiki topic.

  • Create a AttachmentStorePlugin that does the attachment storage handling; offers an API for plugins to use.