Class ColorGradientAxis

  • All Implemented Interfaces:
    Axis, de.gsi.dataset.AxisDescription, de.gsi.dataset.event.EventSource, javafx.css.Styleable, javafx.event.EventTarget

    public class ColorGradientAxis
    extends DefaultNumericAxis
    An Axis with a color gradient e.g. for use with HeatMap plots. By default this axis is excluded from the Zoomer Plugin. TODO: - Fix LEFT, CENTER_HOR/VERT - Reduce Boilerplate Code - Allow free Positioning? e.g legend style, outside of chart, ...
    Author:
    Alexander Krimm
    • Field Detail

      • gradientRect

        protected final javafx.scene.shape.Rectangle gradientRect
    • Constructor Detail

      • ColorGradientAxis

        public ColorGradientAxis​(double lowerBound,
                                 double upperBound,
                                 double tickUnit)
        Parameters:
        lowerBound - the mininum axis value
        upperBound - the maximum axis value
        tickUnit - the default user-defined tick-unit
      • ColorGradientAxis

        public ColorGradientAxis​(double lowerBound,
                                 double upperBound,
                                 double tickUnit,
                                 ColorGradient colorGradient)
      • ColorGradientAxis

        public ColorGradientAxis​(java.lang.String axisLabel)
        Parameters:
        axisLabel - axis title
      • ColorGradientAxis

        public ColorGradientAxis​(java.lang.String axisLabel,
                                 ColorGradient colorGradient)
      • ColorGradientAxis

        public ColorGradientAxis​(java.lang.String axisLabel,
                                 double lowerBound,
                                 double upperBound,
                                 double tickUnit)
        Parameters:
        axisLabel - the axis title
        lowerBound - the minimum axis range
        upperBound - the maximum axis range
        tickUnit - the user-defined tick-unit
      • ColorGradientAxis

        public ColorGradientAxis​(java.lang.String axisLabel,
                                 double lowerBound,
                                 double upperBound,
                                 double tickUnit,
                                 ColorGradient colorGradient)
      • ColorGradientAxis

        public ColorGradientAxis​(java.lang.String axisLabel,
                                 java.lang.String unit)
        Parameters:
        axisLabel - the axis title
        unit - the unit label, e.g. 'm' or 's' please use SI-style units
      • ColorGradientAxis

        public ColorGradientAxis​(java.lang.String axisLabel,
                                 java.lang.String unit,
                                 ColorGradient colorGradient)
    • Method Detail

      • colorGradientProperty

        public javafx.beans.property.ObjectProperty<ColorGradient> colorGradientProperty()
        Color gradient (linear) used to encode data point values.
        Returns:
        gradient property
      • computePrefHeight

        protected double computePrefHeight​(double width)
        Description copied from class: AbstractAxis
        Computes the preferred height of this axis for the given width. If axis orientation is horizontal, it takes into account the tick mark length, tick label gap and label height.
        Overrides:
        computePrefHeight in class AbstractAxis
        Returns:
        the computed preferred width for this axis
      • computePrefWidth

        protected double computePrefWidth​(double height)
        Description copied from class: AbstractAxis
        Computes the preferred width of this axis for the given height. If axis orientation is vertical, it takes into account the tick mark length, tick label gap and label height.
        Overrides:
        computePrefWidth in class AbstractAxis
        Returns:
        the computed preferred width for this axis
      • drawAxis

        public void drawAxis​(javafx.scene.canvas.GraphicsContext gc,
                             double axisWidth,
                             double axisHeight)
        Description copied from interface: Axis
        Function allows custom drawing of axes outside the Axis environment (ie. on another canvas)
        Specified by:
        drawAxis in interface Axis
        Overrides:
        drawAxis in class AbstractAxis
        Parameters:
        gc - the graphic context on which the axis is to be drawn
        axisWidth - the axis width in pixel (N.B. padding is being added)
        axisHeight - the axis height in pixel (N.B. padding is being added)
      • drawAxisLine

        protected void drawAxisLine​(javafx.scene.canvas.GraphicsContext gc,
                                    double axisLength,
                                    double axisWidth,
                                    double axisHeight)
        Overrides:
        drawAxisLine in class AbstractAxis
      • getColor

        public javafx.scene.paint.Color getColor​(double value)
        Parameters:
        value - z-Value, values outside of the visible limit are clamped to the extrema
        Returns:
        the color representing the input value on the z-Axis
      • getGradientWidth

        public double getGradientWidth()
      • getIntColor

        public int getIntColor​(double value)
        Return the color for a value as an integer with the color values in its bytes. For use e.g. with an IntBuffer backed PixelBuffer.
        Parameters:
        value - z-Value
        Returns:
        integer with one byte each set to alpha, red, green, blue
      • gradientWidthProperty

        public javafx.beans.property.DoubleProperty gradientWidthProperty()
      • setGradientWidth

        public void setGradientWidth​(double newGradientWidth)