|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.arsdigita.acs.html.SidewaysBarChart
SidewaysBarChart.java Java port of Eve Andersson's tcl proc, gr_sideways_bar_chart creates bar charts in plain html with 1x1 pixel gifs stretched to the right width and height. It will work on any browser that supports tables (i.e., pretty much all of them). This package relies on a few gifs being present in /graphics/graphing-package/. For a full-featured graphing package written in Java, see ArsDigita JPlot.
Constructor Summary | |
SidewaysBarChart()
|
Method Summary | |
void |
addValue(String subCategory,
String category,
int value)
Call addValue once for each bar in the chart. |
void |
setbarColorList(String[] barColorList)
There is a default list of colors with which the values will be displayed if there is more than one value per subcategory, but if those colors don't meet your design needs, go ahead and supply your own color list. |
void |
setBarHeight(int barHeight)
By default, the height of each bar is 15 pixels. |
void |
setCompareNonPercentsAcrossCategories(boolean compareNonPercentsAcrossCategories)
This is only relevant if you are graphing values that are not percentages. |
void |
setDefaultDrilldownUrl(String defaultDrilldownUrl)
If supplied, should be a URL to which the numeric value (if being displayed) will be linked. |
void |
setDisplayScale(boolean displayScale)
By default, there's a scale displayed at the top of the chart that goes from 0% to 100%, but if you don't want that scale there, set display_scale_p to "f". |
void |
setDisplayValues(boolean displayValues)
By default, the values (like 60%) aren't displayed after the bars, but if you want them to be, set this to "t". |
void |
setLeftHeading(String leftHeading)
Stuff (text/pictures/whatever) that goes above the items on the left of the chart (i.e. |
void |
setLegend(String[] legend)
|
void |
setMinLeftColumnWidth(int minLeftColumnWidth)
If you are going to stack charts, set the min_left_column_width to be
the same for each of them so that they will line up. |
void |
setNonPercentValues(boolean nonPercentValues)
Set this to "t" if the numbers you're charting are not percentages. |
void |
setReplaceNullSubcategoryWithNone(boolean replaceNullSubcategoryWithNone)
Set this to "t" to have "[none]" be displayed as the subcategory if the subcategory is the empty string. |
void |
setRightHeading(String rightHeading)
Stuff that goes above the items on the right of the chart (i.e. |
void |
setSubcategorySpacing(int subcategorySpacing)
By default, the spacing between each subcategory is 7 pixels. |
String |
toString()
Generates the HTML bar chart, according to the values set up by calling the addValue method. |
Methods inherited from class java.lang.Object |
|
Constructor Detail |
public SidewaysBarChart()
Method Detail |
public void addValue(String subCategory, String category, int value)
To create a graph like this:
call addValue 5 times, as follows:Dogs Samoyed xxxxxxxxxxx 45% Black Lab xxxx 20% Terrier xxxxxxxxxxxxxxxxxxxx 66% Cats Calico xxxxxxxx 39% Persian xx 10%
SidewaysBarChart sbc = new SidewaysBarChart(); sbc.addValue("Samoyed", "Dogs", 45); sbc.addValue("Black Lab", "Dogs", 20); sbc.addValue("Terrier", "Dogs", 66); sbc.addValue("Calico", "Cats", 39); sbc.addValue("Persian", "Cats", 10);
You can have multiple values per subCategory, in which case you should call addValue once for each value, without changing the subCategory or category parameters.
public String toString()
toString
in class Object
public void setLegend(String[] legend)
public void setbarColorList(String[] barColorList)
public void setDisplayValues(boolean displayValues)
public void setDisplayScale(boolean displayScale)
display_scale_p
to "f".
It doesn't make sense to have the scale if the values that are being charted
are not percentages.public void setDefaultDrilldownUrl(String defaultDrilldownUrl)
$category
, $subcategory
,
and $value
may be referenced.public void setNonPercentValues(boolean nonPercentValues)
public void setMinLeftColumnWidth(int minLeftColumnWidth)
min_left_column_width
to be
the same for each of them so that they will line up.
Otherwise, the left column, which contains the categories and subcategories, probably
won't be the same for successive charts.public void setBarHeight(int barHeight)
public void setSubcategorySpacing(int subcategorySpacing)
public void setCompareNonPercentsAcrossCategories(boolean compareNonPercentsAcrossCategories)
compare_non_percents_across_categories
to "t".public void setLeftHeading(String leftHeading)
public void setRightHeading(String rightHeading)
public void setReplaceNullSubcategoryWithNone(boolean replaceNullSubcategoryWithNone)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |