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 Plugins.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
Defines the value the gauge is to display
colors no, defaults to values define in COLORS in Plugins.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 the defaults above, if a value is 7, then there would be 7 pixels of the first color and the remaining would be the 2nd color. If a value of 37, there would be 37 pixels of the 3rd color and the remaining pixels would be the 4th color)
thbar_scale no, defaults to values define in THBAR_SCALE in Plugins.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 Plugins.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

Output

  • PNG graphics file created in /pub/Tait/TWikiWorkSpec/_GaugePlugin__.png
  • Value returned is the name of the file created _GaugePlugin__.png. Value suitable for inclusion in an ^lt;IMG> HTML tag

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

Storing images:

  • generate PNG images using GD library
  • store in attachment directory of topic:
    • Location: /pub/Tait/TWikiWorkSpec
    • Generate Tait and/or TWikiWorkSpec dir if not exist
    • Name: _GaugePlugin__.png

Error handling:

  • Show red HTML text

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__.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.