Contents
Login Register Wishes Forum About
Miscellaneous » Playing with pData
Help topics
Latest updates
1997d  replaceImageMapTitle
1997d  replaceImageMapValues
1997d  createFunctionSerie
1997d  setAbsicssaPosition
1997d  negateValues
Toolbox
  Download as PDF
  Print this page
  Share this page
  Create an account
  Feed the updates!
Google AdSense
Playing with the pData Array

What is called "pData Array" within this documentation is a complex structure composed of many imbricated arrays containing all the data that you‘ll chart and the configuration of the associated axis. This array of arrays will describe the way data will be processed by the charting functions.

The format array is build by the pData class. A lot of internal public methods will help you to associate data to one serie, label an axis, define the way data will be displayed,..

Show me this array!

The easiest way to show what is contained in this array is to call the getData function of the pData class :
 /* Create the pData object */
 $MyData = new pData(); 

 /* Populate some data */
 $MyData->addPoints(array(1,2,3,4),"My Serie 1");

 /* This will dump the pData structure contents */
 print_r($MyData->getData());

This will display something like :
Array
(
    [XAxisDisplay] => 680001
    [XAxisFormat] =>
    [XAxisName] =>
    [XAxisUnit] =>
    [Abscissa] =>
    [Axis] => Array
        (
            [0] => Array
                (
                    [Display] => 680001
                    [Position] => 681002
                )
        )
    [Series] => Array
        (
            [My Serie 1] => Array
                (
                    [Description] => My Serie 1
                    [isDrawable] => 1
                    [Picture] =>
                    [Max] => 4
                    [Min] => 1
                    [Axis] => 0
                    [Color] => Array
                        (
                            [R] => 188
                            [G] => 224
                            [B] => 46
                        )
                    [Data] => Array
                        (
                            [0] => 1
                            [1] => 2
                            [2] => 3
                            [3] => 4
                        )
                )
        )
    [Min] => 1
    [Max] => 4
)

As you‘ll see, there is much more parameters in it than what we‘ve provided on line 5 of the script. This can be explained by the fact that we don‘t want that pChart users learn how to deal with this array, the maximum of things must be kept automatic and while creating a new serie, bunch of "default" parameters will be applied on it.

How to raw edit this array?

It‘s possible to rawly edit this array by directly accessing it trough the pData object :
 /* This will overwrite the name of the abscissa axis */
 $MyData->Data["XAxisName"] = "My X Axis";

..but be careful while playing this way, you may break the structure of the array and override the sanity checks made by the class methods.
Last updated on 11/03/2009 
by Jean-Damien 
Linked resources
  There is no linked topic yet.
Community comments
  No comments have been posted yet.
© Copyrights
Components used on this web site : Famfamfam icons has been made by Mark James, Rounded corners lite has been coded by Cameron Cooke and Tim Hutchison, SyntaxHighlighter has been written by Alex Gorbatchev. pChart and this web site have been created by Jean-Damien POGOLOTTI. This documentation contains 185 pages and 56 comments. 409 users have registered. This page has been rendered in 0,01 seconds. Wiki revision 1.37.