PHP Classes

PHP Histogram Titos: Render a histogram of stacked values in a Web page

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 156 All time: 9,014 This week: 68Up
Version License PHP version Categories
histogram-titos 1.0Free For Educatio...5HTML, PHP 5, Graphics, Statistics
Description 

Author

This class can render a histogram of stacked values in a Web page.

It take an array of values and generates HTML and CSS to display a histogram the values on a Web page.

The class can take parameters to define the starting value, number of bins, and intervals.

The histogram output includes relative frequency per bin to determine normal distribution of the set of values input.

The normal distribution is the relative percentage to the whole set per bin, that is all values add up to 1 or 100%. It allows to add the frequencies from left to right or right to left to determine the chances of getting in the set something of less or greater value from a particular bin.

The class also returns HTML for notes about the histogram.

Picture of Jorge Guerrero
  Performance   Level  
Name: Jorge Guerrero <contact>
Classes: 1 package by
Country: Mexico Mexico
Age: ???
All time rank: 426651 in Mexico Mexico
Week rank: 178 Up4 in Mexico Mexico Up

Example

<!DOCTYPE html>
<html>
<head><title>Histogram Call File</title></head>
<body>
<h4>Tito's Histogram</h4>
<p>The following Histogram takes in an array of monthly salaries offered for PHP Programmers in Mexico City for the months of September and October 2016.
<br>
All Values are in New Mexican Pesos <em>in Thousands</em>
<?
include 'Histogram.php';

$Salaries=array(13,13,15,9,17,5,11,25,15,17,13,7,13,11,19,11,19,9,17,13,15,30,17,7,15,19,17,9,19,13,13,9,17,11,17,17,15,11,19,15,17,25,19,7,11,17,11,30,13,11,30,17,17,15,15,7,17,9,5,9,17,19,15,22,22,22,19,15,17,5,5,25,15);

$histogram=new histogram();


$chart=$histogram->histogramTitos('Starting Monthly Salaries',$Salaries);
echo
$chart['Result'];
echo
$chart['Notes'];


?>
</p>
<p>
You may output as many histograms in a single file as needed just be sure to change the title for each!
</p>
</body>
</html>


  Files folder image Files (2)  
File Role Description
Accessible without login Plain text file example.php Example Calling Script for Class HistogramTitos
Plain text file Histogram.php Class HistogramTitosZip

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:156
This week:0
All time:9,014
This week:68Up