Page 1 of 1

shadows

Posted: Fri Sep 02, 2011 7:44 pm
by 15960028
I've recently purchased teechart php and I have a many questions. I need to produce a custom graph which involves drawing text on the screen then circumscribing it with either an rectangle or an ellipse.
The annotation tool is a near perfect fit for the rectangle side of that. I have two questions concerning shadows.

1) The annotation tool seems to add a shadow to annotations by default, can this be turned on/off by annotation ?

2) I would like to have the option to add shadows to ellipses and rectangles and any shaps I draw , can this be done ?

Thanks

Re: shadows

Posted: Mon Sep 05, 2011 1:55 pm
by yeray
Hello,
ISVA7655 wrote:1) The annotation tool seems to add a shadow to annotations by default, can this be turned on/off by annotation ?
Yes, you can do it as follows:

Code: Select all

$annotation1->getShape()->getShadow()->setVisible(false);
ISVA7655 wrote:2) I would like to have the option to add shadows to ellipses and rectangles and any shaps I draw , can this be done ?
You can draw ellipses and rectangles directly to the rendered chart image as follows:

Code: Select all

        $chart1 = new TChart(400,250);

        $bar=new Bar($chart1->getChart());
        $chart1->getChart()->getSeries(0)->setColorEach(true);
        $chart1->getChart()->getSeries(0)->fillSampleValues(10);
                
        $chart1->render("chart1.png");

        $chart1->getChart()->getGraphics3D()->TextOut(10,10,0,"hellooooooooo");
        $chart1->getChart()->getGraphics3D()->getBrush()->SetColor(Color::BLUE());
        $chart1->getChart()->getGraphics3D()->Rectangle(new Rectangle(10,10,100,100)); 
        $chart1->getChart()->getGraphics3D()->getBrush()->SetColor(Color::RED());
        $chart1->getChart()->getGraphics3D()->ellipse(200,200,300,250);

        imagepng($chart1->getChart()->getGraphics3d()->img, "chart1.png");
However, these custom drawing methods don't support shadows, so I'm afraid you should create your own classes to support it. Something like the annotation tool does, that has a Shadow property.
I'll add to the wish list the possibility to add more shape styles for the annotation tool (TF90015724).