Download the PHP package macocci7/php-histogram without Composer
On this page you can find all versions of the php package macocci7/php-histogram. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download macocci7/php-histogram
More information about macocci7/php-histogram
Files in macocci7/php-histogram
Package php-histogram
Short Description it's easy to use for creating histograms.
License MIT
Informations about the package php-histogram
PHP-Histogram
1. Features
PHP-Histogram
is a PHP Library which is easy to use for creating histograms.
You can create a simple Histogram just by setting class range
and data
and filepath
to save.
Frequency Polygon
, Cumulative Frequency Polygon
, Cumulative Relative Frequency Polygon
and plotting Frequency
are supported.
Changing other properties, such as Caption
, X Label
, Y Label
, Various Color
s, Canvas Size
, Frame Ratio
and Various Width
are supported.
Transparent background is also supported.
2. Contents
- 1. Freatures
- 2. Contents
- 3. Requirements
- 4. Installation
- 5. Usage
- 5.1. Basic Usage
- 5.2. Changing Properties By Methods
- 5.3. Changing Properties By Neon File
- 5.4. Changing Properties By Array
- 5.5. Transparent Background
- 6. Examples
- 7. License
3. Requirements
- PHP 8.1 or later
- Imagick PHP Extention
- Composer
4. Installation
5. Usage
5.1. Basic Usage
-
PHP: examples/BasicUsage.php
-
Result:
- Details:
- Import autoloader:
require_once __DIR__ . '/../vendor/autoload.php'
- Declare:
use Macocci7\PhpHistogram\Histogram
- Instantiate:
new Histogram()
ornew Histogram($width, $height)
$width
: canvas width, type ofint
, must be50 <= $width
,400
px as default.$height
: canvas height, type ofint
, must be50 <= $height
,300
px as default.
- Set Class Range:
setClassRange($classRange)
$classRange
: type of positiveint|float
.
- Set Data:
setData($data)
$data
: type ofarray<int|string, int|float>
- Create:
create($path2Save)
$path2Save
: type ofstring
.
- Import autoloader:
5.2. Changing Properties By Methods
You can change properties of Histogram like as follows.
-
PHP: examples/ChangePropsByMethods.php
-
Result: examples/img/ChangePropsByMethods.png
5.3. Changing Properties By Neon File
You can change properties of Histogram like as follows.
First, create a Neon file.
- Neon File: examples/ChangePropsByNeon.neon
Second, Code PHP as follows.
- PHP: examples/ChangePropsByNeon.php
Then, run the PHP code and view the result.
-
Result: examples/img/ChangePropsByNeon.png
5.4. Changing Properties By Array
You can change properties of Histogram like as follows.
-
PHP:
-
Result: examples/img/ChangePropsByArray.png
5.5. Transparent Background
Setting colors to transparent is supported.
For example,
-
PHP: examples/TransparentBackground.php
-
Result: examples/img/TransparentBackground.png
Check if the image has transparent background with HTML:
examples/TransparentBackground.html
6. Examples
-
BasicUsage.php >> results in:
-
ChangePropsByMethods.php >> results in:
-
ChangePropsByNeon.php >> results in:
-
ChangePropsByArray.php >> results in:
-
TransparentBackground.php >> results in:
-
HistogramExampleCase.md
-
OhtaniShoheiHistogram2023.md
- PopulationInJapanHistogram2022.md
7. License
MIT
Document created: 2023/05/28
Document updated: 2024/07/05
Copyright 2023-2024 macocci7
All versions of php-histogram with dependencies
macocci7/php-frequency-table Version ^1.3
intervention/image Version ^3.7
nette/neon Version ^3.4
fakerphp/faker Version ^1.23
macocci7/php-plotter2d Version ^0.1