mirror of
https://github.com/seigler/cryptohistory.org
synced 2025-07-27 09:46:10 +00:00
functioning rest-style chart server!
This commit is contained in:
commit
e1784bdd4c
8 changed files with 434 additions and 0 deletions
23
views/fakeStockData.php
Normal file
23
views/fakeStockData.php
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
$chartData = [];
|
||||
|
||||
$offset = 100 * (rand()/getRandMax())**4;
|
||||
$scale = 100 * (rand()/getRandMax())**2;
|
||||
$volatility = 0.5 * (rand()/getRandMax())**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;
|
||||
}
|
||||
|
||||
$stockChart = new NeatCharts\LineChart($chartData, [
|
||||
"width"=>500,
|
||||
"height"=>150,
|
||||
"fontSize"=>10
|
||||
]);
|
||||
print $stockChart->render();
|
||||
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue