<<O>>  Difference Topic GaugePlugin (r1.7 - 02 May 2003 - PeterThoeny)

Gauge Plugin

This plugin can be used to build dashboards that contain graphical images of gauges like tambar1.gif (target measure gauge) and trendup.gif (trend icons).

Line: 93 to 93

Plugin Info

Changed:
<
<
Plugin Author: PeterThoeny, TWiki:Main/TaitCyrus
Plugin Version: 08 Sep 2002
>
>
Plugin Author: TWiki:Main/PeterThoeny, TWiki:Main/TaitCyrus
Plugin Version: 16 Nov 2004

Change History: <!-- specify latest version first --> 
Added:
>
>
16 Nov 2004: Added benchmarks (no code changes) (V1.003)
01 May 2003: Added time stamp to image to prevent browser from caching images; ignore non-numerical chars in value parameter; fixed warnings (V1.002)

08 Sep 2002: Added missing binmode (for Windows); pass parameters also to error image (V1.001)
23 May 2002: Initial version (V1.0)
16 May 2002: Initial spec (V1.0)
CPAN Dependencies: GD from http://stein.cshl.org/WWW/software/GD
Other Dependencies: gd library from http://www.boutell.com/gd (Tested with 1.8.4)
PNG graphics library from http://www.libpng.org/pub/png
Perl Version: 5.005
Added:
>
>
TWiki:Plugins/Benchmark: GoodStyle 97%, FormattedSearch 99%, GaugePlugin 90%

Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/GaugePlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/GaugePluginDev
Added:
>
>
Appraisal: http://TWiki.org/cgi-bin/view/Plugins/GaugePluginAppraisal

Related Topics: TWikiPreferences, TWikiPlugins

-- TWiki:Main/TaitCyrus - 23 May 2002

Changed:
<
<
-- PeterThoeny - 08 Sep 2002
>
>
-- TWiki:Main/PeterThoeny - 16 Nov 2004

META FILEATTACHMENT tambar1.gif attr="h" comment="Target Measure Bar, 60x16 example" date="1021945424" path="C:\Data\MyTWiki\Plugins\GaugePlugin\pub\Plugins\GaugePlugin\tambar1.gif" size="932" user="PeterThoeny" version="1.1"
META FILEATTACHMENT trendup.gif attr="h" comment="Trend Up Icon 16x16" date="1021945466" path="C:\Data\MyTWiki\Plugins\GaugePlugin\pub\Plugins\GaugePlugin\trendup.gif" size="877" user="PeterThoeny" version="1.1"
META FILEATTACHMENT trenddn.gif attr="h" comment="Trend Down Icon 16x16" date="1021945479" path="C:\Data\MyTWiki\Plugins\GaugePlugin\pub\Plugins\GaugePlugin\trenddn.gif" size="875" user="PeterThoeny" version="1.1"
 <<O>>  Difference Topic GaugePlugin (r1.6 - 04 Dec 2002 - PeterThoeny)

Gauge Plugin

This plugin can be used to build dashboards that contain graphical images of gauges like tambar1.gif (target measure gauge) and trendup.gif (trend icons).

Line: 107 to 107

Related Topics: TWikiPreferences, TWikiPlugins

Changed:
<
<
-- TWiki:Main:TaitCyrus - 23 May 2002
>
>
-- TWiki:Main/TaitCyrus - 23 May 2002

-- PeterThoeny - 08 Sep 2002
META FILEATTACHMENT tambar1.gif attr="h" comment="Target Measure Bar, 60x16 example" date="1021945424" path="C:\Data\MyTWiki\Plugins\GaugePlugin\pub\Plugins\GaugePlugin\tambar1.gif" size="932" user="PeterThoeny" version="1.1"
META FILEATTACHMENT trendup.gif attr="h" comment="Trend Up Icon 16x16" date="1021945466" path="C:\Data\MyTWiki\Plugins\GaugePlugin\pub\Plugins\GaugePlugin\trendup.gif" size="877" user="PeterThoeny" version="1.1"
 <<O>>  Difference Topic GaugePlugin (r1.5 - 08 Sep 2002 - PeterThoeny)

Gauge Plugin

This plugin can be used to build dashboards that contain graphical images of gauges like tambar1.gif (target measure gauge) and trendup.gif (trend icons).

Line: 72 to 72

Plugin Installation Instructions

Added:
>
>
Note: You do not need to install anything on your browser to use this plugin. The following instructions are for the administrator who installs the plugin on the server where TWiki is running.

  • Download the ZIP file from the Plugin web (see below)
  • Unzip GaugePlugin.zip in your twiki installation directory. Content:
    File: Description:
Line: 92 to 94

Plugin Info

Plugin Author: PeterThoeny, TWiki:Main/TaitCyrus
Changed:
<
<
Plugin Version: 23 May 2002
>
>
Plugin Version: 08 Sep 2002

Change History: <!-- specify latest version first --> 
Added:
>
>
08 Sep 2002: Added missing binmode (for Windows); pass parameters also to error image (V1.001)

23 May 2002: Initial version (V1.0)
16 May 2002: Initial spec (V1.0)
CPAN Dependencies: GD from http://stein.cshl.org/WWW/software/GD
Line: 104 to 107

Related Topics: TWikiPreferences, TWikiPlugins

Changed:
<
<
-- TaitCyrus? - 23 May 2002
-- PeterThoeny - 23 May 2002
>
>
-- TWiki:Main:TaitCyrus - 23 May 2002
-- PeterThoeny - 08 Sep 2002

META FILEATTACHMENT tambar1.gif attr="h" comment="Target Measure Bar, 60x16 example" date="1021945424" path="C:\Data\MyTWiki\Plugins\GaugePlugin\pub\Plugins\GaugePlugin\tambar1.gif" size="932" user="PeterThoeny" version="1.1"
META FILEATTACHMENT trendup.gif attr="h" comment="Trend Up Icon 16x16" date="1021945466" path="C:\Data\MyTWiki\Plugins\GaugePlugin\pub\Plugins\GaugePlugin\trendup.gif" size="877" user="PeterThoeny" version="1.1"
META FILEATTACHMENT trenddn.gif attr="h" comment="Trend Down Icon 16x16" date="1021945479" path="C:\Data\MyTWiki\Plugins\GaugePlugin\pub\Plugins\GaugePlugin\trenddn.gif" size="875" user="PeterThoeny" version="1.1"
 <<O>>  Difference Topic GaugePlugin (r1.4 - 12 Aug 2002 - PeterThoeny)

Gauge Plugin

This plugin can be used to build dashboards that contain graphical images of gauges like tambar1.gif (target measure gauge) and trendup.gif (trend icons).

Line: 32 to 32

  • Default dimensions, scale and colors for Target Measure Bar. See details in the syntax rules.
    • Set TAMBAR_WIDTH = 60
    • Set TAMBAR_HEIGHT = 16
Changed:
<
<
    • Set TAMBAR_SCALE = 0, 10, 20, 30
>
>
    • Set TAMBAR_SCALE = 0, 33, 67, 100

    • Set TAMBAR_COLORS = #FF0000, #FFCCCC, #FFFF00, #FFFFCC, #00FF00, #CCFFCC

  • Default dimensions for Trend Icon
Line: 91 to 91

Plugin Info

Changed:
<
<
Plugin Author: PeterThoeny, TaitCyrus?
>
>
Plugin Author: PeterThoeny, TWiki:Main/TaitCyrus

Plugin Version: 23 May 2002
Change History: <!-- specify latest version first --> 
23 May 2002: Initial version (V1.0)
 <<O>>  Difference Topic GaugePlugin (r1.3 - 23 May 2002 - PeterThoeny)

Gauge Plugin

This plugin can be used to build dashboards that contain graphical images of gauges like tambar1.gif (target measure gauge) and trendup.gif (trend icons).

Line: 24 to 24

    • Set SHORTDESCRIPTION = Build dashboards that contain graphical images of gauges defined with %GAUGE{}% variables.

  • Set DEBUG to 1 to get debug messages in data/debug.txt. Default: 0
Changed:
<
<
    • Set DEBUG = 1
>
>
    • Set DEBUG = 0

  • Default gauge used: tambar, trend. Default: tambar
    • Set TYPE = tambar
Line: 70 to 70

If the required parameters are not defined, then an error message is returned or an <img ... /> image tag is returned pointing to a graphic containing the error message.

