Skip to content

Add graphsvg plugin: inline-SVG charts (replacement for the dead Google Chart API)#289

Open
ShaiMagal wants to merge 1 commit into
eldy:developfrom
ShaiMagal:add-graphsvg-plugin
Open

Add graphsvg plugin: inline-SVG charts (replacement for the dead Google Chart API)#289
ShaiMagal wants to merge 1 commit into
eldy:developfrom
ShaiMagal:add-graphsvg-plugin

Conversation

@ShaiMagal
Copy link
Copy Markdown

@ShaiMagal ShaiMagal commented Jun 6, 2026

Problem

The graphgooglechartapi plugin builds charts as <img> tags pointing at the
Google Image Charts API (chart.googleapis.com/chart?...), and the country map
via the Google Visualization "geomap". Google shut down the Image Charts API in
March 2019
, and the Flash-based GeoMap even earlier, so these charts now render
as broken images on every modern report.

Change

A new graphsvg plugin that is a drop-in replacement: it implements the same
ShowGraph hook and the same graph types, but renders everything locally as
self-contained inline SVG.

  • Column charts for month / daysofmonth / daysofweek / hours
    (with week-end shading and a bold "current day" label)
  • Pie charts for the top-N sections (oss, browsers, filetypes,
    httpstatus, hosts, �)
  • Horizontal ranking bar chart for countries_map, replacing the discontinued
    Flash GeoMap

Why SVG

  • No external request, no JavaScript, no CDN â�� charts keep working offline and
    inside static (BuildStaticPages) reports
  • No visitor data ever leaves the server (privacy / GDPR friendly)
  • Crisp vector output with native <title> hover tooltips
  • Compatible with both html and xhtml BuildReportFormat
  • No new Perl module dependencies

Usage

Replace the old plugin in your config:

#LoadPlugin="graphgooglechartapi"
LoadPlugin="graphsvg"

graphgooglechartapi is left in place but marked deprecated in
awstats.model.conf, where the new plugin is documented.

Testing

  • perl -c clean
  • Verified end-to-end against a real Apache log: awstats.pl â�¦ -update then
    -output produces inline <svg> for all chart types and zero references
    to chart.googleapis.com
  • Visually checked the column, pie and ranking charts

Fixing -> #249

graph_great_again

…rt API

The graphgooglechartapi plugin builds charts as <img> tags pointing at the
Google Image Charts API (chart.googleapis.com) and the country map via the
Google Visualization "geomap". Google shut down the Image Charts API in
March 2019, and the Flash-based GeoMap even earlier, so these charts now
render as broken images on every modern report.

graphsvg is a drop-in replacement implementing the same ShowGraph hook and
the same graph types, but it draws everything locally as self-contained
inline SVG:

  * column charts for the time graphs (month, days of month, days of week,
    hours), with week-end shading and a bold "current day" label
  * pie charts for the top-N sections (OS, browsers, file types, HTTP
    status, hosts, ...)
  * a horizontal ranking bar chart for the countries section, replacing
    the discontinued Flash GeoMap

Benefits over graphgooglechartapi:

  * no external request, no JavaScript, no CDN, so charts keep working
    offline and inside static (BuildStaticPages) reports
  * no visitor data is ever sent to a third party (privacy / GDPR)
  * crisp vector output with native <title> hover tooltips
  * compatible with both html and xhtml BuildReportFormat

No new Perl module dependencies. graphgooglechartapi is left in place but
marked as deprecated in awstats.model.conf, where the new plugin is
documented.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant