-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcurved-line-chart.php
82 lines (75 loc) · 2.66 KB
/
curved-line-chart.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
use Maantje\Charts\Chart;
use Maantje\Charts\Line\Line;
use Maantje\Charts\Line\Lines;
use Maantje\Charts\Line\Point;
require '../vendor/autoload.php';
$chart = new Chart(
series: [
new Lines(
lines: [
new Line(
points: [
new Point(x: 0, y: 0),
new Point(x: 50, y: 20),
new Point(x: 100, y: 5),
new Point(x: 150, y: 25),
new Point(x: 200, y: 10),
new Point(x: 250, y: 30),
new Point(x: 300, y: 15),
new Point(x: 350, y: 25),
new Point(x: 400, y: 35),
],
color: 'red',
curve: 8
),
new Line(
points: [
new Point(x: 0, y: 2),
new Point(x: 50, y: 4),
new Point(x: 100, y: 8),
new Point(x: 150, y: 16),
new Point(x: 200, y: 32),
new Point(x: 250, y: 32),
new Point(x: 300, y: 64),
new Point(x: 350, y: 96),
new Point(x: 400, y: 128),
],
color: 'blue',
curve: 6
),
new Line(
points: [
new Point(x: 0, y: 10),
new Point(x: 50, y: 20),
new Point(x: 100, y: 10),
new Point(x: 150, y: 0),
new Point(x: 200, y: 10),
new Point(x: 250, y: 20),
new Point(x: 300, y: 10),
new Point(x: 350, y: 5),
new Point(x: 400, y: 0),
],
color: 'green',
curve: 5
),
new Line(
points: [
new Point(x: 0, y: 5),
new Point(x: 50, y: 15),
new Point(x: 100, y: 30),
new Point(x: 150, y: 30),
new Point(x: 200, y: 20),
new Point(x: 250, y: 40),
new Point(x: 300, y: 20),
new Point(x: 350, y: 35),
new Point(x: 400, y: 50),
],
color: 'purple',
curve: 7
),
]
),
],
);
echo $chart->render();