Some help with teeChart PHP

TeeChart for PHP
Post Reply
cydarex
Newbie
Newbie
Posts: 1
Joined: Thu Jul 21, 2005 4:00 am

Some help with teeChart PHP

Post by cydarex » Tue Jun 18, 2013 2:47 pm

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.

Yeray
Site Admin
Site Admin
Posts: 8669
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Some help with teeChart PHP

Post by Yeray » Thu Jun 20, 2013 2:27 pm

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);
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply