de.laures.cewolf.cpp
Class LineRendererProcessor

java.lang.Object
  extended by de.laures.cewolf.cpp.LineRendererProcessor
All Implemented Interfaces:
ChartPostProcessor, java.io.Serializable

public class LineRendererProcessor
extends java.lang.Object
implements ChartPostProcessor, java.io.Serializable

A postprocessor for controlling the appearance of shapes at data points for use with XYPlot (XYConditionRenderer or XYLineAndShapeRenderer) and CategoryPlot (LineAndShapeRenderer).
shapes whether or not to draw shapes at data points; default false
outline whether to draw shapes as outlines or solid; default false (i.e., solid)
useFillPaint whether to use the fill paint to draw the interior of shapes; default false
fillPaint the color to be used for interior of shapes; default: the line color
useOutlinePaint whether to use the outline paint to draw the outline of shapes; default false
outlinePaint the color to be used for outline of shapes; default: the line color
shapeVisibleCondition; optional, (for XY plots only)
shapeFilledCondition; optional, (for XY plots only)

Usage

<cewolf:chartpostprocessor id="lineRenderer">
  <cewolf:param name="shapes" value="true" />
  <cewolf:param name="outline" value="true" />
  <cewolf:param name="useFillPaint" value="true" />
  <cewolf:param name="fillPaint" value="#FFFFFF" />
  <cewolf:param name="useOutlinePaint" value="true" />
  <cewolf:param name="outlinePaint" value="#000000" />
  <cewolf:param name="shapeVisibleCondition" value="..." />
  <cewolf:param name="shapeFilledCondition" value="..." />
</cewolf:chartpostprocessor>

Conditional expressions for shapeFilledCondition and shapeVisibleCondition

Must a mathematical/logical expression that evaluates to true or false.
Several variables are available that can be used in the expression:
"x" - the x value of the point
"y" - the y value of the point
"i" - the index of the current point; 0 ≤ i < number of points in the series
"s" - the index of the series if there is more than one; 0 ≤ s < number of series

Furthermore, numerous operators and functions can be used:
+ - * / ^ % sin() cos() tan() asin() acos() atan() exp() ln() sqrt() cond(,,) min() max()

cond works somewhat like the "a ? b : c" construct in C and Java. The 1st argument should evaluate
to true or false (the numerical comparison operators can be used); if it's true,
cond evaluates to the 2nd argument, otherwise to the 3rd.

"PI" and "E" are predefined to be the corresponding mathematical constants.

Here's an EBNF of the expressions this class understands:

expr: ['-' | '+' ] term {'+' term | '-' term}.
term: factor {'*' factor | '/' factor | '%' factor}.
factor: primary {'^' factor}.
compExpr: ['-' | '+' ] term compOper term
compOper: '=' | '<' | '>' | '<>' | '<=' | '>='
primary: number | '(' expr ')' | 'sin' '(' expr ')' | 'cos' '(' expr ')' | 'tan' '(' expr ')' |
'exp' '(' expr ')' | 'ln' '(' expr ')' | 'atan' '(' expr ')'| 'acos' '(' expr ')' |
'sqrt' '(' expr ')' | 'cond' '(' compExpr ',' expr ',' expr ')' | 'asin' '(' expr ')'
'min' '(' expr (',' expr) * ')' | 'max' '(' expr (',' expr) * ')' |
'and' '(' expr (',' expr) * ')' | 'or' '(' expr (',' expr) * ')' | 'not' '(' expr ')' | variable
variable: [a-zA-Z]+
number: intnumber | realnumber.
realnumber: [ intnumber ] . [ intnumber ].
intnumber: digit {digit}.
digit: 0 | 1 | 2 | 3 | ... | 9

Examples

and (x>=0, y>=0) - true for all points in the upper right quadrant
or (i>=10, i<=20) - true for points no. 10 through 20

See Also:
Serialized Form

Constructor Summary
LineRendererProcessor()
           
 
Method Summary
 void processChart(org.jfree.chart.JFreeChart chart, java.util.Map<java.lang.String,java.lang.String> params)
          Processes a generated chart.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineRendererProcessor

public LineRendererProcessor()
Method Detail

processChart

public void processChart(org.jfree.chart.JFreeChart chart,
                         java.util.Map<java.lang.String,java.lang.String> params)
Description copied from interface: ChartPostProcessor
Processes a generated chart. This method is called by the ChartProducer after a chart instance is generated and before it is rendered (if so). The ChartProducer is responsible for post processing a chart dependant on and only on the provided parameters. This means that the same parameters should result in the same postprocessings.

Specified by:
processChart in interface ChartPostProcessor
Parameters:
chart - the chart instance
params - parameters passed to the postprocessor. These are defined in the JSP
See Also:
ChartPostProcessorTag


cewolf tag library - web charts with JFreeChart