org.faceless.graph
Class AreaGraph

java.lang.Object
  extended by org.faceless.graph.Graph
      extended by org.faceless.graph.AxesGraph
          extended by org.faceless.graph.AbstractLineGraph
              extended by org.faceless.graph.AreaGraph

public class AreaGraph
extends AbstractLineGraph

Plot a Line graph that has the area below the line filled in. Usually used to show individual components of a curve - for example, if you were graphing Overall Fruit Consumption over time, you could use an AreaGraph to break this down into different types of fruit. Because the area below the line is filled in, this type of graph is generally only used to show cumulative data.

Here's a contrived example, which if nothing else shows how AreaGraphs are used to show accumulation. The values in the curves will be totalled automatically (unless we had set the Cumulative option

    import org.faceless.graph.*;
    import org.faceless.graph.math.*;

    // Create a "curve", showing the numbers from 1 to 5
    //
    DataCurve c = new DataCurve();
    c.set(1,1);
    c.set(2,2);
    c.set(3,3);
    c.set(4,4);
    c.set(5,5);

    AreaGraph g = new AreaGraph();
    g.addCurve("First Number", c);
    g.addCurve("Second Number", c);     // use the same curve twice

    g.optionTitle("Shows the sum of two numbers");

    ImageOutput out = new ImageOutput(400,400, g);
    out.render(g);
 


Field Summary
 
Fields inherited from class org.faceless.graph.Graph
KEY_BOXED_BOTTOM, KEY_BOXED_LEFT, KEY_BOXED_RIGHT, KEY_BOXED_TOP, KEY_NONE
 
Constructor Summary
AreaGraph()
           
 
Method Summary
 void optionCumulative(boolean val)
          If this is set to true, the AreaGraph adds the values of the separate curves together to form a total.
 void optionSegments(boolean val)
          Whether to draw the Area Graph with segments, so that points defined in the data can easily be recognised.
 
Methods inherited from class org.faceless.graph.AbstractLineGraph
optionCurveDepth, optionFunctionSmoothness, optionMaxDataPoints, optionMaxX, optionMinX, setCurve, setCurve
 
Methods inherited from class org.faceless.graph.AxesGraph
optionAxisStyle, optionBoxColor, optionFloorStyle, optionMaxY, optionMinY, optionXAxisAtZero, optionXAxisLabel, optionXAxisLabelStyle, optionXAxisStyle, optionXAxisTextRotation, optionXFormatter, optionXStretchToZero, optionYAxisAtZero, optionYAxisLabel, optionYAxisLabelStyle, optionYAxisStyle, optionYAxisTextRotation, optionYFormatter, optionYStretchToZero, 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

AreaGraph

public AreaGraph()
Method Detail

optionCumulative

public void optionCumulative(boolean val)
If this is set to true, the AreaGraph adds the values of the separate curves together to form a total. So if the first curve returned a value of 2 and the second curve returned a value of 3, the second curve would actually be plotted at 5. If your data is already accumulated, set this to false.

Default: true


optionSegments

public void optionSegments(boolean val)
Whether to draw the Area Graph with segments, so that points defined in the data can easily be recognised.

Default: true



Copyright © 2001-2012 Big Faceless Organization