Axis.coord constructor

Axis.coord(
  1. int npoints,
  2. double ixFirst,
  3. double ixLast,
  4. double physStart,
  5. double physWidth,
  6. bool center,
  7. double calib,
  8. int axisLength,
  9. int axisAreaWidth,
  10. int gridLength,
  11. PhysicalToScreen physToScreen,
  12. Map<AxA, String> axesAttributes,
  13. List<TouchCallback> touchCallbacks
)

Creates a coordinate axis for data represented by an array. The axis consists of the following axis elements: axis ticks, axis labels, axis legend and grid lines. No straight line representing the axis itself is drawn. This is very simple and is left to the caller for flexibility reasons.

npoints is array.length for a 1D array or for the horizontal axis of a 2D array. It is array0.length for the second (vertical) coordinate axis of a 2D array. ixFirst and ixLast: Only axis elements inside in this array index range will be drawn. In order to synchronize axis display with array data display, e.g. with Polyline of this package, the same indices must be chosen for data display AND for axis display. The same applies to npoints.

physStart is the "physical unit" of the first array element, for example seconds or Hertz or whatever.

physWidth is the width of the entire array in "physical" units. The axis labels are displayed in physical units.

center if false: a computed unit value corresponds exactly to a data index (e.g. ixFirst). If true: corresponds to the mean valu between to subsequent indices (e.g. ixFirst, ixFirst + 1). Either choice can be convenient, depending on the application.

calib is an optional axis calibration factor. If not null, both physStart and physWidth are multiplied with calib.

axisLength The axis will get this length in pixels.

axisAreaWidth The axis area will get this width in pixels. It must be chosen so as to give enough room to draw the tick marks, the axis text labels and the axis legend text.

gridLength The length in pixels of the grid lines. See AxA.POSITION on how to enable a grid.

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

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". You will have to add this container to your desired SVG container for your desired layout, and you must set the SVG "x" and "y" coordinates of labelsContainer relative to its parent SVG container (SvgSvgElement). If AxA.POSITION contains "t": the drawing sequence into labelsContainer is legendText - labels - ticks. If position contains "b": the drawing sequence into labelsContainer is ticks - labels - legendText. If AxA.POSITION contains "x2": The coodinate axis is a drawn vertically, to be used as the 2nd coodinate axis for 2D plots.

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 SVG container for your desired layout, and you must set the SVG "x" and "y" coordinates of gridContainer relative to its parent container (SvgSvgElement).

Implementation

Axis.coord(
    int npoints,
    final double ixFirst,
    final double ixLast,
    double physStart,
    double physWidth,
    bool center,
    double calib,
    final int axisLength,
    final int axisAreaWidth,
    final int gridLength,
    PhysicalToScreen physToScreen,
    Map<AxA, String> axesAttributes,
    List<TouchCallback> touchCallbacks)
    : this(
          npoints,
          ixFirst,
          ixLast,
          physStart,
          physWidth,
          center,
          calib,
          null,
          //_coordShift,
          axisLength,
          axisAreaWidth,
          gridLength,
          physToScreen,
          axesAttributes,
          touchCallbacks);