ChartClass
Door - -, 21 jaar geleden, 4.338x bekeken
Met deze class kun je makkelijk grafieken tekenen. Hij is niet erg uitgebreid.
Een zipje met de code is hier af te halen.
Tips voor verbeteringen zijn welkom :)
Edit:
Voorbeeld:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
include 'class.chart.php';
include 'class.chartline.php';
include 'class.color.php';
include 'class.myexception.php';
$chart = new Chart(500, 300, false);
$white = new Color('#FFFFFF');
$green_hard = new Color('#00FF00');
$green_soft = new Color('#DDFFDD');
$gray = new Color('#999999');
$blue = new Color('#0000FF');
$red = new Color('#FF0000');
$chart->setBackgroundColor($white);
$chart->setAxesColor($green_hard);
$chart->setGridColor($green_soft);
$chart->setTextColor($gray);
$chart->setPadding(10,10,30,50);
$chart->setGrid(true, true);
$chart->setOffset(50, 30);
$chart->setScale(10,10);
$line = $chart->addLine();
$points = array(
array(10,20),
array(14,10),
array(30,50),
array(52,40)
);
$line->addPoints($points);
$line->setColor($red);
$line->setThickness(2);
$line2 = $chart->addLine();
$line2->setColor($blue);
$line2->setThickness(2);
for($i = 0; $i < 20; $i++)
$line2->addPoint(rand(3, 140), rand(5,52));
$labelsVer = array(
1 => 'here!',
2 => 'put text',
5 => 'You can'
);
$chart->setLabelsHor(2);
$chart->setLabelsVer($labelsVer);
header('Content-type: image/gif');
$chart->createImage(IMAGETYPE_GIF);
?>
include 'class.chart.php';
include 'class.chartline.php';
include 'class.color.php';
include 'class.myexception.php';
$chart = new Chart(500, 300, false);
$white = new Color('#FFFFFF');
$green_hard = new Color('#00FF00');
$green_soft = new Color('#DDFFDD');
$gray = new Color('#999999');
$blue = new Color('#0000FF');
$red = new Color('#FF0000');
$chart->setBackgroundColor($white);
$chart->setAxesColor($green_hard);
$chart->setGridColor($green_soft);
$chart->setTextColor($gray);
$chart->setPadding(10,10,30,50);
$chart->setGrid(true, true);
$chart->setOffset(50, 30);
$chart->setScale(10,10);
$line = $chart->addLine();
$points = array(
array(10,20),
array(14,10),
array(30,50),
array(52,40)
);
$line->addPoints($points);
$line->setColor($red);
$line->setThickness(2);
$line2 = $chart->addLine();
$line2->setColor($blue);
$line2->setThickness(2);
for($i = 0; $i < 20; $i++)
$line2->addPoint(rand(3, 140), rand(5,52));
$labelsVer = array(
1 => 'here!',
2 => 'put text',
5 => 'You can'
);
$chart->setLabelsHor(2);
$chart->setLabelsVer($labelsVer);
header('Content-type: image/gif');
$chart->createImage(IMAGETYPE_GIF);
?>
Voorbeeld: http://herjan.treurniet.com/phphulp/voorbeelden/chartclass/
Gesponsorde koppelingen
PHP script bestanden
Er zijn 7 reacties op 'Chartclass'
Om te reageren heb je een account nodig en je moet ingelogd zijn.
PHP hulp
0 seconden vanaf nu