Deleted:
<
<

Planned Improvements

  • Add a dial gauge showing a circular gauge like in a car dashboard.
  • 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 if hash value is different.
    • Since there are so few gauge attributes we 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.

Plugin Installation Instructions

  • Download the ZIP file from the Plugin web (see below)
Line: 103 to 92

Plugin Info

Plugin Author: PeterThoeny, TaitCyrus?
Changed:
<
<
Plugin Version: 16 May 2002
Change History:  
  20 May 2002: Initial version
  16 May 2002: Initial spec
CPAN Dependencies: GD
Other Dependencies: gd library from http://www.boutell.com/gd (Tested with 1.8.4)
>
>
Plugin Version: 23 May 2002
Change History: <!-- specify latest version first --> 
23 May 2002: Initial version (V1.0)
16 May 2002: Initial spec (V1.0)
CPAN Dependencies: GD from http://stein.cshl.org/WWW/software/GD
Other Dependencies: gd library from http://www.boutell.com/gd (Tested with 1.8.4)
PNG graphics library from http://www.libpng.org/pub/png

Perl Version: 5.005
Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/GaugePlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/GaugePluginDev

Related Topics: TWikiPreferences, TWikiPlugins

Changed:
<
<
-- PeterThoeny - 20 May 2002
>
>
-- TaitCyrus? - 23 May 2002
-- PeterThoeny - 23 May 2002

META FILEATTACHMENT tambar1.gif attr="h" comment="Target Measure Bar, 60x16 example" date="1021945424" path="C:\Data\MyTWiki\Plugins\GaugePlugin\pub\Plugins\GaugePlugin\tambar1.gif" size="932" user="PeterThoeny" version="1.1"
META FILEATTACHMENT trendup.gif attr="h" comment="Trend Up Icon 16x16" date="1021945466" path="C:\Data\MyTWiki\Plugins\GaugePlugin\pub\Plugins\GaugePlugin\trendup.gif" size="877" user="PeterThoeny" version="1.1"
META FILEATTACHMENT trenddn.gif attr="h" comment="Trend Down Icon 16x16" date="1021945479" path="C:\Data\MyTWiki\Plugins\GaugePlugin\pub\Plugins\GaugePlugin\trenddn.gif" size="875" user="PeterThoeny" version="1.1"
 <<O>>  Difference Topic GaugePlugin (r1.2 - 20 May 2002 - PeterThoeny)
Changed:
<
<

GaugePlugin Specification (rough)

>
>

Gauge Plugin


Changed:
<
<
The GaugePlugin creates PNG graphic files displaying gauge information.
>
>
This plugin can be used to build dashboards that contain graphical images of gauges like tambar1.gif (target measure gauge) and trendup.gif (trend icons).

Changed:
<
<

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
type = thbar - Defines the value the gauge is to display
type = trend - postive = arrow up, 0 = arrow right, negative = arrow down
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 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 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
thrend_scale no, defaults to values define in THREND_SCALE in Plugins.GaugePlugin Defines the width, in pixels, of the thrend right pointing arrow
thbar_height no, defaults to values define in THREND_HEIGHT in Plugins.GaugePlugin Defines the heigth, in pixels, of the thrend arrow
>
>
Two types of gauges are currently available, a target measure bar and a trend icon.

Changed:
<
<

Output

>
>
Type of Gauge Name What it Does Example
Target Measure Bar tambar Shows the actual state of a measure in a bar. The bar has two parts, the upper thick bar shows the actual value, the lower thin bar shows the scale of the gauge. For example regions with a relative distribution of bad (red), acceptable (yellow) and good (green) values Actual: 35
Trend Icon trend Shows the up trend, no change and down trend of a measure up trend, no change, down trend

Changed:
<
<
  • A PNG graphics file is created containing the gauge results. The file is placed in /twiki2/pub/TWiki/GaugePlugin/_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
>
>
The Target Measure Bar has scale regions (the lower thin bar) like red, yellow and green. Each region has a start and end boundary, the end boundary of one region is the start of the next. The scale determines the boundaries, e.g. a scale of 0, 10, 20, 40 has a red region with range 0...10, a yellow one with range 10...20 and a green one with range 20...40.

Changed:
<
<

Error Handling

