Page 1 of 1

Some help with teeChart PHP

Posted: Tue Jun 18, 2013 2:47 pm
by 9527810
Hello,
I'm actually working for a society and trying to use TeeChart PHP for some web graphs.
I never used this object and i encounter some problems with the basics.
I just whant to diplay a simple graph with a 2 dimension table (X and Y) and put a Point for each x-y couple.
I follow the tutorial and understant what they did but they explain no where how to draw points instead of Bar or Line.
So if someone can indicate me how to simply dray points with X and Y as variables and how to just change the colors
(how to use" set Color(new Color(XXX,XXX,XXX)) ").
And eventually how to change the shape of the point (point,cross and so...).
Thank you for your help and sorry for my poor english.

Re: Some help with teeChart PHP

Posted: Thu Jun 20, 2013 2:27 pm
by yeray
Hi,

Please, take a look at the feature demo included with the installation. You'll find examples about the majority of series.
I see the example of the Points series does it with sample values:

Code: Select all

$points = new Points($chart1->getChart());
$points->fillSampleValues();
In your case, you can substitute it for, ie:

Code: Select all

    $points = new Points($chart1->getChart());
    for ($i=0; $i<25; $i++) {
        $points->addXY($i, $i*10);
    }
cydarex wrote:how to just change the colors
(how to use" set Color(new Color(XXX,XXX,XXX)) ").
Once you have added the points, you can change the colors, ie, like this:

Code: Select all

    $points->setColorEach(true);
    $palette=Theme::getOperaPalette();
    for ($i=0; $i<$points->getCount(); $i++) {
        $points->getColors()->setColor($i, $palette[$i%sizeof($palette)]);
    }
Or you could add your points with Color directly:

Code: Select all

    $points->setColorEach(true);
    $palette=Theme::getOperaPalette();
    for ($i=0; $i<25; $i++) {                             
        $points->addXYColor($i, $i*10, $palette[$i%sizeof($palette)]);
    }
cydarex wrote:And eventually how to change the shape of the point (point,cross and so...).
For example:

Code: Select all

    $points->getPointer()->setStyle(PointerStyle::$CIRCLE);