Page 1 of 1

some question

Posted: Mon Mar 16, 2009 5:12 pm
by 15852698
Hi all!

I am using Teecharts PHP version ( 04-March-2009).

How can I:

1. leave weekend days from a chart displaying candles? ( now, there is a gap at weekends )

2. set border width to 0 ? ( something draw a thick line to the bottom and right side of my chart )

3. set volume chart type's width ? ( change to bar type is the only solution? )

4. set axis's title offset? or remove axis labels, but keep the scaling help lines?

Thanks a lot
T

Posted: Wed Mar 18, 2009 1:36 pm
by Pep
Hi,
1. leave weekend days from a chart displaying candles? ( now, there is a gap at weekends )
One way would be to use similar code to the following one :

Code: Select all

    // Axis labels no Weekends
    // Depending if the table contains data from weekends or not you can make use of the dayofweek comparison (setting the label into the addCandle method) or setting the labels using the setLabels method.

    $chart->getAspect()->setView3D(false);
    $candle = new Candle($chart->getChart());
    // Create array of DateTime Values, which could be obtained from BBDD.
    $labels = Array("08/05/2008",
        "09/05/2008",
        "12/05/2008",
        "13/05/2008",
        "14/05/2008",
        "15/05/2008",
        "16/05/2008",
        "19/05/2008",
        "20/05/2008",
        "21/05/2008",
        "22/05/2008",
        "23/05/2008");

        /* no dates */
        $candle->getXValues()->setDateTime(false);
        $chart->getAxes()->getBottom()->getLabels()->setAngle(90);

        /* fill the candle with random points */
        $generator = rand(0,1000);
        $tmpOpen = $generator*1000;

        $count = 0;

        for ($t=0; $t < 13; $t++) {
            $tmpOpen  = $tmpOpen + $generator*100 - 50;
            $tmpClose = $tmpOpen - $generator*100 + 50;

            $dayOfWeek = jddayofweek ( cal_to_jd(CAL_GREGORIAN, date("m"),date("d")+$t, date("Y")) , 1 );
            if (($dayOfWeek != 'Saturday') && ($dayOfWeek != 'Sunday'))
            {
                  ++$count;

                /* add the point */
                $candle->addCandle(
                        $count,
                        $tmpOpen,
                        $tmpOpen + $generator*10,
                        $tmpClose - $generator*10,
                        $tmpClose,
                        $dayOfWeek
                        );
            }
        }

        // $candle->setLabels($labels);
        $chart->getAxes()->getBottom()->getLabels()->setStyle(AxisLabelStyle::$TEXT);

        $chart->getLegend()->setVisible(false);
        $chart->getPanel()->getBevel()->setWidth(0);
Please download the latest version from our web site which includes some modifications related to this.
2. set border width to 0 ? ( something draw a thick line to the bottom and right side of my chart )
Yes, it's the 3D effect border, it can be changed by using :

Code: Select all

$chart->getPanel()->getBevel()->setWidth(0);
3. set volume chart type's width ? ( change to bar type is the only solution? )
You can change the width of the Volume bar by using :

Code: Select all

$volume->getLinePen()->setWidth(3);
4. set axis's title offset? or remove axis labels, but keep the scaling help lines?
I suggest you download the latest TeeChart for PHP version (ujpdated on 14th March) from our web site. This version includes some fixes and changes related on this matter ( axis title ).
In the case you want to hide the axis labels you can always set a transparent color for font :

Code: Select all

$chart->getChart()->getAxes()->getBottom()->getLabels()->getFont()->setColor(new Color(0,0,0,255));

Posted: Thu Mar 19, 2009 10:06 am
by 15852698
Hi!

Thank you very much, almost all of my problems were solved.

One more:

I've tried to find out the way how can i format the label values on the axis...
Perhaps you can give me some example :)

In this particular case i have to shorten the values on the vertical axis ( the volume series on the horizontal axis). for eexample: 10000000 -> 10M or 5000 -> 5k

Thank you again!!!

Posted: Mon Mar 23, 2009 5:22 pm
by Pep
Hi,

at this moment one way would be to add custom axis labels manually, for example using similar code to the following one (it clears all the left axis labels and then add a specific label at specific value position) :

Code: Select all

 $chart->getChart()->getAxes()->getLeft()->getLabels()->setStyle(AxisLabelStyle::$TEXT);
// To draw custom labels on the axis :       $chart->getChart()->getAxes()->getLeft()->getLabels()->getItems()->clear();       $chart->getChart()->getAxes()->getLeft()->getLabels()->getItems()->add(5000,"5k"); 
I'm just implementing new events for the TeeChart for PHP version, and one of them is the OnGetAxisLabel event which allows to change the axis labels easily just by checking which label is going to be displayed and modifing it if necessary. I'll advise when the version which includes this event is prepared.

Re: some question

Posted: Tue Jun 23, 2009 11:40 pm
by 15952693
I'm just implementing new events for the TeeChart for PHP version, and one of them is the OnGetAxisLabel event which allows to change the axis labels easily just by checking which label is going to be displayed and modifing it if necessary. I'll advise when the version which includes this event is prepared.

Did this improved version get posted? This was 3 months ago. Any news?

Re: some question

Posted: Mon Jun 29, 2009 8:57 am
by Pep
Hello,

not for the moment, sorry for delay, we're working on this and other new features for the next maintenance of TeeChart for PHP. We expect to post it in few weeks. We'll try to post it as soon as possible. I'll also notify you.