PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Mario Herrmann   HTML Chart   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Examples including the "Readme"
Class: HTML Chart
Drawing a Chart in HTML
Author: By
Last change: imagefolder
Date: 21 years ago
Size: 4,267 bytes
 

Contents

Class file image Download
<html>
<head><title>HTML Chart Examples</title></head>
<body bgcolor="#4f4f4f">

<?
/**
    Exammple File
*/

include "class_html_chart.php";

$dia =new THtml_Chart();


/**
    1. Example/Beispiel
*/
    /**
        # English
            create an array which saves the statistik values u want to "paint"
            the key of Ur index must be unique
        # Deutsch
            Array anlegen in dem die Statistikwerte (oder was auch immer)
            gespeichert werden
            Der Index Wert des Arrays muss eindeutig sein !
    */
   
$values=array( "Peter"=>array(10),
                   
"Ulf"=>array(10.7),
                   
"Jan"=>array(17),
                   
"Stefan"=>array(9),
                   
"Mario"=>array(40));

   
/**
        #
            Setting the picture path /url if u want to
            have this pictures for ur own needs just copy them from
            http://www.et.hs-wismar.de/~mm98019/htmlchart/HTML_CHART_PICS.zip
        #
            Setzen des Bildpfades
            Die Bilder gibt es als .zip unter
            http://www.et.hs-wismar.de/~mm98019/htmlchart/HTML_CHART_PICS.zip

    */
   
$dia->set_imagefolder("http://www.et.hs-wismar.de/~mm98019/htmlchart/");


   
/**
        #
            "paint" the chart
            @param -> the array with the important values
            @param -> Caption of the Y axis
            @param -> Caption of the X axis
            @param -> Title of the Chart
        #
            das Diagramm darstellen
            @param -> unser Array mit den Statistikdaten
            @param -> Y Achsenbeschriftung
            @param -> X Achsenbeschriftung
            @param -> Titel des Diagramms
    */
   
$dia->show_diagramm($values,"Name","Easter Eggs","Simple Easter Egg Chart",array("Number of eggs"));





/**
    2. Example/beispiel
*/
   
$values=array("1999"=>array(4000,3000,400),
                   
"2000"=>array(3000,2000,300),
                   
"2001"=>array(2000,1003,150));
   
/**
        #
            set the caption foreach of the inner array values
        #
            Die Legende für die Einzelnen Balken
            der Inneren Arrays der $values
    */
   
$cap=array("gross","net","after the month");
   
/**
        #
            show the actual value behind each bar
        #
            Jeden Wert hinter dem jeweiligen Balken anzeigen lassen
    */
   
$dia->set_show_x_values(1);
   
/**
        #
            set a measure
        #
            Maßeinheit vergeben
    */
   
$dia->set_measure("US $");
   
$dia->show_diagramm($values,"Year","Money","An English Chart",$cap);

/**
    3. Example/Beispiel
*/
   
$cap=array("Brutto","Netto","Was am Monatsende übrig bleibt");
   
$dia->set_measure("&euro;");
   
/**
        #
            set the String of an info field
        #
            Infofeld setzen
    */
   
$dia->set_maxstring("Maximalwert");
   
/**
        #
            Change BackgroundColor
        #
            Hintergrundfarbe ändern
    */
   
$dia->set_bgcolor("#CCCCFF");
   
$dia->show_diagramm($values,"Jahr","Verdienst","Deutsches Diagramm",$cap);
/**
    4. Example/Beispiel
*/
    /**
        #
            reset Objectvalues to default values
        #
            Zurücksetzen der Objektvariablen auf die Ausgangswerte
    */
   
$dia->_reset();
   
$dia->set_imagefolder("http://www.et.hs-wismar.de/~mm98019/htmlchart/");
   
$values=array("Nadja"=>array(20,30,90,29,90,55,78),
                   
"Timo"=>array(25,34,40,69,90,34,66),
                   
"Klaus"=>array(2,100,30,59,60,75,8)
                    );

   
$dia->set_measure("%");
   
$cap=array("Test A","Test B","Test C","Test D","Test F","Test G","Test H");
   
$dia->set_bgcolor("#CCCCCC");
   
$dia->set_headcolor("#FFFFFF");
   
$dia->set_bordercolor("#CC0000");

   
/**
        #
            show average for each main entry in array
            its difficult to explan just look what it makes
        #
            Durschnitt der Werte für die Hauptwerte des Array anzeigen
            schwierig zu erklären - einfach mal ausprobieren
    */
   
$dia->set_show_avg(1);
   
/**
        #
            show average for each caption element
        #
            Durschnitt der Werte für die Legende anzeigen
    */
   
$dia->set_show_cap_avg(1);
   
$dia->set_show_x_values(1);
   
$dia->show_diagramm($values,"Pupil","Percent","Test statistics",$cap);
/**
    4. Example/Beispiel
*/
    /**
        #
            Here u can set ur own Bar colors
            if there are more bars than colors
            the first color automatically will be set
        #
            Balkenfarbe festlegen
            Sollten mehr Grafische Balken als definierte Farben existieren so wird
            wieder mit der ersten Farbe begonnen
    */
   
$dia->set_bar_colors(array("#FFFFFF","#00FFFF","#FF0000","#CC0000","#FFFF00","#FF00FF"));
   
$dia->show_diagramm($values,"Pupil","Percent","Test statistics in different colors",$cap);
?>
</body></html>