Class AxisLabelProcessor

java.lang.Object
org.jzy3d.plot3d.primitives.axis.AxisLabelProcessor

public class AxisLabelProcessor extends Object
A helper class to process axis labels.
Author:
martin
  • Field Details

  • Constructor Details

    • AxisLabelProcessor

      public AxisLabelProcessor(AxisBox axis)
  • Method Details

    • drawAxisLabel

      protected void drawAxisLabel(IPainter painter, int direction, Color color, BoundingBox3d ticksTxtBounds, Coord3d position, String label, float rotation, Coord2d offset)
    • getAxisLabelTextAlign

      protected TextAlign getAxisLabelTextAlign(int direction)
      Return an axis label alignment suitable for the type of chart : 3D, 2D XY, 2D XZ, 2D YZ
    • axisLabelOffsetVertical

      protected Coord2d axisLabelOffsetVertical(IPainter painter, AxisRenderingInfo info, Coord3d labelPosition, int margin)
      Computes the offset to apply to a vertical Z label to avoid covering the tick labels in the case of a 3D chart. Retrieves pixel scale in view to adapt margin.
      Parameters:
      painter -
      info -
      labelPosition -
      margin -
      offset2D -
    • axisLabelOffset

      protected Coord2d axisLabelOffset(IPainter painter, AxisRenderingInfo info, Coord3d labelPosition, int margin)
      Offset for oblique labels.
      Parameters:
      painter -
      info -
      labelPosition -
      margin -
      Returns:
    • axisLabelRotation

      protected float axisLabelRotation(IPainter painter, int direction, Coord3d[] axisSegment)
      Compute axis label rotation according to settings and direction of the axis segment.
    • axisLabel

      protected String axisLabel(int dimension)
      Return the axis label for the given direction.
    • axisLabelPosition

      protected Coord3d axisLabelPosition(int direction, float tickLength, Coord3d pos, Coord3d dir)
      Compute the axis label position according to the tick position (on the axis segment) and a direction for the tick. This is quite intricated with View.computeCamera3D_RenderingSphere(Camera, ViewportConfiguration, BoundingBox3d) and View.computeCamera2D_RenderingSquare(Camera, ViewportConfiguration, BoundingBox3d) which will perform the actual camera configuration to ensure enough white space around the scene to draw the axis and tick labels
    • axisLabelPosition_2D

      protected Coord3d axisLabelPosition_2D(int direction, Coord3d pos)
      2D case : processed in 2D according to pixel margins, font size, and a pixel to world dimension ratio returned by the view
    • axisLabelPosition_3D

      protected Coord3d axisLabelPosition_3D(int direction, float tickLength, Coord3d pos, Coord3d dir)
      3D case : process a shift from the center of the axis to annotate based on the tick length (hence distance between tick text and axis) and a distance factor of the axis label w.r.t. the tick length