Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Keep the Composer dist tarball lean by excluding docs and dev tooling.
# Packagist / `composer install --prefer-dist` honors export-ignore.
lib/jpgraph/docs/ export-ignore
.github/ export-ignore
.gitattributes export-ignore
32 changes: 32 additions & 0 deletions .github/smoke/render.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
/**
* Smoke test: load JpGraph through the Composer loader and render a basic
* chart to a PNG. Fails (non-zero exit) if the library can't produce output
* on the current PHP version. Used by .github/workflows/ci.yml.
*/

error_reporting(E_ALL & ~E_DEPRECATED & ~E_NOTICE);

require __DIR__ . '/../../lib/JpGraph.php';

use JpGraph\JpGraph;

JpGraph::load();
JpGraph::module('bar');

$data = [12, 8, 19, 3, 10, 7];
$graph = new \Graph(320, 200);
$graph->SetScale('textlin');

$bar = new \BarPlot($data);
$graph->Add($bar);

$out = sys_get_temp_dir() . '/jpgraph_smoke.png';
$graph->Stroke($out);

if (!is_file($out) || filesize($out) === 0) {
fwrite(STDERR, "FAIL: no output produced at $out\n");
exit(1);
}

echo 'OK: rendered ' . filesize($out) . " bytes to $out\n";
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI

on:
push:
branches: [ 4.x ]
pull_request:

permissions:
contents: read

jobs:
test:
name: PHP ${{ matrix.php }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['7.4', '8.0', '8.1', '8.2', '8.3']
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: gd
coverage: none

- name: Lint PHP sources
run: find lib -name '*.php' -print0 | xargs -0 -n1 -P4 php -l

- name: Smoke render a chart
run: php .github/smoke/render.php
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# JpGraph (Unoffical)
# JpGraph (Unofficial)

JpGraph is an Object-Oriented Graph creating library for PHP5 (>=5.1) and PHP7.0 The library is completely written in PHP and ready to be used in any PHP scripts (both CGI/APXS/CLI versions of PHP are supported).
JpGraph is an Object-Oriented graph-creating library for PHP 5 (>=5.1) and PHP 7.0. The library is completely written in PHP and ready to be used in any PHP scripts (both CGI/APXS/CLI versions of PHP are supported).


This is the unoffical loader originally forked from ztec for composer from http://jpgraph.net/, I'll try my best to update this repository as soon as updates come out.
This is the unofficial loader, originally forked from ztec for Composer, from http://jpgraph.net/. I'll try my best to update this repository as soon as updates come out.


## Version 4.4.3
* Updated to upstream JpGraph 4.4.3 (improved PHP 8 compatibility)
* Re-applied local patches: libgd 2.3 empty-text guards and imageantialias() error suppression

## Version 4.3.5
* Updated to upstream JpGraph 4.3.5 (22 Oct 2021)
* Short-term fix for a bug introduced by libgd 2.3
Expand All @@ -15,7 +19,6 @@ This is the unoffical loader originally forked from ztec for composer from http:
* Support PHP 7.4


This is a port for Composer users to use JpGraph as a Vendor library

use JpGraph\JpGraph::load(); and JpGraph\JpGraph::module('moduleName'); to load required modules
This is a port for Composer users to use JpGraph as a vendor library.

Use JpGraph\JpGraph::load(); and JpGraph\JpGraph::module('moduleName'); to load required modules.
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
"name": "JpGraph team"
}
],
"require": {},
"require": {
"php": ">=7.0",
"ext-gd": "*"
},
"autoload": {
"classmap": ["lib/JpGraph.php"]
}
Expand Down
2 changes: 1 addition & 1 deletion lib/jpgraph/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Version: v4.3.5
Version: v4.4.3
Binary file removed lib/jpgraph/src/Examples/__handle
Binary file not shown.
2 changes: 1 addition & 1 deletion lib/jpgraph/src/Examples/bartutex3.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Some data
$months=$gDateLocale->GetShortMonth();

srand ((double) microtime() * 1000000);
srand ((float) microtime() * 1000000);
for( $i=0; $i<25; ++$i) {
$databary[]=rand(1,50);
$databarx[]=$months[$i%12];
Expand Down
2 changes: 1 addition & 1 deletion lib/jpgraph/src/Examples/bartutex4.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Some data
$months=$gDateLocale->GetShortMonth();

srand ((double) microtime() * 1000000);
srand ((float) microtime() * 1000000);
for( $i=0; $i<25; ++$i) {
$databary[]=rand(1,50);
$databarx[]=$months[$i%12];
Expand Down
2 changes: 1 addition & 1 deletion lib/jpgraph/src/Examples/bartutex5.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Some data
$months=$gDateLocale->GetShortMonth();

srand ((double) microtime() * 1000000);
srand ((float) microtime() * 1000000);
for( $i=0; $i<25; ++$i) {
$databary[]=rand(1,50);
$databarx[]=$months[$i%12];
Expand Down
2 changes: 1 addition & 1 deletion lib/jpgraph/src/Examples/bartutex6.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

// Some data
$months=$gDateLocale->GetShortMonth();
srand ((double) microtime() * 1000000);
srand ((float) microtime() * 1000000);
for( $i=0; $i<25; ++$i) {
$databary[]=rand(1,50);
$databarx[]=$months[$i%12];
Expand Down
2 changes: 1 addition & 1 deletion lib/jpgraph/src/Examples/comb90dategraphex03.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
if($data_windspeed[$i+1] < 0 )
$data_windspeed[$i+1] = 0;

$data_windtemp[$i+1] = $data_windtemp[$i] + rand(-1.5,1.5);
$data_windtemp[$i+1] = $data_windtemp[$i] + mt_rand(-150, 150) / 100;

$xdata[$i] = $start + $i * SAMPLERATE;
}
Expand Down
Empty file removed lib/jpgraph/src/Examples/jpgraph
File mode changed.
1 change: 1 addition & 0 deletions lib/jpgraph/src/Examples/lineimagefillex1.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

// Setup the graph
$graph = new Graph(320,200);
$graph->clearTheme();
$graph->title->Set('Education growth');
$graph->title->SetFont(FF_ARIAL,FS_BOLD,14);
$graph->SetScale('intlin');
Expand Down
Loading
Loading