In most situations, gradients are commonly used to achieve
a cosmetic fill effect on a particular shape. However, when
used in chart markers, Chart FX for Java gradients serve a
different purpose as they allow the user to immediately recognize
data trends and help the user recognize important data in the
chart.

To illustrate, the chart displayed uses
a gradient fill that allows the user to immediately
recognize markers that fall within a range with just a
quick glance at the chart.
To achieve this effect, you must set a special color
scheme that activates the markers' gradient fill. Then,
Chart FX for Java defines a virtual rectangle that starts
at the top of the chart (defined by the Y-axis Max)
and uses the marker color as a starting point (top)
and an alternate color to blend uniformly to the bottom
(X-axis).
The code that creates the gradient shown above looks as follows:
chart1.setScheme(Scheme.GRADIENT);
SeriesAttributes series = chart1.getSeries(0); series.setColor(java.awt.Color.yellow); series.setAlternateColor(java.awt.Color.green);
|
It is important to note marker gradients are used for data
analysis purposes in Chart FX. Therefore, marker gradients
accept only two colors and are limited to a vertical effect.
Finally, please remember the Y-axis Maximum will significantly
affect the virtual rectangle on which the gradient is going
to be painted. For example, in the chart shown above if the
Y-axis Maximum is changed from 100 to 200, all chart markers
will have an intensity close to the alternate color (green)
as they will be farther away from the top of the chart where
the marker color (yellow) is used.
|