HiRISE

HiRISE.HiReport.tags.chart
Class ChartTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.SimpleTagSupport
      extended by HiRISE.HiReport.tags.chart.ChartTag
All Implemented Interfaces:
javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.SimpleTag
Direct Known Subclasses:
BarChartTag, MapChartTag, PieChartTag, TimeAreaChartTag, TimeChartTag, XYBarChartTag

public abstract class ChartTag
extends javax.servlet.jsp.tagext.SimpleTagSupport

Base class for chart tags. Chart tags allow the view to create a chart based on a dataset created in the model layer.


Field Summary
static int DEFAULT_HEIGHT
          Default height in pixels
static int DEFAULT_WIDTH
          Default width in pixels
protected  String dmax
          Domain min (default unset = auto)
protected  String dmin
          Domain min (default unset = auto)
protected  String domain
          The label of the domain axis, the x-axis on a horizontal chart
protected  int height
          The chart height, by default 400 pixels
static String ID
          CVS ID
protected  String imagemap
          the HTML image map name
protected  ChartRenderingInfo info
          Used for image-maps, if requested
protected  boolean legend
          If true, show the legend (defaults to true)
protected  Logger logger
          Our logger
protected  String map
          Name for the image-map, if null will not be generated
protected  PlotOrientation orientation
          The orientation, by default horizontal
protected  String range
          The label of the range axis, the y-axis on a horizontal chart
protected  String rmax
          Range max (default unset = auto)
protected  String rmin
          Range min (default unset = auto)
protected  String title
          The title for the chart, by default empty
protected  String var
          The variable name (id) of the chart, by default 'Chart'.
protected  int width
          The chart width, by default 640 pixels
 
Constructor Summary
ChartTag()
           
 
Method Summary
 void doTag()
          Calls the getChart method, saves the chart to the temporary directory as a PNG with the specified width and height.
abstract  JFreeChart getChart()
          Create and return the chart object.
 int getHeight()
          Get the heigth of the image
 int getWidth()
          Get the width of the image
 void setDomain(String label)
          Set the domain label, which is along the x axis in a horizontal plot.
 void setDomainMax(String dmax)
          Set the max value on the domain axis.
 void setDomainMin(String dmin)
          Set the min value on the domain axis.
 void setHeight(int height)
          Set the height to use when creating the image
 void setLegend(boolean legend)
          Set whether the legend will be displayed.
 void setMap(String map)
          Set the variable name for the image map
 void setOrientation(String orientation)
          Set the orientation, with "horizontal" or "vertical" (case insensitive).
 void setRange(String label)
          Set the range label, which is along the y axis in a horizontal plot.
 void setRangeMax(String rmax)
          Set the max value on the range axis.
 void setRangeMin(String rmin)
          Set the min value on the range axis.
 void setTitle(String title)
          Set the title of the chart
 void setVar(String var)
          Set the variable name which will contain the id of the generated chart image.
 void setWidth(int width)
          Set the width to use when creating the image
 
Methods inherited from class javax.servlet.jsp.tagext.SimpleTagSupport
findAncestorWithClass, getJspBody, getJspContext, getParent, setJspBody, setJspContext, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID

public static final String ID
CVS ID

See Also:
Constant Field Values

DEFAULT_WIDTH

public static final int DEFAULT_WIDTH
Default width in pixels

See Also:
Constant Field Values

DEFAULT_HEIGHT

public static final int DEFAULT_HEIGHT
Default height in pixels

See Also:
Constant Field Values

title

protected String title
The title for the chart, by default empty


domain

protected String domain
The label of the domain axis, the x-axis on a horizontal chart


range

protected String range
The label of the range axis, the y-axis on a horizontal chart


var

protected String var
The variable name (id) of the chart, by default 'Chart'.


width

protected int width
The chart width, by default 640 pixels


height

protected int height
The chart height, by default 400 pixels


map

protected String map
Name for the image-map, if null will not be generated


legend

protected boolean legend
If true, show the legend (defaults to true)


orientation

protected PlotOrientation orientation
The orientation, by default horizontal


logger

protected Logger logger
Our logger


rmin

protected String rmin
Range min (default unset = auto)


rmax

protected String rmax
Range max (default unset = auto)


dmin

protected String dmin
Domain min (default unset = auto)


dmax

protected String dmax
Domain min (default unset = auto)


imagemap

protected String imagemap
the HTML image map name


info

protected ChartRenderingInfo info
Used for image-maps, if requested

Constructor Detail

ChartTag

public ChartTag()
Method Detail

setTitle

public void setTitle(String title)
Set the title of the chart

Parameters:
title - display title

setOrientation

public void setOrientation(String orientation)
Set the orientation, with "horizontal" or "vertical" (case insensitive).

Parameters:
orientation - "horizontal" or "vertical"

setLegend

public void setLegend(boolean legend)
Set whether the legend will be displayed.

Parameters:
legend - True to display the legend, false to hide

getChart

public abstract JFreeChart getChart()
Create and return the chart object.

Returns:
The chart

doTag

public void doTag()
Calls the getChart method, saves the chart to the temporary directory as a PNG with the specified width and height. The variable name specified by the setVar method (defaulting to 'Chart' if unset) will be given the filename, which can be used with the ChartServlet to display the chart.

Specified by:
doTag in interface javax.servlet.jsp.tagext.SimpleTag
Overrides:
doTag in class javax.servlet.jsp.tagext.SimpleTagSupport

setVar

public void setVar(String var)
Set the variable name which will contain the id of the generated chart image.

Parameters:
var - name

setMap

public void setMap(String map)
Set the variable name for the image map

Parameters:
map - name

setWidth

public void setWidth(int width)
Set the width to use when creating the image

Parameters:
width - pixels

setHeight

public void setHeight(int height)
Set the height to use when creating the image

Parameters:
height - pixels

setDomain

public void setDomain(String label)
Set the domain label, which is along the x axis in a horizontal plot.

Parameters:
label - text

setRange

public void setRange(String label)
Set the range label, which is along the y axis in a horizontal plot.

Parameters:
label - text

getWidth

public int getWidth()
Get the width of the image

Returns:
width in pixels

getHeight

public int getHeight()
Get the heigth of the image

Returns:
height in pixels

setRangeMax

public void setRangeMax(String rmax)
Set the max value on the range axis.

Parameters:
rmax - range max

setRangeMin

public void setRangeMin(String rmin)
Set the min value on the range axis.

Parameters:
rmin - range min

setDomainMax

public void setDomainMax(String dmax)
Set the max value on the domain axis.

Parameters:
dmax - domain max

setDomainMin

public void setDomainMin(String dmin)
Set the min value on the domain axis.

Parameters:
dmin - domain min

HiRISE

Copyright (C) Arizona Board of Regents on behalf of the Planetary Image Research Laboratory, Lunar and Planetary Laboratory at the University of Arizona