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 PHP-Histogram creates histograms using FrequencyTable.
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 Colors, 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.3 or later
-
Imagick PHP Extension
Check with commands:
-
Mbstring PHP Extension
Check with commands:
- 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,400px as default.$height: canvas height, type ofint, must be50 <= $height,300px 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
- OhtaniShoheiHistogram2025-2026.md
7. License
MIT
All versions of php-histogram with dependencies
macocci7/php-frequency-table Version ^1.4
nette/neon Version ^3.4
fakerphp/faker Version ^1.24
macocci7/php-plotter2d Version ^1.0