-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathadvanced-bar-chart.php
65 lines (61 loc) · 1.62 KB
/
advanced-bar-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
<?php
require '../vendor/autoload.php';
use Maantje\Charts\Annotations\YAxis\YAxisLineAnnotation;
use Maantje\Charts\Bar\Bar;
use Maantje\Charts\Bar\Bars;
use Maantje\Charts\Chart;
use Maantje\Charts\Formatter;
use Maantje\Charts\YAxis;
$chart = new Chart(
yAxis: new YAxis(
minValue: 120000,
maxValue: 230000,
annotations: [
new YAxisLineAnnotation(
y: 200000,
color: 'green',
label: 'Target',
textLeftMargin: -1
),
new YAxisLineAnnotation(
y: 150000,
color: 'red',
label: 'Loss',
textLeftMargin: -2
),
],
formatter: Formatter::currency('nl_NL', 'EUR')
),
series: [
new Bars(
bars: [
new Bar(
name: 'January',
value: 222301,
color: 'lightgreen'
),
new Bar(
name: 'February',
value: 189242,
color: 'yellow',
),
new Bar(
name: 'March',
value: 144922,
color: 'red'
),
new Bar(
name: 'April',
value: 222301,
color: 'lightgreen'
),
new Bar(
name: 'May',
value: 222301,
color: 'lightgreen'
),
],
),
],
);
echo $chart->render();