Skip to content

evokelektrique/histogram-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Historgram PHP

A histogram is an approximate representation of the distribution of numerical data. Wikipedia



Usage

Source used in example from Mark Basarab

// Load a source into model
$file = "./temp/desert.jpg";
$histogram = new Histogram($file);

// Custom styles
$options = [
  // Bars max height
  "max_height" => 256,

  // Bars styles
  "bar_styles" => [
    "width" => "4px",
    "background" => "linear-gradient(to bottom, #2380ac, #2f2629)",
    "display" => "inline-block",
    "border-top-right-radius" => "2px",
    "border-top-left-radius" => "2px",
  ],

  // Wrapper styles
  "wrapper_styles" => [
    "display" => "inline-table",
  ]
];

// Display histogram model
$histogram->display($options);

And if you want to get a list of bar heights for more customization you could use the below example:

// Get a list of bars from the model with maximum heights of "300"
$bars = $histogram->get_bars($histogram->histogram, 300);

About

PHP class for histograms

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages