Axis.intens constructor

Axis.intens(double start, double end, double refval, double refvalNormalized, double coordShift, int axisLength, int axisAreaWidth, int gridLength, PhysicalToScreen physToScreen, Map<AxA, String> axesAttributes, List<TouchCallback> touchCallbacks)

Creates a vertical intensity axis. See the other constructors for a horizontal or vertical coordinate axis. start, end: Only those axis ticks, text labels, and grid lines lying in this y intensity range will be drawn.

refval and refvalNormalized: allow for rescaling the axis label values: Recomputes (rescales) the axis such that refval will obtain the value refvalNormalized. Both refvals must not be zero! Set any of the refvals to null if no rescaling should be applied. Rescaling allows apps e.g. to ask a user for a special scaling per GUI.

coordShift = first + last. This is the coordinate transformation needed to reverse the axis direction. If position contains a '-' sign AND coordShift is not null, the axis get reversed and the axis zero point get adjusted accordingly.

axisLength the axis will get this length in pixels.

axisAreaWidth: the axis area will get this width in pixels. There must be enough room to draw the horizontal tick marks, the axis text labels and the axis legend text.

gridLength the length in pixels of the horizontal grid lines. See position on how to enable a horizontal grid.

legendText the text drawn along the axis, for example the physical units.

position A String with possibly several characters.

  1. If containing a "b", the tick marks, axis labels and the legend are drawn left of the axis. Needed if you want to position the axis left of the data area. If containing a "t", the tick marks, axis labels and the legend are drawn right of the axis. Needed if you want to position the axis right of the data area.
  2. If containing a "g", horizontal grid lines at the y-positions of the tick marks will be drawn, with a length of gridLength pixels.
  3. If containing a "-" (minus sign), the axis direction is reversed. The smallest axis values are then at the top, the biggest ones at the bottom. You MUST specify coordShift for this case.

physToScreen Specify here a method that converts an axis coordinate to a screen coordinate. Note: In order to synchronize axis display with array data display, e.g. with Polyline of this package, this method must be the same used for array data display! This method depends on the your particular application layout in the browser page.

axesAttributes If null, AXIS_DEFAULT_ATTRIBUTES are used. Otherwise you can define here colors, fonts and more. The attributes specified here override the respective defaults. See AxA for all options.

touchCallbacks If not null, at least 2 functions must be specified in the list. touchCallbacks0 will be called on a touch start event, touchCallbacks1 will be called on a touch move event.

NOTE 1: The axis will be drawn into the SVG container labelsContainer of this class using the parameters specified for the constructor. You will have to add this container to your desired container for your desired layout, and you must set the SVG "x" and "y" coordinates of labelsContainer relative to its parent container.

NOTE 2: The grid, if enabled, will be drawn into the SVG container xyGrid.gridContainer. You will have to add this container to your desired container for your desired layout, and you must set the SVG "x" and "y" coordinates of gridContainer relative to its parent container.

Implementation

Axis.intens(
    final double start,
    final double end,
    double refval,
    double refvalNormalized,
    double coordShift,
    final int axisLength,
    final int axisAreaWidth,
    final int gridLength,
    PhysicalToScreen physToScreen,
    Map<AxA, String> axesAttributes,
    List<TouchCallback> touchCallbacks)
    : this(
          null,
          start,
          end,
          refval,
          refvalNormalized,
          null,
          null,
          false,
          coordShift,
          axisLength,
          axisAreaWidth,
          gridLength,
          physToScreen, () {
        axesAttributes[AxA.POSITION] += "y"; // convert axis to vertical
        return axesAttributes;
      }(), touchCallbacks);