|
Cookbook /
SparklinesSummary: Easily embed sparklines inside wiki pages
Version: 2007-08-09
Prerequisites: pmwiki 2.2.0 beta
Status: works
Maintainer: Luigi
Categories: Images
Questions answered by this recipeHow to easily add sparklines into a wiki page. DescriptionIn order to let your wiki pages embed sparklines, just follow these simple steps:
You will also need to be running a version of PHP that supports graphics. This can be checked by looking at phpinfo and verifying there is a status block for gd and that it supports png and possibly other image formats. This can be accomplished by building the extra distributions:
and recompiling PHP with: configure \
--with-jpeg-dir=/usr/local/src/jpeg-6b \
--with-png-dir=/usr/local/src/libpng-1.2.24 \
--with-freetype-dir=/usr/local/src/freetype-2.3.5 \
--with-gd \
In NotesSome more details and live samples are available at http://www.kirpi.it/wiki/pmwiki.php?n=Sparklines.HomePage?userlang=en To create a built in definition to invoke a sparkline (instead of hardcoding an absolute URL), include the following into your # Define the page variable {*Sparkline} for using the spark.php script
$UrlSchemeTemp = (@$_SERVER['HTTPS']=='on' || @$_SERVER['SERVER_PORT']==443)
? 'https' : 'http';
$ScriptUrlTemp = $UrlSchemeTemp.'://'.$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];
$UrlTemp = preg_replace('/pmwiki/', 'cookbook/spark', $ScriptUrlTemp, 1);
Then invoke with {*$Sparkline}
followed by the "?" and parameters. For Example http://pmwiki.org/sparklines/spark.php?style=2&series=32,26,23,73,37,41,26,41,26&.png would become {*$Sparkline}?style=2&series=32,26,23,73,37,41,26,41,26&.png
Or, you can set in Site.InterMap a shortcut (supposing your spark.php is in /): Spark1: /spark.php?style=1&series= Spark2: /spark.php?style=2&series= and write in the page (&.png required too): Spark2:32,26,23,73,37,41,26,41,26&.png Release Notes2007-08-09 This is just something put together in order to help solve the matter in minutes. More refined recipes could be developed (not by me), allowing for even better flexibility and integration with pmwiki. In case of any development (or issue) please let me know -- Luigi CommentsSee AlsoContributors |