Module xaos.ui.plot

Class SeriesColorUtils


  • public class SeriesColorUtils
    extends Object
    Utility methods to set XYChart.Series's color.
    Author:
    claudio.rosati@esss.se
    • Field Detail

      • HORIZONTAL

        public static final Color HORIZONTAL
      • LONGITUDINAL

        public static final Color LONGITUDINAL
      • VERTICAL

        public static final Color VERTICAL
      • COLORS

        public static final Color[] COLORS
    • Method Detail

      • styleFor

        public static String styleFor​(Color color,
                                      int index)
        Returns the style to be applied for a given Color to a XYChart.Series.

        The returned style is obtained changing the CHART_COLOR_i, CHART_COLOR_i_TRANS_20 and CHART_COLOR_i_TRANS_70 standard JavaFX chart colors (where i is a number in the 1..8 range) to the given color.

        Parameters:
        color - The Color for which CSS style string appropriate for a chart XYChart.Series should be created.
        index - The index of the XYChart.Series in the chart. The ( index % 8 ) + 1 value will be used to decide which of the 8 standard chart colors will be overridden in the returned style string.
        Returns:
        A style string overriding one of the default JavaFx 8 chart colors with the given one.
        Throws:
        NullPointerException - If color is null.
        IllegalArgumentException - If (@code index} is negative.
      • styles

        public static String styles()
        Returns:
        The default styles string for a chart.
      • styles

        public static String styles​(int horizontal,
                                    int vertical,
                                    int longitudinal)
        Return the styles string to be applied to a chart.

        As in JavaFX 8 colors will be used. If the given indexes are non-negative, then special colors will be used to represent horizontal (red), vertical (blue) and longitudinal (green) series.

        Parameters:
        horizontal - The index of the horizontal series. If non-negative red will be used for the series.
        vertical - The index of the vertical series. If non-negative blue will be used for the series.
        longitudinal - The index of the longitudinal series. If non-negative red will be used for the series.
        Returns:
        The styles string to be applied to a chart.