A leading open source enterprise wiki and web application platform used by 50,000 small businesses, many Fortune 500 companies, and millions of people. Learn more.
Do you have a need to show gauges in your TWiki or HTML pages? TWiki has a GaugePlugin to show images like or or . Those are bitmap images generated on the fly based on some parameters.
Showing a page with hundreds of gauges (for example to show server status in a data center) can be slow. This is mainly attributed to the many connections the browser has to make, one for each image download. The latest GauglePlugin released a few days ago by TaitCyrus has alternatives to get around this problem:
1. Show gauges using HTML table tags.
2. Show gauges using images where image data is embedded inline in the image tag.
Additional alternatives (not implemented in the GaugePlugin):
3. Show gauges using HTML div tags.
4. Show gauges using parametrized includes.
The last one is TWiki specific. Let's look into these options.
1. Use HTML table tag:
We use HTML <table> tags with styles that define the dimensions and colors of the gauge.
HTML source code, as implemented in the GaugePlugin:
2. Use HTML img tag with embedded image data:
We use an HTML <img> tag with image data embedded in the src="" parameter. This is possible with the relatively new data URI scheme, spec defined in RFC:2397. It is widely supported by modern browsers. However it does not work in IE7, which is still widely used.
HTML source code, as implemented in the GaugePlugin:
3. Use HTML div tag:
We use HTML <div> tags with some CSS to show a gauge. First we add some CSS to the HTML <head> section to define the dimensions and colors of the divs. In TWiki we can do that with the help of the %ADDTOHEAD{}% variable.
Define CSS, using ADDTOHEAD to add it to the HTML head section:
4. Show gauges using parametrized includes:
How can we make it easier to add multiple gauges to a TWiki page? We can take advantage of parameterized includes in TWiki as described in IncludeTopicsAndWebPages. The idea is to create a named section that defines the gauge and to include that section passing along parameters.
First we create a section named noImageGauge: