mirror of
https://github.com/seigler/neat-charts
synced 2025-07-26 17:06:09 +00:00
ran "composer install"
This commit is contained in:
parent
dcc0459d93
commit
733fb68f8b
3 changed files with 101 additions and 0 deletions
25
demo-as-image.php
Normal file
25
demo-as-image.php
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
require_once 'vendor/autoload.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 < 24; $n++) {
|
||||
$current -= $offset;
|
||||
$current *= 1 + $volatility * (rand()/getRandMax() - 0.5);
|
||||
$current += $offset;
|
||||
$chartData[$n] = $current;
|
||||
}
|
||||
|
||||
header('Content-type: image/svg+xml; charset=utf-8');
|
||||
$chart = new NeatCharts\LineChart($chartData, [
|
||||
'width'=>500,
|
||||
'height'=>400,
|
||||
'lineColor'=>'#00F',
|
||||
'labelColor'=>'#222',
|
||||
'smoothed'=>false,
|
||||
'fontSize'=>14
|
||||
]);
|
||||
echo $chart->render();
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue