Skip to content

Commit

Permalink
adds DateTest
Browse files Browse the repository at this point in the history
  • Loading branch information
ffflabs committed May 9, 2018
1 parent 3dc74ff commit 81d6e94
Show file tree
Hide file tree
Showing 33 changed files with 214 additions and 675 deletions.
File renamed without changes.
21 changes: 0 additions & 21 deletions Examples/examples_datamatrix/datamatrix_ex0.php

This file was deleted.

12 changes: 0 additions & 12 deletions Examples/examples_datamatrix/datamatrix_ex00.php

This file was deleted.

20 changes: 0 additions & 20 deletions Examples/examples_datamatrix/datamatrix_ex1.php

This file was deleted.

23 changes: 0 additions & 23 deletions Examples/examples_datamatrix/datamatrix_ex2.php

This file was deleted.

23 changes: 0 additions & 23 deletions Examples/examples_datamatrix/datamatrix_ex3.php

This file was deleted.

27 changes: 0 additions & 27 deletions Examples/examples_datamatrix/datamatrix_ex4.php

This file was deleted.

32 changes: 0 additions & 32 deletions Examples/examples_datamatrix/datamatrix_ex5.php

This file was deleted.

36 changes: 0 additions & 36 deletions Examples/examples_datamatrix/datamatrix_ex6.php

This file was deleted.

24 changes: 0 additions & 24 deletions Examples/examples_datamatrix/datamatrix_ex7.php

This file was deleted.

7 changes: 3 additions & 4 deletions Examples/examples_date/dateaxisex1.php
Expand Up @@ -8,10 +8,9 @@
use Amenadiel\JpGraph\Plot;

// The callback that converts timestamp to minutes and seconds
function TimeCallback($aVal)
{
$TimeCallback = function ($aVal) {
return date('H:i:s', $aVal);
}
};

// Fake some suitable random data
$now = time();
Expand Down Expand Up @@ -43,7 +42,7 @@ function TimeCallback($aVal)

// Setup the x-axis with a format callback to convert the timestamp
// to a user readable time
$graph->xaxis->SetLabelFormatCallback('TimeCallback');
$graph->xaxis->SetLabelFormatCallback($TimeCallback);
$graph->xaxis->SetLabelAngle(90);

// Create the line
Expand Down
18 changes: 8 additions & 10 deletions Examples/examples_date/dateaxisex2.php
Expand Up @@ -7,18 +7,16 @@
use Amenadiel\JpGraph\Graph;
use Amenadiel\JpGraph\Plot;

require_once 'jpgraph/jpgraph_date.php';

// Create a data set in range (50,70) and X-positions
define('NDATAPOINTS', 360);
define('SAMPLERATE', 240);
$start = time();
$end = $start + NDATAPOINTS * SAMPLERATE;
$data = [];
$xdata = [];
for ($i = 0; $i < NDATAPOINTS; ++$i) {
$NDATAPOINTS = 360;
$SAMPLERATE = 240;
$start = time();
$end = $start + $NDATAPOINTS * $SAMPLERATE;
$data = [];
$xdata = [];
for ($i = 0; $i < $NDATAPOINTS; ++$i) {
$data[$i] = rand(50, 70);
$xdata[$i] = $start + $i * SAMPLERATE;
$xdata[$i] = $start + $i * $SAMPLERATE;
}

// Create the new Graph\Graph
Expand Down
18 changes: 8 additions & 10 deletions Examples/examples_date/dateaxisex3.php
Expand Up @@ -7,18 +7,16 @@
use Amenadiel\JpGraph\Graph;
use Amenadiel\JpGraph\Plot;

require_once 'jpgraph/jpgraph_date.php';

// Create a data set in range (50,70) and X-positions
define('NDATAPOINTS', 360);
define('SAMPLERATE', 240);
$start = time();
$end = $start + NDATAPOINTS * SAMPLERATE;
$data = [];
$xdata = [];
for ($i = 0; $i < NDATAPOINTS; ++$i) {
$NDATAPOINTS = 360;
$SAMPLERATE = 240;
$start = time();
$end = $start + $NDATAPOINTS * $SAMPLERATE;
$data = [];
$xdata = [];
for ($i = 0; $i < $NDATAPOINTS; ++$i) {
$data[$i] = rand(50, 70);
$xdata[$i] = $start + $i * SAMPLERATE;
$xdata[$i] = $start + $i * $SAMPLERATE;
}

// Create the new Graph\Graph
Expand Down
18 changes: 8 additions & 10 deletions Examples/examples_date/dateaxisex4.php
Expand Up @@ -7,18 +7,16 @@
use Amenadiel\JpGraph\Graph;
use Amenadiel\JpGraph\Plot;

require_once 'jpgraph/jpgraph_date.php';

// Create a data set in range (50,70) and X-positions
define('NDATAPOINTS', 360);
define('SAMPLERATE', 240);
$start = time();
$end = $start + NDATAPOINTS * SAMPLERATE;
$data = [];
$xdata = [];
for ($i = 0; $i < NDATAPOINTS; ++$i) {
$NDATAPOINTS = 360;
$SAMPLERATE = 240;
$start = time();
$end = $start + $NDATAPOINTS * $SAMPLERATE;
$data = [];
$xdata = [];
for ($i = 0; $i < $NDATAPOINTS; ++$i) {
$data[$i] = rand(50, 70);
$xdata[$i] = $start + $i * SAMPLERATE;
$xdata[$i] = $start + $i * $SAMPLERATE;
}

// Create the new Graph\Graph
Expand Down
14 changes: 7 additions & 7 deletions Examples/examples_date/datescaleticksex01.php
Expand Up @@ -3,11 +3,11 @@
/**
* JPGraph v3.6.15
*/
require_once '../jpgraph.php';
require_once '../jpgraph_line.php';
require_once '../jpgraph_date.php';
require_once __DIR__ . '/../../src/config.inc.php';
use Amenadiel\JpGraph\Graph;
use Amenadiel\JpGraph\Plot;

define('INTERVAL', 5 * 60);
$INTERVAL = 5 * 60;

// First create some "dummy" data
$m = 5; // Number of data sets
Expand All @@ -21,11 +21,11 @@
}
}

$start = floor(time() / INTERVAL) * INTERVAL;
$start = floor(time() / $INTERVAL) * $INTERVAL;
$times = [$start];
for ($i = 1; $i < $n; ++$i) {
// Create a timestamp for every 5 minutes
$times[$i] = $times[$i - 1] + INTERVAL;
$times[$i] = $times[$i - 1] + $INTERVAL;
}

// Setup the bid graph
Expand All @@ -51,7 +51,7 @@
$graph->xaxis->scale->SetDateFormat('H:i');

// Force labels to only be displayed every 5 minutes
$graph->xaxis->scale->ticks->Set(INTERVAL);
$graph->xaxis->scale->ticks->Set($INTERVAL);

// Adjust the start time for an "even" 5 minute, i.e. 5,10,15,20,25, ...
$graph->xaxis->scale->SetTimeAlign(MINADJ_5);
Expand Down
Expand Up @@ -6,16 +6,17 @@
require_once __DIR__ . '/../../src/config.inc.php';
use Amenadiel\JpGraph\Graph;
use Amenadiel\JpGraph\Plot;
use Amenadiel\JpGraph\Util;

// Get a dataset stored in $xdata and $ydata
require_once 'dataset01.inc.php';
include __DIR__ . '/../assets/dataset01.inc.php';

$dateUtils = new DateScaleUtils();
$dateUtils = new Util\DateScaleUtils();

// Setup a basic graph
$width = 500;
$height = 300;
$graph = new Graph\Graph($width, $height);
$__width = 500;
$__height = 300;
$graph = new Graph\Graph($__width, $__height);

// We set the x-scale min/max values to avoid empty space
// on the side of the plot
Expand Down

0 comments on commit 81d6e94

Please sign in to comment.