Class Chart Documentation

Description

Class Chart - XML Generator for DHTMLX

construct

$chart = new Chart( set encoding, default utf-8 )

    $chart = new Grid;

or

    $chart = new Chart('iso-8859-1');

item

$chart->item( array( 'key attribute' => 'value attribute' ) )

    $chart->item(
        array(
            "id" => 01,
            "sales" => "35",
            "year" => "'07"
        )
    );

header

$chart->header()

    $chart->header();

return

    header("Content-type: application/xml; charset=utf-8");

result

$chart->result()

    echo $chart->result();

Print XML

Examples

Example 1

    <?php
    include_once 'DHX.php';
    
    $chart = new Chart;
    
    $chart->item(
        array(
            "id" => 01,
            "sales" => "35",
            "year" => "'07"
        ),
        array(
            "id" => 11,
            "sales" => "50",
            "year" => "'08"
        ),
        array(
            "id" => 21,
            "sales" => "65",
            "year" => "'09"
        ),
        array(
            "id" => 31,
            "sales" => "30",
            "year" => "'10"
        ),
        array(
            "id" => 41,
            "sales" => "45",
            "year" => "'11"
        )
    );
    
    $chart->header();
    echo $chart->result();
    ?>

Result

    <?xml version="1.0" encoding="utf-8"?>
    <data>
        <item id="1">
            <sales>35</sales>
            <year>'07</year>
        </item>
        <item id="11">
            <sales>50</sales>
            <year>'08</year>
        </item>
        <item id="21">
            <sales>65</sales>
            <year>'09</year>
        </item>
        <item id="31">
            <sales>30</sales>
            <year>'10</year>
        </item>
        <item id="41">
            <sales>45</sales>
            <year>'11</year>
        </item>
    </data>

Author

Lucas Tiago de Moraes

Support

Group DHTMLX Facebook