Setting Trasparency of Shape to 50%

TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
Post Reply
Happy
Newbie
Newbie
Posts: 10
Joined: Thu Nov 22, 2007 12:00 am

Setting Trasparency of Shape to 50%

Post by Happy » Fri Feb 29, 2008 7:54 am

Is there any way of settings the transparency of a shape to 50%. This is the code I currently have:

com.steema.teechart.styles.Shape prediction = new com.steema.teechart.styles.Shape(chart.getChart());
prediction.setColor(Color.RED);
prediction.setStyle(ShapeStyle.RECTANGLE);

The only function I can see is this:
prediction.setTransparent(true);
But I want to st it to 50%

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Feb 29, 2008 10:10 am

Hi Happy,

Yes, this is possible using this:

Code: Select all

        com.steema.teechart.styles.Shape shape1 = new com.steema.teechart.styles.Shape(tChart.getChart());
        
        shape1.setX0(0);
        shape1.setY0(0);
        shape1.setX1(100);
        shape1.setY1(100);
        
        shape1.getGradient().setVisible(true);
        shape1.getGradient().setStartColor(Color.RED);
        shape1.getGradient().setEndColor(Color.RED);
        shape1.getGradient().setTransparency(50);
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Happy
Newbie
Newbie
Posts: 10
Joined: Thu Nov 22, 2007 12:00 am

Post by Happy » Fri Feb 29, 2008 10:28 am

WORKS GREAT!!! Many Thanks!

Happy
Newbie
Newbie
Posts: 10
Joined: Thu Nov 22, 2007 12:00 am

Post by Happy » Mon Mar 03, 2008 8:54 am

Relating to this same topic:
Is there a way to remove the border of the shape at runtime?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Mar 03, 2008 11:58 am

Hi Happy,

Yes, this can be done like this:

Code: Select all

        shape1.getPen().setVisible(true);
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply