Installing JPGraph for Cumulus Station Graphs

Install JPGraph beside Cumulus data: PHP include path, TrueType fonts, writable cache directory, and what to use instead of a 2008 graph pack.

Back to Cumulus weather software guides

JPGraph (JpGraph in vendor spelling) is a PHP library that draws charts on the server. A Cumulus site that wanted public PNGs of temperature, pressure, or rain had to install that library, point it at a series file, and give it fonts and a cache directory the web user could write. This dotted URL, /projects.jpgraphgraphs, is that install note. It is not a tutorial in reading the figure, and it is not a mirror of the old TNET graph pack.

How to treat the image as a scientific figure—units, gaps, observed versus derived—is the slash twin, plotting Cumulus observations with JPGraph. The Cumulus Wiki Toolbox still names JPGraph as a consumer of a running realtime.txt log, which is why this path remains a high-value backlink. Modern TNET Weather does not maintain JpGraph, Cumulus, or the historical pack.

Historical context

Community sites in the late 2000s ran PHP on shared hosting. Visitors requested graphTemp.php; the host needed a library and a data file it could read. The TNET scripts catalog lists “Cumulus JpGraph Graphs Package.” Saratoga’s legacy page still lists CU-jpgraph-graphs 3.1 (26 October 2008) with a note that JpGraph must be installed (last checked 13 August 2026). Those are two obtains: the pack (if you have a licensed copy from a living upstream) and the library (always from the vendor). This hostname does not rehost either.

The series is a third obtain. realtime.txt is one overwritten line. Enable a homemade log first; see turning on a realtime snapshot logger. Installing JPGraph against an empty path produces a blank or error image, which is better than an invented line.

Obtain JPGraph from the vendor

Download the library from jpgraph.net, under that project’s dual license (QPL 1.0 for non-commercial, open-source, or educational use; a professional license for commercial use). As of the vendor page dated 26 January 2026, the free 4.4.3 tarball supports PHP 5.1+, PHP 7, and PHP 8 through 8.5 (last checked 13 August 2026). A 2008 pack does not pin this version. PHP on the host decides the library version, not the Cumulus build.

Do not use a jpgraph folder found inside an unlabeled weather ZIP. You would not know the license, the PHP line, or whether jpg-config.inc.php had been rewritten with someone else’s cache path.

PHP must already have GD enabled, and TrueType needs FreeType. Confirm with phpinfo() or gd_info(): GD section, PNG support, and FreeType. The PHP GD manual is the extension reference (last checked 13 August 2026).

Include path

Installation is a copy plus a search path. Vendor documentation puts library files where PHP can resolve require_once, commonly under a directory named jpgraph/ so scripts can write require_once 'jpgraph/jpgraph.php'. On Unix that is often somewhere such as /usr/share/php/jpgraph/. Shared hosts rarely allow that; a project-local lib/jpgraph/ next to the graph scripts is the usual workaround.

Two ways to make PHP see it:

  • Set include_path in php.ini (or a per-directory equivalent the host documents).
  • Call set_include_path at the top of the graph script, before any require.

Relative includes that assume the current working directory is the script directory fail when cron runs the same file from /. Use an absolute path to the library root in the station notes. If require fails, you have an include-path problem, not a Cumulus problem. If require succeeds and the image is empty, you have a data-path problem.

Fonts

Axis titles that contain °C, hPa, and mm need a TrueType file that contains those glyphs. JpGraph reads TTF_DIR from jpg-config.inc.php. Vendor defaults (when the defines are left commented) are /usr/share/fonts/truetype/ on Unix and the Windows fonts folder on Windows. Both must end with a trailing slash. The directory must be readable by the PHP process.

Shared hosting often has no system font tree that PHP can see. Copy a licensed TTF you are allowed to use into a directory outside the web root if possible, and set TTF_DIR to that absolute path. A missing font path typically yields an error image or boxes for unit glyphs.

Cache directory

JpGraph can write generated PNGs to a cache so a second HTTP hit does not redraw. CACHE_DIR in jpg-config.inc.php must be an absolute path, writable by the PHP user, and must end with /. Unix default is /tmp/jpgraph_cache/. /tmp on a shared host may be wiped, mode-restricted, or shared with other customers. Prefer a dedicated directory such as data/jpgraph_cache/ with permissions only for the web user, not world-writable.

If the cache is enabled and not writable, scripts fail in ways that look like “JPGraph is broken.” During bring-up, you can set USE_CACHE to false in the same config file, confirm that a graph renders, then enable cache once the directory exists. READ_CACHE can be turned off independently if you need to force regeneration while you still write files.

Timeout of the cache must not be longer than the log’s append interval if you claim the PNG is current. A 24-hour cache on a one-minute log is a historical figure labeled as now. Do not put the cache inside a directory listing that visitors can browse.

Pointing JPGraph at Cumulus paths

Three filesystem facts belong in the graph script’s config, not in a README on a forum.

Series file. Absolute path to the homemade realtime log (often realtimelog.txt on the host after upload). Not realtime.txt. Not dayfile.txt. Daily max/min/rain is a different figure; migrating that file is the dayfile article.

Delimiter and column map. Classic realtime snapshots are space-separated. Record which columns you plot and which Cumulus version wrote them. Field 3 is outside temperature in the 1.9.4 / early MX layout; later MX appended fields. A parser aligned to 2008 column numbers will plot humidity as pressure without throwing.

Output path. Either stream PNG to the browser from the script, or write a static file from cron. Mixing both without a single writer produces half-updated images.

Toolbox’s realtime tab exists specifically so Windows loggers without server cron can still build a log for JpGraphs. If you install JPGraph on the host but never upload the log, the library is idle.

Replacing JPGraph today

You may not need this library.

Cumulus MX can chart historic values from the dayfile and logs in its own interface and example historic-chart pages. Browser charts that fetch MX JSON move the drawing to the client. Independent gauge projects still use JpGraph against MX JSON or a database; those are current-maintainer or third-party facts, not the 2008 pack, and not TNET software.

Replace JPGraph when the host’s PHP is newer than the library you can legally run, you cannot write a cache directory or install FreeType, or you only need daily climatology (a dayfile table, not a high-frequency PNG). Keep JPGraph when you still need a server-side PNG a forum can hot-link without JavaScript.

A replacement still needs the same three paths: a series with a clock, a font that can draw units, and a place to write the image.

Practical checklist

  1. Confirm GD, PNG, and FreeType in phpinfo().
  2. Install JpGraph 4.x from the vendor tarball that matches your PHP line; record the version.
  3. Put jpgraph/ on include_path and require_once jpgraph.php from a smoke-test script.
  4. Set TTF_DIR to an absolute, readable font directory; test a title that contains °C.
  5. Create CACHE_DIR, writable only by PHP; start with USE_CACHE off if needed.
  6. Point the series path at the realtime log, not at realtime.txt or the dayfile.
  7. Record Cumulus version and column map next to that path.
  8. Do not run unlabeled recovered graph PHP. Get the library from jpgraph.net; get any surviving pack from a living upstream that states a license.

Server-side weather figures still fail first on include path, font path, and cache permissions. TNET’s public note on data sources, quality controls, and methodology is the modern discussion of provenance for records used in connection research. It does not document JpGraph settings, and this page does not document TNET internals.

Related pages: the slash figure article, the filename catalog, the projects map, and the Cumulus legacy hub.

Sources