grafica
Class GHistogram

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

public class GHistogram
extends Object
implements PConstants

Histogram 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
GHistogram(PApplet parent, int type, float[] dim, GPointsArray plotPoints)
          Constructor
 
Method Summary
 void addPlotPoint(GPoint newPlotPoint)
          Adds a new plot point to the histogram
 void addPlotPoint(int index, GPoint newPlotPoint)
          Adds a new plot point to the histogram
 void addPlotPoints(GPointsArray newPlotPoints)
          Adds a new plot points to the histogram
 void draw(GPoint plotBasePoint)
          Draws the histogram
 void removePlotPoint(int index)
          Removes one of the points from the histogram
 void setBgColors(int[] newBgColors)
          Sets the background colors of the histogram elements
 void setDim(float[] newDim)
          Sets the plot box dimensions information
 void setDim(float xDim, float yDim)
          Sets the plot box dimensions information
 void setDrawLabels(boolean newDrawLabels)
          Sets if the histogram labels should be drawn 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 setLabelsOffset(float newLabelsOffset)
          Sets the histogram labels offset
 void setLineColors(int[] newLineColors)
          Sets the line colors of the histogram elements
 void setLineWidths(float[] newLineWidths)
          Sets the line widths of the histogram elements
 void setPlotPoint(int index, GPoint newPlotPoint)
          Sets one of the histogram plot points
 void setPlotPoints(GPointsArray newPlotPoints)
          Sets the histogram plot points
 void setRotateLabels(boolean newRotateLabels)
          Sets if the histogram labels should be rotated or not
 void setSeparations(float[] newSeparations)
          Sets the separations between the histogram elements
 void setType(int newType)
          Sets the type of histogram to display
 void setVisible(boolean newVisible)
          Sets if the histogram should be visible or not
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GHistogram

public GHistogram(PApplet parent,
                  int type,
                  float[] dim,
                  GPointsArray plotPoints)
Constructor

Parameters:
parent - the parent Processing applet
type - the histogram type. It can be GPlot.VERTICAL or GPlot.HORIZONTAL
dim - the plot box dimensions in pixels
plotPoints - the points positions in the plot reference system
Method Detail

draw

public void draw(GPoint plotBasePoint)
Draws the histogram

Parameters:
plotBasePoint - the histogram base point in the plot reference system

setType

public void setType(int newType)
Sets the type of histogram to display

Parameters:
newType - the new type of histogram to display

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

setPlotPoints

public void setPlotPoints(GPointsArray newPlotPoints)
Sets the histogram plot points

Parameters:
newPlotPoints - the new point positions in the plot reference system

setPlotPoint

public void setPlotPoint(int index,
                         GPoint newPlotPoint)
Sets one of the histogram plot points

Parameters:
index - the point position
newPlotPoint - the new point positions in the plot reference system

addPlotPoint

public void addPlotPoint(GPoint newPlotPoint)
Adds a new plot point to the histogram

Parameters:
newPlotPoint - the new point position in the plot reference system

addPlotPoint

public void addPlotPoint(int index,
                         GPoint newPlotPoint)
Adds a new plot point to the histogram

Parameters:
index - the position to add the point
newPlotPoint - the new point position in the plot reference system

addPlotPoints

public void addPlotPoints(GPointsArray newPlotPoints)
Adds a new plot points to the histogram

Parameters:
newPlotPoints - the new points positions in the plot reference system

removePlotPoint

public void removePlotPoint(int index)
Removes one of the points from the histogram

Parameters:
index - the point position

setSeparations

public void setSeparations(float[] newSeparations)
Sets the separations between the histogram elements

Parameters:
newSeparations - the new separations between the histogram elements

setBgColors

public void setBgColors(int[] newBgColors)
Sets the background colors of the histogram elements

Parameters:
newBgColors - the new background colors of the histogram elements

setLineColors

public void setLineColors(int[] newLineColors)
Sets the line colors of the histogram elements

Parameters:
newLineColors - the new line colors of the histogram elements

setLineWidths

public void setLineWidths(float[] newLineWidths)
Sets the line widths of the histogram elements

Parameters:
newLineWidths - the new line widths of the histogram elements

setVisible

public void setVisible(boolean newVisible)
Sets if the histogram should be visible or not

Parameters:
newVisible - true if the histogram should be visible

setLabelsOffset

public void setLabelsOffset(float newLabelsOffset)
Sets the histogram labels offset

Parameters:
newLabelsOffset - the new histogram labels offset

setDrawLabels

public void setDrawLabels(boolean newDrawLabels)
Sets if the histogram labels should be drawn or not

Parameters:
newDrawLabels - true if the histogram labels should be drawn

setRotateLabels

public void setRotateLabels(boolean newRotateLabels)
Sets if the histogram labels should be rotated or not

Parameters:
newRotateLabels - true if the histogram labels should be rotated

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


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