Transparency

With transparency, you can make chart elements such as background pictures and gradients that apply to the entire chart completely invisible in the chart area. Also note that this setting can be applied to any chart element that receives a color. For example, if you have a scatter chart and you want to hide certain points, you can use the Point property and assign a transparent color to only certain points in the chart.

Essentially, transparency is achieved by setting the 4th parameter in the Color constructor as follows:


chart1.setInsideColor(java.awt.Color(0,0,0,0));

Note: Setting the BackColor property to transparent is only supported when generating PNG images using the Chart FX for Java.

Semi-Transparency

In Chart FX for Java, the alpha blending feature is used to display a chart element that has semi-transparent pixels. In addition to a red, green and blue color channel, each pixel in an alpha bitmap has a transparency component known as its alpha channel. The alpha channel typically contains as many bits as a color channel. For example, an 8-bit alpha channel can represent 256 levels of transparency, from 0 (the entire pixel is transparent) to 255 (the entire pixel is opaque). For example, if you want to make the third series of your chart a semi-transparent green, you will use the code as follows:


chart1.getSeries(2).setColor(java.awt.Color.(120,0,255,50));

Changing the transparency of an object evenly reveals the image elements that lie beneath the object and because semi-transparency can be applied to any chart element that supports a color, you can create a myriad of effects. For example, in a 3D oblique chart, you can make the first series semi-transparent so other series are revealed in the 3D view or you can use the Point object to have particular marker(s) display semi-transparency. Similarly, you can make the chart background semi-transparent so a background image is blended into the chart, create a nice watermark effect.