Hello !
I'm trying to superimpose 2 chart with different alpha value but only one of them are visible ...
I'm using a XYBlockRenderer and I was wondering if this type of chart enable me to do that.
Is it possible to display 2 chart with this type of renderer ?
Superimpose 2 block chart
-
- Posts: 513
- Joined: Wed Sep 12, 2007 3:18 pm
Re: Superimpose 2 block chart
You might try Plot::setForegroundAlpha.
Re: Superimpose 2 block chart
But that will set the alpha for every dataset, doesn't it ? Or I have to create 1 plot for each dataset ?
NB : I've already to change the transparency by having a paintScale (custom - with transparency) for each renderer
NB : I've already to change the transparency by having a paintScale (custom - with transparency) for each renderer
-
- Posts: 513
- Joined: Wed Sep 12, 2007 3:18 pm
Re: Superimpose 2 block chart
Using setForegroundAlpha() results in draw() applying the AlphaComposite.SRC_OVER rule, using the current alpha, to the graphics context. If you don't setForegroundAlpha(), you get the default value of 1.0f.
You can add more than one dataset and renderer to a single XYPlot.
You can add more than one dataset and renderer to a single XYPlot.
Re: Superimpose 2 block chart
I've try your solution but it seems that the behavior is the same, the last dataset override the previous dataset ...
My goal is to display every dataset like you can superimpose layer, if you have any idea how to do it I will be glad to try it
But for now I've no idea how to do it and I've tried many solution :
* Change the alpha of the paint scale
* Change the alpha of the paint scale => 1 paint scale and 1 renderer by dataset
* Add an Alpha composite (Your solution)
None of them work, but if you think that one solution should work please explain me why and how
My goal is to display every dataset like you can superimpose layer, if you have any idea how to do it I will be glad to try it
But for now I've no idea how to do it and I've tried many solution :
* Change the alpha of the paint scale
* Change the alpha of the paint scale => 1 paint scale and 1 renderer by dataset
* Add an Alpha composite (Your solution)
None of them work, but if you think that one solution should work please explain me why and how
-
- Posts: 513
- Joined: Wed Sep 12, 2007 3:18 pm
Re: Superimpose 2 block chart
The demo HistogramDemo1.java is a good example that uses setForegroundAlpha(). I know a similar approach works with two instances each of SimpleHistogramDataset and XYItemRenderer.
-
- Posts: 513
- Joined: Wed Sep 12, 2007 3:18 pm
Re: Superimpose 2 block chart
This is how HistogramDemo1.java looks: