better testing pages

This commit is contained in:
Joshua Seigler 2016-06-27 22:35:47 -04:00
parent 8ace971698
commit 9e83c583d8
2 changed files with 42 additions and 6 deletions

View file

@ -8,7 +8,6 @@ hammering Poloniex half to death.
*/
ini_set('display_errors', 1);
//include 'buffer.php';
@ -20,12 +19,15 @@ spl_autoload_register(function ($class_name) {
$chartData = [];
$start = 0.01;// * rand()/getRandMax();
$volatility = 0.002;
$offset = 100 * (rand()/getRandMax())**4;
$scale = 100 * (rand()/getRandMax())**4;
$volatility = 0.5 * (rand()/getRandMax())**3;
for ($n = 0, $current = $start; $n < 50; $n++) {
$current += $volatility * (rand()/getRandMax() - 0.5)**3;
for ($n = 0, $current = $offset + 0.5 * $scale; $n < 96; $n++) {
$current -= $offset;
$current *= 1 + $volatility * (rand()/getRandMax() - 0.5);
$current += $offset;
$chartData[$n] = $current;
}
print SVGChartBuilder::renderStockChart($chartData);
print SVGChartBuilder::renderStockChart($chartData, 1000, "#708", "#777", false);

34
test-temperature.php Normal file
View file

@ -0,0 +1,34 @@
<?php
/*
This file is intended to be a testing ground in case
you want to adjust the parameters of these charts.
That way you can make lots of changes without
hammering Poloniex half to death.
*/
ini_set('display_errors', 1);
//include 'buffer.php';
Header('Content-type: image/svg+xml; charset=utf-8');
spl_autoload_register(function ($class_name) {
include $class_name . '.php';
});
$chartData = [];
$start = 100 * (rand()/getRandMax())**3;
$volatility = rand()/getRandMax();
$velocity = (rand()/getRandMax() - 0.5);
$acceleration = 0.1 * (rand()/getRandMax())**2;
for ($n = 0, $current = $start; $n < 24; $n++) {
$velocity *= 0.5;
$velocity += $acceleration * 2 * (rand()/getRandMax() - 0.5);
$current += $velocity;
$chartData[$n] = $current;
}
print SVGChartBuilder::renderStockChart($chartData, 1000, "#708", "#777", true);