org.faceless.graph
Class BarGraph

java.lang.Object
  extended by org.faceless.graph.Graph
      extended by org.faceless.graph.AxesGraph
          extended by org.faceless.graph.AbstractBarGraph
              extended by org.faceless.graph.BarGraph

public class BarGraph
extends AbstractBarGraph

A concrete subclass of AbstractBarGraph that handles the simplest type of Bar Graph - a single row of bars, running across the X axis.

By Default, the BarGraph turns off the external key by calling optionDisplayKey(Graph.KEY_NONE). This is because all the information required is displayed on the axes of the Graph.

Here's an example showing a simple BarGraph.

    import org.faceless.graph.output.ImageOutput;
    import java.awt.Color;

    // Create a new Bar Graph, and set some options.
    //
    BarGraph g = new BarGraph();
    optionTitle("My First Bar Graph");
    optionXAxisLabel("Type of Fruit");
    optionYAxisLabel("Quantity Eaten");

    // Add some bars to the graph. Compare something
    // other than apples and oranges for a change.
    //
    g.set("Pomegranites", 20);
    g.set("Soursops", 15);
    g.set("Fejoas", 8);
    g.set("Kumquats", 9.5);
    g.set("Kiwaglis", 11.7);
    g.set("Tamarillos", 28);
    g.set("Mangosteens", 28);

    // Render to an image that's 400x400
    //
    ImageOutput out = new ImageOutput(400,400);
    out.render(g);
 


Field Summary
 
Fields inherited from class org.faceless.graph.AbstractBarGraph
DISPLAYVALUE_INSIDETOP, DISPLAYVALUE_MIDDLE, DISPLAYVALUE_NONE, DISPLAYVALUE_TOP
 
Fields inherited from class org.faceless.graph.Graph
KEY_BOXED_BOTTOM, KEY_BOXED_LEFT, KEY_BOXED_RIGHT, KEY_BOXED_TOP, KEY_NONE
 
Constructor Summary
BarGraph()
           
 
Method Summary
 void set(String set, double val)
           Set the value of the specified entry
 void setColor(String set, Paint color)
          Set the color of an entry
 
Methods inherited from class org.faceless.graph.AbstractBarGraph
optionBarDepth, optionBarWidth, optionDisplayValue, optionRoundBars, optionXStretchToZero, optionYStretchToZero
 
Methods inherited from class org.faceless.graph.AxesGraph
optionAxisStyle, optionBoxColor, optionFloorStyle, optionMaxY, optionMinY, optionXAxisAtZero, optionXAxisLabel, optionXAxisLabelStyle, optionXAxisStyle, optionXAxisTextRotation, optionXFormatter, optionYAxisAtZero, optionYAxisLabel, optionYAxisLabelStyle, optionYAxisStyle, optionYAxisTextRotation, optionYFormatter, optionYWallStyle, optionZAxisStyle, optionZFormatter, optionZWallStyle
 
Methods inherited from class org.faceless.graph.Graph
getDefaultBorderColor, getFontScale, optionDisplayKey, optionFixedAspectRatio, optionKeyBoxStyle, optionKeyStyle, optionSubTitle, optionSubTitleStyle, optionTitle, optionTitleStyle, optionXRotation, optionYRotation, optionZRotation, setDefaultBorderColor, setDefaultColors, setDefaultLineThickness, setFontScale, setLicenseKey, setLightLevel, setLightVector, setPieEdgeDegrees, toCanvas
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BarGraph

public BarGraph()
Method Detail

setColor

public void setColor(String set,
                     Paint color)
Set the color of an entry


set

public void set(String set,
                double val)

Set the value of the specified entry

Parameters:
set - the entry on the X-axis to plot the value against
val - the value to plot
Throws:
IllegalArgumentException - if paramater val is infinite.


Copyright © 2001-2012 Big Faceless Organization