IntervalMarker transparency

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Naxter
Posts: 45
Joined: Thu Jun 26, 2014 8:24 am
antibot: No, of course not.
Location: Germany, Aachen

IntervalMarker transparency

Post by Naxter » Mon Sep 07, 2015 10:12 am

Hello guys,

I am working with the IntervalMarkers at the moment. I am able to display them properly and everything works fine.
There is only one part which I don´t understand.
The IntervalMarker are set in Foreground. No matter to what I change the "alpha" of the IntervalMarker, it does not affect the result of the diagram.
My Code:

Code: Select all

final Marker bst = new IntervalMarker(minium, maximum, myColor, new BasicStroke(2.0f), null, null, 0.3f);
getDrawingPanel().getChart().getXYPlot().addRangeMarker(bst);
Here is the result: It stays the same when I set it to 1.0f or even 0.0f. What I need is a lower transparency.
http://imgur.com/SLtdBy2

Thank you for your help.

Greetings

paradoxoff
Posts: 1634
Joined: Sat Feb 17, 2007 1:51 pm

Re: IntervalMarker transparency

Post by paradoxoff » Mon Sep 07, 2015 4:32 pm

Do you need a more transparent marker or do you need to put that in the background? These are two different things!

Naxter
Posts: 45
Joined: Thu Jun 26, 2014 8:24 am
antibot: No, of course not.
Location: Germany, Aachen

Re: IntervalMarker transparency

Post by Naxter » Tue Sep 08, 2015 7:10 am

I need a more transparent marker. But the "alpha" values at the initialisation do not affect the transparency as I said in the first post. So I don´t know if i made a mistake or if this is a bug.

paradoxoff
Posts: 1634
Joined: Sat Feb 17, 2007 1:51 pm

Re: IntervalMarker transparency

Post by paradoxoff » Tue Sep 08, 2015 12:29 pm

A marker on an XYPlot is drawn by creating an AlphaComposite based on the alpha value supplied in the constructor. If that doesn´t generate "enough" transparency, you could set the alpha to 1 and use a less opaque color by using one of the Color constructors with four float or int parameters instead of three.
BTW, the fact that I can see a curve on a region occupied with a marker that is in the foreground proves that you are getting a least some transparency.

Naxter
Posts: 45
Joined: Thu Jun 26, 2014 8:24 am
antibot: No, of course not.
Location: Germany, Aachen

Re: IntervalMarker transparency

Post by Naxter » Tue Sep 08, 2015 12:33 pm

Okay, I will see if that will get the result I want.
Thank you.

Locked