-
Notifications
You must be signed in to change notification settings - Fork 3
/
mixed-chart.php
118 lines (114 loc) · 3.48 KB
/
mixed-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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
require '../vendor/autoload.php';
use Maantje\Charts\Annotations\PointAnnotation;
use Maantje\Charts\Annotations\XAxis\XAxisRangeAnnotation;
use Maantje\Charts\Annotations\YAxis\YAxisLineAnnotation;
use Maantje\Charts\Bar\Bar;
use Maantje\Charts\Bar\Bars;
use Maantje\Charts\Bar\Segment;
use Maantje\Charts\Bar\StackedBar;
use Maantje\Charts\Chart;
use Maantje\Charts\Formatter;
use Maantje\Charts\Line\Line;
use Maantje\Charts\Line\Lines;
use Maantje\Charts\Line\Point;
use Maantje\Charts\XAxis;
use Maantje\Charts\YAxis;
$chart = new Chart(
yAxis: new YAxis(
annotations: [
new PointAnnotation(
x: 200,
y: 12000,
markerSize: 10,
markerBackgroundColor: 'white',
markerBorderColor: 'red',
markerBorderWidth: 4,
label: 'Point annotation',
),
new YAxisLineAnnotation(
y: 8400,
color: 'blue',
size: 3,
label: 'Y Axis annotation',
labelColor: 'white',
),
],
formatter: Formatter::number('nl_NL', 2)
),
xAxis: new XAxis(
annotations: [
new XAxisRangeAnnotation(
x1: 100,
x2: 200,
color: 'pink',
label: 'X Axis range annotation'
),
],
),
series: [
new Lines(
lines: [
new Line(
points: [
new Point(y: 0, x: 0),
new Point(y: 4000, x: 100),
new Point(y: 12000, x: 200),
new Point(y: 8000, x: 300),
],
),
new Line(
points: [
new Point(y: 0, x: 0),
new Point(y: 12000, x: 100),
new Point(y: 14000, x: 200),
new Point(y: 7000, x: 300),
],
lineColor: 'blue'
),
]
),
new Bars(
bars: [
new StackedBar(
name: 'January',
segments: [
new Segment(
value: 4000,
color: 'green',
labelColor: 'white',
),
new Segment(
value: 3000,
color: 'red',
labelColor: 'white',
),
],
formatter: Formatter::number('nl_NL', 2),
),
new Bar(
name: 'February',
value: 10000,
color: 'green'
),
new StackedBar(
name: 'March',
segments: [
new Segment(
value: 4000,
color: 'green',
labelColor: 'white',
),
new Segment(
value: 3000,
color: 'red',
labelColor: 'white',
),
],
percentage: true,
),
],
),
],
);
echo $chart->render();