>
>
The upper value region (the thick bar) has two colors, a dark color used for actual value and a light color for filling out the rest of the gauge with a lighter color.

The %GAUGE{...}% variable gets expanded to an image representing the gauge. Parameters and global settings determine the type of gauge, dimensions, scale and values.

GaugePlugin Global Settings

Plugin settings are stored as preferences variables. To reference a plugin setting write %<plugin>_<setting>%, for example, %INTERWIKIPLUGIN_SHORTDESCRIPTION%

  • One line description, shown in the TextFormattingRules topic:
    • Set SHORTDESCRIPTION = Build dashboards that contain graphical images of gauges defined with %GAUGE{}% variables.

  • Set DEBUG to 1 to get debug messages in data/debug.txt. Default: 0
    • Set DEBUG = 1

  • Default gauge used: tambar, trend. Default: tambar
    • Set TYPE = tambar

  • Default dimensions, scale and colors for Target Measure Bar. See details in the syntax rules.
    • Set TAMBAR_WIDTH = 60
    • Set TAMBAR_HEIGHT = 16
    • Set TAMBAR_SCALE = 0, 10, 20, 30
    • Set TAMBAR_COLORS = #FF0000, #FFCCCC, #FFFF00, #FFFFCC, #00FF00, #CCFFCC

  • Default dimensions for Trend Icon
    • Set TREND_WIDTH = 16
    • Set TREND_HEIGHT = 16

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

Syntax Rules


Changed:
<
<

Sample usage

>
>
The %GAUGE{...}% variable gets expanded to an image representing the gauge.

Changed:
<
<
<IMG SRC="%PUBURLPATH%/%WEB%/%TOPIC%/%GAUGE{name="C1_customer_satisfaction" type="thbar" value="47"}%" ALT="47">
>
>
%GAUGE% Parameter Comment Default
type The type of gauge to be used, tambar or trend Global TYPE setting
name Name to uniquely identify the gauge file that is auto-created. None; is required for tambar (not required for trend)
value For tambar: The actual value of the gauge
For trend: Positive = arrow up, 0 = arrow right, negative = arrow down
None. Show "no data" if missing
alt Alternate text for image Value is value parameter
width Defines the width of the gauge in pixels. Global <type>_WIDTH setting
height Defines the height of the gauge in pixels. Global <type>_HEIGHT setting
scale For tambar: Defines the number and position of the scales. For example a value of "5, 12, 35, 57" denotes that there are three regions on the bar gauge, "5...12", "12...35" and "35...57".
For trend: N/A
Global <type>_SCALE setting
colors For tambar: List of colors, each region has two colors. For trend: N/A Global <type>_COLORS setting

Changed:
<
<
<IMG SRC=%PUBURLPATH%/%WEB%/%TOPIC%/%GAUGE{name="C1_customer_satisfaction_trend" type="thrend" value="1" colors="#0000FF"}%">
>
>

Examples


Changed:
<
<

Later improvement:

>
>
Type of gauge You type You should get... ...if installed
Target Measure Bar %GAUGE{ type="tambar" name="t1" scale="0, 10, 20, 40" value="27" }% 27 GaugePlugin error: Required Perl module 'GD' not found
Trend Icon %GAUGE{ type="trend" name="t2" value="-3" }% down trend GaugePlugin error: Required Perl module 'GD' not found

Added:
>
>
The "if installed" column shows images instead of variables in case the plugin is installed correctly.

Output

  • A PNG graphics file is created containing the gauge results. The file is placed in %PUBURLPATH%/%WEB%/%TOPIC%/_GaugePlugin_<type>_<name>.png
  • %GAUGE{...}% gets expanded to an <img ... /> image tag.

Error Handling

If the required parameters are not defined, then an error message is returned or an <img ... /> image tag is returned pointing to a graphic containing the error message.

Planned Improvements

  • Add a dial gauge showing a circular gauge like in a car dashboard.

  • Hash value to enhance performance:
    • Build hash value (checksum) of each gauge based on initial settings and attributes, and store hash value.
Changed:
<
<
    • 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.
>
>
    • Regenerate image only if hash value is different.
    • Since there are so few gauge attributes we 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.
Changed:
<
<
-- PeterThoeny - 14 May 2002
>
>

Plugin Installation Instructions

  • Download the ZIP file from the Plugin web (see below)
  • Unzip GaugePlugin.zip in your twiki installation directory. Content:
    File: Description:
    lib/TWiki/Plugins/GaugePlugin.pm Plugin Perl module
    data/TWiki/GaugePlugin.txt Plugin topic
    data/TWiki/GaugePlugin.txt,v Plugin topic repository
    data/TWiki/GaugePluginTests.txt Test page containing many examples of the GaugePlugin in action. Also shows various error conditions
    data/TWiki/GaugePluginTests.txt,v RCS file for above
    pub/TWiki/GaugePlugin/tambar1.gif Sample tambar image
    pub/TWiki/GaugePlugin/trenddn.gif trend down arrow
    pub/TWiki/GaugePlugin/trendeq.gif trend no change arrow
    pub/TWiki/GaugePlugin/trendup.gif trend up arrow
    pub/TWiki/GaugePlugin/trendnd.gif trend error message if value is not specified
  • Test if the plugin is correctly installed:
    • Check above examples if the "if installed" column shows images instead of variables.
    • Check GaugePluginTests for some more test

Plugin Info

Plugin Author: PeterThoeny, TaitCyrus?
Plugin Version: 16 May 2002
Change History:  
  20 May 2002: Initial version
  16 May 2002: Initial spec
CPAN Dependencies: GD
Other Dependencies: gd library from http://www.boutell.com/gd (Tested with 1.8.4)
Perl Version: 5.005
Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/GaugePlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/GaugePluginDev

Related Topics: TWikiPreferences, TWikiPlugins

-- PeterThoeny - 20 May 2002

META FILEATTACHMENT tambar1.gif attr="h" comment="Target Measure Bar, 60x16 example" date="1021945424" path="C:\Data\MyTWiki\Plugins\GaugePlugin\pub\Plugins\GaugePlugin\tambar1.gif" size="932" user="PeterThoeny" version="1.1"
META FILEATTACHMENT trendup.gif attr="h" comment="Trend Up Icon 16x16" date="1021945466" path="C:\Data\MyTWiki\Plugins\GaugePlugin\pub\Plugins\GaugePlugin\trendup.gif" size="877" user="PeterThoeny" version="1.1"
META FILEATTACHMENT trenddn.gif attr="h" comment="Trend Down Icon 16x16" date="1021945479" path="C:\Data\MyTWiki\Plugins\GaugePlugin\pub\Plugins\GaugePlugin\trenddn.gif" size="875" user="PeterThoeny" version="1.1"
META FILEATTACHMENT trendeq.gif attr="h" comment="Trend Equal Icon 16x16" date="1021945497" path="C:\Data\MyTWiki\Plugins\GaugePlugin\pub\Plugins\GaugePlugin\trendeq.gif" size="869" user="PeterThoeny" version="1.1"
META FILEATTACHMENT trendnd.gif attr="h" comment="Trend No Data Icon 16x16" date="1021945521" path="C:\Data\MyTWiki\Plugins\GaugePlugin\pub\Plugins\GaugePlugin\trendnd.gif" size="875" user="PeterThoeny" version="1.1"
 <<O>>  Difference Topic GaugePlugin (r1.1 - 14 May 2002 - PeterThoeny)
Line: 1 to 1
Added:
>
>

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
type = thbar - Defines the value the gauge is to display
type = trend - postive = arrow up, 0 = arrow right, negative = arrow down
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 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 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
thrend_scale no, defaults to values define in THREND_SCALE in Plugins.GaugePlugin Defines the width, in pixels, of the thrend right pointing arrow
thbar_height no, defaults to values define in THREND_HEIGHT in Plugins.GaugePlugin Defines the heigth, in pixels, of the thrend arrow

Output

  • A PNG graphics file is created containing the gauge results. The file is placed in /twiki2/pub/TWiki/GaugePlugin/_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="thrend" value="1" colors="#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.

-- PeterThoeny - 14 May 2002

View topic | Diffs | r1.7 | > | r1.6 | > | r1.5 | More
Revision r1.1 - 14 May 2002 - 01:19 - PeterThoeny
Revision r1.7 - 02 May 2003 - 02:09 - PeterThoeny