grafica
Class GAxis

java.lang.Object
  extended by grafica.GAxis
All Implemented Interfaces:
PConstants

public class GAxis
extends Object
implements PConstants

Axis class.

Author:
Javier Gracia Carpio http://www.openprocessing.org/user/16300

Field Summary
 
Fields inherited from interface processing.core.PConstants
ADD, ALPHA, ALT, AMBIENT, ARC, ARGB, ARROW, BACKSPACE, BASELINE, BEVEL, BEZIER_VERTEX, BLEND, BLUR, BOTTOM, BOX, BREAK, BURN, CENTER, CHATTER, CHORD, CLAMP, CLOSE, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CURVE_VERTEX, CUSTOM, DARKEST, DEG_TO_RAD, DELETE, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_DEPTH_MASK, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_NATIVE_FONTS, DISABLE_OPENGL_ERRORS, DISABLE_OPTIMIZED_STROKE, DISABLE_RETINA_PIXELS, DISABLE_STROKE_PERSPECTIVE, DISABLE_STROKE_PURE, DISABLE_TEXTURE_MIPMAPS, DODGE, DOWN, DXF, ELLIPSE, ENABLE_DEPTH_MASK, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_ERRORS, ENABLE_OPTIMIZED_STROKE, ENABLE_RETINA_PIXELS, ENABLE_STROKE_PERSPECTIVE, ENABLE_STROKE_PURE, ENABLE_TEXTURE_MIPMAPS, ENTER, EPSILON, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, GIF, GRAY, GROUP, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LANDSCAPE, LEFT, LIGHTEST, LINE, LINE_LOOP, LINE_STRIP, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MODELVIEW, MOVE, MULTIPLY, NORMAL, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, PIE, platformNames, POINT, POINTS, POLYGON, PORTRAIT, POSTERIZE, PROBLEM, PROJECT, PROJECTION, QUAD, QUAD_BEZIER_VERTEX, QUAD_STRIP, QUADRATIC_VERTEX, QUADS, QUARTER_PI, RAD_TO_DEG, RADIUS, RECT, REPEAT, REPLACE, RETURN, RGB, RIGHT, ROUND, SCREEN, SHAPE, SHIFT, SOFT_LIGHT, SPHERE, SPOT, SQUARE, SUBTRACT, TAB, TARGA, TAU, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, UP, VERTEX, WAIT, WHITESPACE, WINDOWS, X, Y, Z
 
Constructor Summary
GAxis(PApplet parent, int type, float[] dim, float[] lim, boolean log)
          GAxis constructor
 
Method Summary
 void draw()
          Draws the axis
 GAxisLabel getAxisLabel()
          Returns the axis label
 float[] getPlotTicks()
          Returns a copy of the axis ticks positions in the plot reference system
 ArrayList<Float> getPlotTicksRef()
          Returns the axis ticks positions in the plot reference system
 float[] getTicks()
          Returns a copy of the axis ticks
 ArrayList<Float> getTicksRef()
          Returns the axis ticks
 void moveLim(float[] newLim)
          Moves the axis limits
 void setAllFontProperties(String newFontName, int newFontColor, int newFontSize)
          Sets the font properties in the axis and the axis label
 void setAxisLabelText(String text)
          Sets the axis label text
 void setDim(float[] newDim)
          Sets the plot box dimensions information
 void setDim(float xDim, float yDim)
          Sets the plot box dimensions information
 void setDrawAxisLabel(boolean newDrawAxisLabel)
          Sets if the axis label should be drawn or not
 void setDrawTickLabels(boolean newDrawTicksLabels)
          Sets if the ticks labels should be drawn or not
 void setExpTickLabels(boolean newExpTickLabels)
          Sets if the ticks labels should be displayed in exponential form or not
 void setFixedTicks(boolean newFixedTicks)
          Sets if the axis ticks are fixed or not
 void setFontColor(int newFontColor)
          Sets the font color
 void setFontName(String newFontName)
          Sets the font name
 void setFontProperties(String newFontName, int newFontColor, int newFontSize)
          Sets all the font properties at once
 void setFontSize(int newFontSize)
          Sets the font size
 void setLim(float[] newLim)
          Sets the axis limits
 void setLimAndLog(float[] newLim, boolean newLog)
          Sets the axis limits and the axis scale
 void setLineColor(int newLineColor)
          Sets the line color
 void setLineWidth(float newLineWidth)
          Sets the line width
 void setLog(boolean newLog)
          Sets the axis scale
 void setNTicks(int newNTicks)
          Sets the approximate number of ticks in the axis.
 void setOffset(float newOffset)
          Sets the axis offset with respect to the plot box
 void setRotateTickLabels(boolean newRotateTickLabels)
          Sets if the ticks labels should be displayed rotated or not
 void setSmallTickLength(float newSmallTickLength)
          Sets the small tick length
 void setTickLabelOffset(float newTickLabelOffset)
          Sets the tick label offset
 void setTickLabels(String[] newTickLabels)
          Sets the axis ticks labels
 void setTickLength(float newTickLength)
          Sets the tick length
 void setTicks(float[] newTicks)
          Sets the axis ticks
 void setTicksSeparation(float newTicksSeparation)
          Sets the separation between the ticks in the axis
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GAxis

public GAxis(PApplet parent,
             int type,
             float[] dim,
             float[] lim,
             boolean log)
GAxis constructor

