|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ibisph.charts.AbstractChart
public abstract class AbstractChart
Core chart object that provides the common Chart
methods.
This also contains helper methods and core functionality used by all IBISPH
chart objects. The specific sub classed chart objects then implement the
chart specific AgileBlox objects along with chart specific setter methods
and chart adjustment code.
Field Summary | |
---|---|
protected java.lang.String |
acxmlPathAndFilename
|
protected double |
defaultChartHeight
|
protected double |
defaultXAxisLabelDistance
|
protected double |
defaultYAxisLabelDistance
|
protected double |
labelCharacterWidth
|
protected double |
legendSymbolWidth
|
protected double |
maxLegendWidth
|
protected double |
maxXAxisLabelWidth
|
protected double |
maxYAxisLabelWidth
|
protected double |
minLegendWidth
|
Constructor Summary | |
---|---|
AbstractChart(java.lang.String acxmlPathAndFilename)
Simple constructor which simply sets ACXML file property. |
Method Summary | |
---|---|
protected void |
adjustLegendSize(com.elan.wclibrary.svg.BaseChart baseChart,
java.lang.String[] legendTitles)
Adjust chart's legend size based on the titles and the legend size properties. |
protected void |
adjustXAxisLabelHeight(com.elan.wclibrary.svg.BaseChart baseChart,
java.lang.String[] categoryTitles)
Modifies x axis category label titles. |
protected void |
adjustXAxisLabelHeight(com.elan.wclibrary.svg.BaseChart baseChart,
java.lang.String[] labels,
double xAxisLabelTitleDistance)
Modifies x axis category label titles. |
protected void |
adjustYAxisLabelWidthAndSetScale(com.elan.wclibrary.svg.BaseChart baseChart,
double maxValue)
|
protected void |
adjustYAxisLabelWidthAndSetScale(com.elan.wclibrary.svg.BaseChart baseChart,
double maxValue,
double labelDistance)
Modifies y axis value titles. |
void |
generate(javax.servlet.http.HttpServletRequest request,
ChartData chartData,
java.lang.String chartHeight,
boolean showConfidenceLimits,
boolean zipOutput,
java.io.OutputStream outputStream)
Uses the supplied chart data, existing property settings, and chart specific adjustment methods to generate an SVG output stream. |
protected abstract com.elan.wclibrary.svg.BaseChart |
getBaseChart(java.lang.String chartTitle,
java.lang.String seriesAxisTitle,
java.lang.String[] seriesTitles,
java.lang.String categoryAxisTitle,
java.lang.String[] categoryTitles,
java.lang.String[][] values,
java.lang.String[][] lowerLimits,
java.lang.String[][] upperLimits,
java.lang.String[][] toolTips,
double maxValue,
boolean showConfidenceLimits)
Sets the chart's data values, adjusts chart's layout based on the control properties, and returns the chart instance. |
protected double |
getMaxCategorySum(java.lang.String[][] valueArray)
Sums according to the category to determines the maximum value. |
protected double |
getMaxSeriesSum(java.lang.String[][] valueArray)
Sums the series to determines the maximum value. |
protected int |
numberOfLines(int charsPerLine,
int totalChars)
Calculates number of lines so that the label and title spacing can be set. |
protected void |
setChartHeight(com.elan.wclibrary.svg.BaseChart baseChart,
java.lang.String chartHeight)
Validates height range and sets the chart's height. |
void |
setDefaultChartHeight(double defaultChartHeight)
Sets the default height property of the entire chart (including legends, titles, labels). |
void |
setDefaultXAxisLabelDistance(double defaultXAxisLabelDistance)
Sets x axis label distance property. |
void |
setDefaultYAxisLabelDistance(double defaultYAxisLabelDistance)
Sets y axis label distance property. |
void |
setLabelCharacterWidth(double labelCharacterWidth)
Sets average character width, in pixels, used when guessing/determining the screen width of the string. |
void |
setLegendSymbolWidth(double legendSymbolWidth)
Sets this chart's legend symbol width property. |
void |
setMaxLegendWidth(double maxLegendWidth)
Sets maximum allowable width property for this chart's legend. |
void |
setMaxXAxisLabelWidth(double maxXAxisLabelWidth)
Sets maximum allowable width property for this chart's X Axis Labels. |
void |
setMaxYAxisLabelWidth(double maxYAxisLabelWidth)
Sets maximum allowable width property for this chart's Y Axis Labels. |
void |
setMinLegendWidth(double minLegendWidth)
Sets minimum allowable width property for this chart's legend. |
protected void |
setTitle(com.elan.wclibrary.svg.BaseChart baseChart,
java.lang.String title)
Sets the main chart header title, escapes ' and " characters, and sets the header height. |
protected double |
toDouble(java.lang.String value)
Converts the string to double. |
protected double[][] |
toNullToZeroDoubleArray(java.lang.String[][] stringValueArray)
Converts String array values to a double value array. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected double minLegendWidth
protected double maxLegendWidth
protected double maxYAxisLabelWidth
protected double maxXAxisLabelWidth
protected double legendSymbolWidth
protected double labelCharacterWidth
protected double defaultYAxisLabelDistance
protected double defaultXAxisLabelDistance
protected double defaultChartHeight
protected java.lang.String acxmlPathAndFilename
Constructor Detail |
---|
public AbstractChart(java.lang.String acxmlPathAndFilename)
acxmlPathAndFilename
- complete filename with path of the ACXML
properties file.Method Detail |
---|
public void setMinLegendWidth(double minLegendWidth)
setMinLegendWidth
in interface Chart
minLegendWidth
- minimum legend width in pixels.public void setMaxLegendWidth(double maxLegendWidth)
setMaxLegendWidth
in interface Chart
maxLegendWidth
- maximum legend width in pixels.public void setMaxYAxisLabelWidth(double maxYAxisLabelWidth)
setMaxYAxisLabelWidth
in interface Chart
maxYAxisLabelWidth
- maximum Y Axis Label width in pixels.public void setMaxXAxisLabelWidth(double maxXAxisLabelWidth)
setMaxXAxisLabelWidth
in interface Chart
maxXAxisLabelWidth
- maximum X Axis Label width in pixels.public void setLegendSymbolWidth(double legendSymbolWidth)
setLegendSymbolWidth
in interface Chart
legendSymbolWidth
- width of the legend icon (typically a circle)
in pixels.public void setLabelCharacterWidth(double labelCharacterWidth)
setLabelCharacterWidth
in interface Chart
labelCharacterWidth
- Average width in pixels of a character.public void setDefaultYAxisLabelDistance(double defaultYAxisLabelDistance)
setDefaultYAxisLabelDistance
in interface Chart
defaultYAxisLabelDistance
- Number of pixels to the left of the
chart on where to start the y axis labels.public void setDefaultXAxisLabelDistance(double defaultXAxisLabelDistance)
setDefaultXAxisLabelDistance
in interface Chart
defaultXAxisLabelDistance
- Number of pixels from the bottom of
the chart on where to start the x axis labels.public void setDefaultChartHeight(double defaultChartHeight)
setDefaultChartHeight
in interface Chart
defaultChartHeight
- height of the chart in pixels.public void generate(javax.servlet.http.HttpServletRequest request, ChartData chartData, java.lang.String chartHeight, boolean showConfidenceLimits, boolean zipOutput, java.io.OutputStream outputStream)
getBaseChart
method which loads the data
and does most of the chart adjustments, then sets the chart height
and zip property, calls the AgileBlox buildSVG
method,
and finally generates the chart and streams the results back to the
specified output stream.
generate
in interface Chart
request
- HttpServletRequest needed by the Agileblox chart object.chartData
- Contains chart data typically loaded by a DAO.showConfidenceLimits
- Controls displaying confidence intervals. If
true
the confidence limits will always be visible. If
false
then the limits are only shown to the user when
they mouse over the value or they mouse over the series title in the
legend.zipOutput
- Controls compressed output. true = compress the output
using gzip. false = no compression. As of 10/2005, this feature
is not used. The biggest reason that the output should NOT be
zipped for IBIS is that the jpeg conversion needs raw SVG text.
To do SVG compression, a compression servlet filter was developed.outputStream
- destination where chart data is sent.chartHeight
- controls how tall/high the chart will be (in pixels).protected abstract com.elan.wclibrary.svg.BaseChart getBaseChart(java.lang.String chartTitle, java.lang.String seriesAxisTitle, java.lang.String[] seriesTitles, java.lang.String categoryAxisTitle, java.lang.String[] categoryTitles, java.lang.String[][] values, java.lang.String[][] lowerLimits, java.lang.String[][] upperLimits, java.lang.String[][] toolTips, double maxValue, boolean showConfidenceLimits)
chartTitle
- Main title that is to be displayed on the top of the
chart.seriesAxisTitle
- Title to be shown on typically the Y axis which
is associated with the series. This axis title usually describes
the type of "values" that the data is e.g. "Population Count",
"Percentage of Adults" etc.seriesTitles
- Array of strings that is the title/description for
each data series. These series title values are displayed in the
legend.categoryAxisTitle
- Title to be shown on typically the X axis which
is associated with the categoy values. This axis title usually
describes what the categories are. Examples are "Year" or
"County" etc.categoryTitles
- Array that contains the title for each different
data category. These values are typically displayed as labels
for each interval on the axis. For the above example these
titles would be "1995", "1996", ... "2005" or "Beaver", "Box
Elder", ... "Weber".values
- 2-d array that contains the actual data values to be
displayed/plotted on the chart. These are string values so that
null missing values will be handled (e.g. not shown) on the chart.
If the double method is used, then missing values are counted as
0.0 and the chart is not correct. The first array index is the
series with the second corresponding to the category.lowerLimits
- Similar to the values array but contains the lower
confidence limit (if any) associated with the
value[series][category].upperLimits
- Similar to the values array but contains the upper
confidence limit (if any) associated with the
value[series][category].toolTips
- Contains any special label type values to be shown to
the user when the data value is moused over.maxValue
- Maximum data value which is used to control the chart's
value scaling.showConfidenceLimits
- flag to control how to displaying the
confidence intervals. if true
the confidence limits
will always be displayed. If false
then the limits
are only shown to the user when they mouse over the value or
they mouse over the series title in the legend.
protected void setTitle(com.elan.wclibrary.svg.BaseChart baseChart, java.lang.String title)
baseChart
- chart to be modified.title
- Sets the baseChart's Header Title (main title of the chart).protected void setChartHeight(com.elan.wclibrary.svg.BaseChart baseChart, java.lang.String chartHeight)
baseChart
- chart to be modified.chartHeight
- String which contains a numerical value in pixels.
This value is not an int or double as the Agileblox object accepts
a String and the value is typically set on the URL via the XSLT
which builds the page's code (comes in from the chart data).protected void adjustLegendSize(com.elan.wclibrary.svg.BaseChart baseChart, java.lang.String[] legendTitles)
baseChart
- chart to be modified.legendTitles
- Array of titles to be displayed within the legend.protected void adjustYAxisLabelWidthAndSetScale(com.elan.wclibrary.svg.BaseChart baseChart, double maxValue, double labelDistance)
baseChart
- chart to be modified.maxValue
- Greatest value of the data that is used to determine the
number of significant digits so that the y axis value size can be
adjusted correctly.labelDistance
- Additional padding size in pixels to be used for
the y axis labels.protected void adjustYAxisLabelWidthAndSetScale(com.elan.wclibrary.svg.BaseChart baseChart, double maxValue)
protected void adjustXAxisLabelHeight(com.elan.wclibrary.svg.BaseChart baseChart, java.lang.String[] labels, double xAxisLabelTitleDistance)
baseChart
- chart to be modified.labels
- Array of x axis category titles.xAxisLabelTitleDistance
- Absolute value the x axis title is placed
away from the center of the category labels. Valid values are 1
to basically chart height. Agileblox doesn't adjust for the
category size and angle but they do take into account (set the
chart area) according to the x axis label distance setting. This
is a kludge which is used to set the area needed to hold the category
labels.protected void adjustXAxisLabelHeight(com.elan.wclibrary.svg.BaseChart baseChart, java.lang.String[] categoryTitles)
baseChart
- chart to be modified.categoryTitles
- Array of x axis category titles.protected int numberOfLines(int charsPerLine, int totalChars)
charsPerLine
- sets the number of characters that define a single line.totalChars
- Size of the string - length.
protected double toDouble(java.lang.String value)
value
- String to be parsed/converted to a double.
protected double getMaxSeriesSum(java.lang.String[][] valueArray)
valueArray
- series and category values to be looped summed and
checked.
protected double getMaxCategorySum(java.lang.String[][] valueArray)
valueArray
- series and category values to be looped summed and
checked.
protected double[][] toNullToZeroDoubleArray(java.lang.String[][] stringValueArray)
stringValueArray
- String values to be converted to a double value.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |