-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChangePropsByMethods.php
More file actions
86 lines (61 loc) · 2.09 KB
/
ChangePropsByMethods.php
File metadata and controls
86 lines (61 loc) · 2.09 KB
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
<?php
require_once __DIR__ . '/../vendor/autoload.php';
use Macocci7\PhpHistogram\Histogram;
// Initialization
$hg = new Histogram();
$hg
->setClassRange(5)
->setData([1, 5, 6, 10, 12, 14, 15, 16, 17, 18, 20, 24, 25])
// Changing Props By Methods
// Canvas Size: ($width, $height) / Deafult: (400, 300)
// 50 <= $width / 50 <= $height
->resize(600, 400)
->plotarea( // this takes precedence over 'frame()'
offset: [120, 80], // [x, y] in pix, default=[]
width: 360, // width in pix, default=0
height: 240, // height in pix, default=0
backgroundColor: null, // null as transparent, default=null
)
// Ratio of the size of the plot area to the Canvas Size
// frame($width, $height) / Default: (0.8, 0.7)
// 0 < $width <= 1.0 / 0 < $height <= 1.0
->frame(0.6, 0.6)
// Canvas Background Color
// only #rgb and #rrggbb formats are supported.
->bgcolor('#3333cc')
// Axis: width in pix and color
->axis(3, '#ffffff')
// Grid: width in pix and color
->grid(1, '#cccccc')
// Color of bars
->color('#99aaff')
// Border of bars: width in pix and color
->border(4, '#0000ff')
// Frequency Polygon: width in pix and color
->fp(4, '#00ff00')
// Cumulative Relative Frequency Polygon
->crfp(3, '#ffff00')
// Font Path
// Note: Set the real path to the true type font (*.ttf)
// on your system.
->fontPath('/usr/share/fonts/opentype/ipafont-gothic/ipagp.ttf')
// Font Size in pix
->fontSize(20)
// Font Color
->fontColor('#ffff99')
// Visibility of Histogram bars. barOff() is also available
->barOn()
// Visibility of frequency polygon. fpOff() is also available
->fpOn()
// Visibility of cumulative frequency polygon. crfpOff() is also available
->crfpOn()
// Visibility of frequency. frequencyOff() is also available
->frequencyOn()
// X Label
->labelX('Items Purchased')
// Y Label
->labelY('Number of Customers')
// Caption
->caption('Items Purchased / month (Mar 2026)')
// Save
->create(__DIR__ . '/img/ChangePropsByMethods.png');