Parameters:
parent - the parent Processing applet
type - the axis type. It can be X, Y, TOP or RIGHT
dim - the plot box dimensions in pixels
lim - the limits
log - the axis scale. True if it's logarithmic
Method Detail

moveLim

public void moveLim(float[] newLim)
Moves the axis limits

Parameters:
newLim - the new axis limits

draw

public void draw()
Draws the axis


setDim

public void setDim(float xDim,
                   float yDim)
Sets the plot box dimensions information

Parameters:
xDim - the new plot box x dimension
yDim - the new plot box y dimension

setDim

public void setDim(float[] newDim)
Sets the plot box dimensions information

Parameters:
newDim - the new plot box dimensions information

setLim

public void setLim(float[] newLim)
Sets the axis limits

Parameters:
newLim - the new axis limits

setLimAndLog

public void setLimAndLog(float[] newLim,
                         boolean newLog)
Sets the axis limits and the axis scale

Parameters:
newLim - the new axis limits
newLog - the new axis scale

setLog

public void setLog(boolean newLog)
Sets the axis scale

Parameters:
newLog - the new axis scale

setOffset

public void setOffset(float newOffset)
Sets the axis offset with respect to the plot box

Parameters:
newOffset - the new axis offset

setLineColor

public void setLineColor(int newLineColor)
Sets the line color

Parameters:
newLineColor - the new line color

setLineWidth

public void setLineWidth(float newLineWidth)
Sets the line width

Parameters:
newLineWidth - the new line width

setNTicks

public void setNTicks(int newNTicks)
Sets the approximate number of ticks in the axis. The actual number of ticks depends on the axis limits and the axis scale

Parameters:
newNTicks - the new approximate number of ticks in the axis

setTicksSeparation

public void setTicksSeparation(float newTicksSeparation)
Sets the separation between the ticks in the axis

Parameters:
newTicksSeparation - the new ticks separation

setTicks

public void setTicks(float[] newTicks)
Sets the axis ticks

Parameters:
newTicks - the new axis ticks

setTickLabels

public void setTickLabels(String[] newTickLabels)
Sets the axis ticks labels

Parameters:
newTickLabels - the new axis ticks labels

setFixedTicks

public void setFixedTicks(boolean newFixedTicks)
Sets if the axis ticks are fixed or not

Parameters:
newFixedTicks - true if the axis ticks should be fixed

setTickLength

public void setTickLength(float newTickLength)
Sets the tick length

Parameters:
newTickLength - the new tick length

setSmallTickLength

public void setSmallTickLength(float newSmallTickLength)
Sets the small tick length

Parameters:
newSmallTickLength - the new small tick length

setExpTickLabels

public void setExpTickLabels(boolean newExpTickLabels)
Sets if the ticks labels should be displayed in exponential form or not

Parameters:
newExpTickLabels - true if the ticks labels should be in exponential form

setRotateTickLabels

public void setRotateTickLabels(boolean newRotateTickLabels)
Sets if the ticks labels should be displayed rotated or not

Parameters:
newRotateTickLabels - true is the ticks labels should be rotated

setDrawTickLabels

public void setDrawTickLabels(boolean newDrawTicksLabels)
Sets if the ticks labels should be drawn or not

Parameters:
newDrawTicksLabels - true it the ticks labels should be drawn

setTickLabelOffset

public void setTickLabelOffset(float newTickLabelOffset)
Sets the tick label offset

Parameters:
newTickLabelOffset - the new tick label offset

setDrawAxisLabel

public void setDrawAxisLabel(boolean newDrawAxisLabel)
Sets if the axis label should be drawn or not

Parameters:
newDrawAxisLabel - true if the axis label should be drawn

setAxisLabelText

public void setAxisLabelText(String text)
Sets the axis label text

Parameters:
text - the new axis label text

setFontName

public void setFontName(String newFontName)
Sets the font name

Parameters:
newFontName - the name of the new font

setFontColor

public void setFontColor(int newFontColor)
Sets the font color

Parameters:
newFontColor - the new font color

setFontSize

public void setFontSize(int newFontSize)
Sets the font size

Parameters:
newFontSize - the new font size

setFontProperties

public void setFontProperties(String newFontName,
                              int newFontColor,
                              int newFontSize)
Sets all the font properties at once

Parameters:
newFontName - the name of the new font
newFontColor - the new font color
newFontSize - the new font size

setAllFontProperties

public void setAllFontProperties(String newFontName,
                                 int newFontColor,
                                 int newFontSize)
Sets the font properties in the axis and the axis label

Parameters:
newFontName - the new font name
newFontColor - the new font color
newFontSize - the new font size

getTicks

public float[] getTicks()
Returns a copy of the axis ticks

Returns:
a copy of the axis ticks

getTicksRef

public ArrayList<Float> getTicksRef()
Returns the axis ticks

Returns:
the axis ticks

getPlotTicks

public float[] getPlotTicks()
Returns a copy of the axis ticks positions in the plot reference system

Returns:
a copy of the axis ticks positions in the plot reference system

getPlotTicksRef

public ArrayList<Float> getPlotTicksRef()
Returns the axis ticks positions in the plot reference system

Returns:
the axis ticks positions in the plot reference system

getAxisLabel

public GAxisLabel getAxisLabel()
Returns the axis label

Returns:
the axis label


Processing library grafica by Javier Gracia Carpio. (c) 2013