it.eng.spagobi.engines.chart.bo.charttypes.barcharts
Class BarCharts

java.lang.Object
  extended by it.eng.spagobi.engines.chart.bo.ChartImpl
      extended by it.eng.spagobi.engines.chart.bo.charttypes.barcharts.BarCharts
All Implemented Interfaces:
IChart
Direct Known Subclasses:
CumulativeCurveChart, LinkableBar, SimpleBar, StackedBar, StackedBarGroup

public class BarCharts
extends ChartImpl

Author:
Giulio Gavardi giulio.gavardi@eng.it

Field Summary
static java.lang.String CATEGORY_LABEL
          Label for category Axis
static java.lang.String DYNAMIC_N_VISUALIZATION
          If true enable dynamic choice of numbers of categories to view
static java.lang.String ENABLE_TOOLTIPS
          If true enables tooltips
static java.lang.String FILTER_CAT_GROUPS
          If true enables filtering of cat Groups
static java.lang.String FILTER_CATEGORIES
          If true enables filtering of categories
static java.lang.String FILTER_SERIES
          If true enables filtering of series
static java.lang.String FILTER_SERIES_BUTTONS
          If true shows select all and deselect all buttons from serie filters
static java.lang.String FIRST_AXIS_LB
           
static java.lang.String FIRST_AXIS_UB
          name of the tag that specifies color for each serie name
static java.lang.String MAXIMUM_BAR_WIDTH
          the maximum bar width, which is specified as a percentage of the available space for all bars For Example setting to 0.05 will ensure that the bars never exceed five per cent of the lenght of the axis
static java.lang.String N_CAT_VISUALIZATION
          Number of categories visualization (both)
static java.lang.String N_SER_VISUALIZATION
          Number of series visualization
static java.lang.String N_VISUALIZATION
           
static java.lang.String RANGE_AXIS_LOCATION
          the location of the range axis.
static java.lang.String RANGE_INTEGER_VALUES
          Range Integer; If this string equals true on the range axis only int values appear Possible Values: TRUE or FALSE (the same as null), Default is False
static java.lang.String SECOND_AXIS_LB
           
static java.lang.String SECOND_AXIS_UB
           
static java.lang.String SERIES_COLORS
          name of the tag that specifies color for each serie name
static java.lang.String SERIES_ORDER_COLORS
          name of the tag that specifies color for series in order of apparition
static java.lang.String SHOW_VALUE_LABLES
          If true show value labels
static java.lang.String VALUE_LABEL
          Label for value Axis
static java.lang.String VALUE_LABELS_POSITION
          value labels position: values inside and outside
 
Fields inherited from class it.eng.spagobi.engines.chart.bo.ChartImpl
BARCHART, blockchart, BLOCKCHART, BOXCHART, bullet, CLUSTERCHART, color, COLOR_STYLE, COLORS_BACKGROUND, combined_category_bar, CONF, CONF_DATASET, confDataset, data, defaultLabelsStyle, DIAL_CHART, DIMENSION_HEIGHT, DIMENSION_WIDTH, filter, FONT_STYLE, height, isLovConfDefined, legend, LEGEND, LEGEND_POSITION, LEGEND_STYLE, legendPosition, linkablebar, linkablepie, locale, markerscatter, meter, multichart, name, NAME, NAME_STYLE, ORIENTATION_STYLE, orientationMultichart, overlaid_barline, overlaid_stacked_barline, parametersObject, PIECHART, POSITION_SLIDER, positionSlider, profile, SCATTERCHART, SERIES_LABELS, seriesLabelsMap, simplebar, simpleblockchart, simplebox, simplecluster, simpledial, simplepie, simplescatter, simpletimeblock, SIZE_STYLE, slider, SLIDER_START_FROM_END, sliderStartFromEnd, sparkline, speedometer, speedometerMultiValue, stacked_bar, stacked_bar_group, STYLE_LABELS_DEFAULT, STYLE_SUBTITLE, STYLE_TITLE, styleLegend, styleSubTitle, styleTitle, subName, subtype, TARGETCHART, thermomether, TITLE_DIMENSION, titleDimension, type, VIEW_FILTER, VIEW_SLIDER, width, winlose, XYCHART
 
Constructor Summary
BarCharts()
           
 
Method Summary
 DatasetMap calculateValue()
          Inherited by IChart: calculates chart value.
 void configureChart(it.eng.spago.base.SourceBean content)
          Calculates chart value; public Dataset calculateValue(String cat, Map parameters) throws Exception { logger.debug("IN"); String res=DataSetAccessFunctions.getDataSetResult(profile, getData(),parameters); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); SourceBean sbRows=SourceBean.fromXMLString(res); List listAtts=sbRows.getAttributeAsList("ROW"); // run all categories (one for each row) categoriesNumber=0; for (Iterator iterator = listAtts.iterator(); iterator.hasNext();) { SourceBean category = (SourceBean) iterator.next(); List atts=category.getContainedAttributes(); HashMap series=new HashMap(); String catValue=""; String name=""; String value=""; //run all the attributes, to define series! for (Iterator iterator2 = atts.iterator(); iterator2.hasNext();) { SourceBeanAttribute object = (SourceBeanAttribute) iterator2.next(); name=new String(object.getKey()); value=new String((String)object.getValue()); if(name.equalsIgnoreCase("x"))catValue=value; else series.put(name, value); } for (Iterator iterator3 = series.keySet().iterator(); iterator3.hasNext();) { String nameS = (String) iterator3.next(); String valueS=(String)series.get(nameS); dataset.addValue(Double.valueOf(valueS).doubleValue(), nameS, catValue); categoriesNumber=categoriesNumber+1; } } logger.debug("OUT"); return dataset; }
 org.jfree.chart.JFreeChart createChart(DatasetMap dataset)
          This function creates the chart object.
 org.jfree.data.general.Dataset filterDataset(org.jfree.data.general.Dataset dataset, java.util.HashMap categories, int catSelected, int numberCatsVisualization)
          Use for slider: limits the categories visualization from cat selected to cat selected+numberscatsVisualization.
 org.jfree.data.general.Dataset filterDatasetCatGroups(org.jfree.data.general.Dataset dataset, java.util.Vector groups)
           
 org.jfree.data.general.Dataset filterDatasetSeries(org.jfree.data.general.Dataset dataset, java.util.Vector series)
          Limits the dataset to a particular serie.
 java.util.Map getCategories()
          Gets the categories.
 int getCategoriesNumber()
          Gets the categories number.
 java.lang.String getCategoryLabel()
          Gets the category label.
 java.util.Vector getCatGroupNames()
           
 java.util.HashMap getCatGroups()
           
 java.util.Map getConfParameters()
          Gets the conf parameters.
 java.util.Vector getCurrentCatGroups()
           
 java.util.Vector getCurrentSeries()
           
 java.lang.String getFilterStyle()
           
 java.lang.Integer getNumberCatVisualization()
          Gets the number cat visualization.
 java.lang.Integer getNumberSerVisualization()
           
 java.util.Vector getSeriesNames()
           
 java.util.HashMap getSeriesNumber()
           
 java.util.ArrayList<java.lang.String> getSeriesOrder()
           
 java.lang.String getValueLabel()
          Gets the value label.
 boolean isDynamicNumberCatVisualization()
           
 boolean isFilterCategories()
           
 boolean isFilterCatGroups()
           
 boolean isFilterSeries()
           
 boolean isFilterSeriesButtons()
           
 void putSeriesNumber(java.lang.String name, int index)
           
 void setCategoriesNumber(int categoriesNumber)
          Sets the categories number.
 void setCategoryLabel(java.lang.String categoryLabel)
          Sets the category label.
 void setCatGroupNames(java.util.Vector catGroupNames)
           
 void setCatGroups(java.util.HashMap catGroups)
           
 void setConfParameters(java.util.Map confParameters)
          Sets the conf parameters.
 void setCurrentCatGroups(java.util.Vector currentCatGroups)
           
 void setCurrentSeries(java.util.Vector currentSeries)
           
 void setDynamicNumberCatVisualization(boolean dynamicNumberCatVisualization)
           
 void setFilterCategories(boolean filterCategories)
           
 void setFilterCatGroups(boolean filterCatGroups)
           
 void setFilterSeries(boolean filterSeries)
           
 void setFilterSeriesButtons(boolean filterSeriesButtons)
           
 void setFilterStyle(java.lang.String filterStyle)
           
 void setNumberCatVisualization(java.lang.Integer numberCatVisualization)
          Sets the number cat visualization.
 void setNumberSerVisualization(java.lang.Integer numberSerVisualization)
           
 void setSeriesNames(java.util.Vector seriesNames)
           
 void setSeriesOrder(java.util.ArrayList<java.lang.String> seriesOrder)
           
 void setValueLabel(java.lang.String valueLabel)
          Sets the value label.
 
Methods inherited from class it.eng.spagobi.engines.chart.bo.ChartImpl
createChart, drawLegend, getChangeViewLabel, getChangeViewParameter, getChangeViewParameterLabel, getColor, getConfDataset, getData, getHeight, getLegendPosition, getLocale, getMultichart, getName, getOrientationMultichart, getParametersObject, getPositionSlider, getPossibleChangePars, getProfile, getSeriesLabels, getSubName, getSubtype, getTitleDimension, getType, getWidth, isChangeableView, isFilter, isLegend, isLinkable, isLovConfDefined, isSlider, isSliderStartFromEnd, setChangeViewChecked, setChangeViewsParameter, setColor, setConfDataset, setData, setFilter, setHeight, setLegend, setLegendPosition, setLocale, setLocalizedTitle, setLovConfDefined, setMultichart, setName, setOrientationMultichart, setParametersObject, setPositionSlider, setProfile, setSeriesLabels, setSlider, setSliderStartFromEnd, setStyleTitle, setSubName, setSubTitleParameter, setSubTitleParameter, setSubtype, setTitleDimension, setTitleParameter, setTitleParameter, setType, setWidth
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CATEGORY_LABEL

public static final java.lang.String CATEGORY_LABEL
Label for category Axis

See Also:
Constant Field Values

VALUE_LABEL

public static final java.lang.String VALUE_LABEL
Label for value Axis

See Also:
Constant Field Values

N_CAT_VISUALIZATION

public static final java.lang.String N_CAT_VISUALIZATION
Number of categories visualization (both)

See Also:
Constant Field Values

N_VISUALIZATION

public static final java.lang.String N_VISUALIZATION
See Also:
Constant Field Values

DYNAMIC_N_VISUALIZATION

public static final java.lang.String DYNAMIC_N_VISUALIZATION
If true enable dynamic choice of numbers of categories to view

See Also:
Constant Field Values

N_SER_VISUALIZATION

public static final java.lang.String N_SER_VISUALIZATION
Number of series visualization

See Also:
Constant Field Values

FILTER_CAT_GROUPS

public static final java.lang.String FILTER_CAT_GROUPS
If true enables filtering of cat Groups

See Also:
Constant Field Values

FILTER_SERIES

public static final java.lang.String FILTER_SERIES
If true enables filtering of series

See Also:
Constant Field Values

FILTER_SERIES_BUTTONS

public static final java.lang.String FILTER_SERIES_BUTTONS
If true shows select all and deselect all buttons from serie filters

See Also:
Constant Field Values

FILTER_CATEGORIES

public static final java.lang.String FILTER_CATEGORIES
If true enables filtering of categories

See Also:
Constant Field Values

SHOW_VALUE_LABLES

public static final java.lang.String SHOW_VALUE_LABLES
If true show value labels

See Also:
Constant Field Values

VALUE_LABELS_POSITION

public static final java.lang.String VALUE_LABELS_POSITION
value labels position: values inside and outside

See Also:
Constant Field Values

ENABLE_TOOLTIPS

public static final java.lang.String ENABLE_TOOLTIPS
If true enables tooltips

See Also:
Constant Field Values

MAXIMUM_BAR_WIDTH

public static final java.lang.String MAXIMUM_BAR_WIDTH
the maximum bar width, which is specified as a percentage of the available space for all bars For Example setting to 0.05 will ensure that the bars never exceed five per cent of the lenght of the axis

See Also:
Constant Field Values

RANGE_INTEGER_VALUES

public static final java.lang.String RANGE_INTEGER_VALUES
Range Integer; If this string equals true on the range axis only int values appear Possible Values: TRUE or FALSE (the same as null), Default is False

See Also:
Constant Field Values

RANGE_AXIS_LOCATION

public static final java.lang.String RANGE_AXIS_LOCATION
the location of the range axis. Possibe values: BOTTOM_OR_LEFT, BOTTOM_OR_RIGHT, TOP_OR_RIGHT, TOP_OR_LEFT This parameter is avalaible only for those charts with one single axis

See Also:
Constant Field Values

SERIES_ORDER_COLORS

public static final java.lang.String SERIES_ORDER_COLORS
name of the tag that specifies color for series in order of apparition

See Also:
Constant Field Values

SERIES_COLORS

public static final java.lang.String SERIES_COLORS
name of the tag that specifies color for each serie name

See Also:
Constant Field Values

FIRST_AXIS_UB

public static final java.lang.String FIRST_AXIS_UB
name of the tag that specifies color for each serie name

See Also:
Constant Field Values

FIRST_AXIS_LB

public static final java.lang.String FIRST_AXIS_LB
See Also:
Constant Field Values

SECOND_AXIS_UB

public static final java.lang.String SECOND_AXIS_UB
See Also:
Constant Field Values

SECOND_AXIS_LB

public static final java.lang.String SECOND_AXIS_LB
See Also:
Constant Field Values
Constructor Detail

BarCharts

public BarCharts()
Method Detail

calculateValue

public DatasetMap calculateValue()
                          throws java.lang.Exception
Inherited by IChart: calculates chart value.

Specified by:
calculateValue in interface IChart
Overrides:
calculateValue in class ChartImpl
Returns:
the dataset
Throws:
java.lang.Exception - the exception

configureChart

public void configureChart(it.eng.spago.base.SourceBean content)
Calculates chart value; public Dataset calculateValue(String cat, Map parameters) throws Exception { logger.debug("IN"); String res=DataSetAccessFunctions.getDataSetResult(profile, getData(),parameters); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); SourceBean sbRows=SourceBean.fromXMLString(res); List listAtts=sbRows.getAttributeAsList("ROW"); // run all categories (one for each row) categoriesNumber=0; for (Iterator iterator = listAtts.iterator(); iterator.hasNext();) { SourceBean category = (SourceBean) iterator.next(); List atts=category.getContainedAttributes(); HashMap series=new HashMap(); String catValue=""; String name=""; String value=""; //run all the attributes, to define series! for (Iterator iterator2 = atts.iterator(); iterator2.hasNext();) { SourceBeanAttribute object = (SourceBeanAttribute) iterator2.next(); name=new String(object.getKey()); value=new String((String)object.getValue()); if(name.equalsIgnoreCase("x"))catValue=value; else series.put(name, value); } for (Iterator iterator3 = series.keySet().iterator(); iterator3.hasNext();) { String nameS = (String) iterator3.next(); String valueS=(String)series.get(nameS); dataset.addValue(Double.valueOf(valueS).doubleValue(), nameS, catValue); categoriesNumber=categoriesNumber+1; } } logger.debug("OUT"); return dataset; }

Specified by:
configureChart in interface IChart
Overrides:
configureChart in class ChartImpl
Parameters:
content - the content

getFilterStyle

public java.lang.String getFilterStyle()
Returns:
the filterStyle

setFilterStyle

public void setFilterStyle(java.lang.String filterStyle)
Parameters:
filterStyle - the filterStyle to set

filterDataset

public org.jfree.data.general.Dataset filterDataset(org.jfree.data.general.Dataset dataset,
                                                    java.util.HashMap categories,
                                                    int catSelected,
                                                    int numberCatsVisualization)
Use for slider: limits the categories visualization from cat selected to cat selected+numberscatsVisualization.

Specified by:
filterDataset in interface IChart
Overrides:
filterDataset in class ChartImpl
Parameters:
dataset - the dataset
categories - the categories
catSelected - the cat selected
numberCatsVisualization - the number cats visualization
Returns:
the dataset

filterDatasetSeries

public org.jfree.data.general.Dataset filterDatasetSeries(org.jfree.data.general.Dataset dataset,
                                                          java.util.Vector series)
Limits the dataset to a particular serie.

Parameters:
dataset - the dataset
serie - the serie
Returns:
the dataset

filterDatasetCatGroups

public org.jfree.data.general.Dataset filterDatasetCatGroups(org.jfree.data.general.Dataset dataset,
                                                             java.util.Vector groups)

getConfParameters

public java.util.Map getConfParameters()
Gets the conf parameters.

Returns:
the conf parameters

setConfParameters

public void setConfParameters(java.util.Map confParameters)
Sets the conf parameters.

Parameters:
confParameters - the new conf parameters

createChart

public org.jfree.chart.JFreeChart createChart(DatasetMap dataset)
Description copied from class: ChartImpl
This function creates the chart object.

Specified by:
createChart in interface IChart
Overrides:
createChart in class ChartImpl
Parameters:
dataset - the dataset
Returns:
the j free chart

getCategoryLabel

public java.lang.String getCategoryLabel()
Gets the category label.

Returns:
the category label

setCategoryLabel

public void setCategoryLabel(java.lang.String categoryLabel)
Sets the category label.

Parameters:
categoryLabel - the new category label

getValueLabel

public java.lang.String getValueLabel()
Gets the value label.

Returns:
the value label

setValueLabel

public void setValueLabel(java.lang.String valueLabel)
Sets the value label.

Parameters:
valueLabel - the new value label

getCategoriesNumber

public int getCategoriesNumber()
Gets the categories number.

Returns:
the categories number

setCategoriesNumber

public void setCategoriesNumber(int categoriesNumber)
Sets the categories number.

Parameters:
categoriesNumber - the new categories number

getCategories

public java.util.Map getCategories()
Gets the categories.

Returns:
the categories

getNumberCatVisualization

public java.lang.Integer getNumberCatVisualization()
Gets the number cat visualization.

Returns:
the number cat visualization

setNumberCatVisualization

public void setNumberCatVisualization(java.lang.Integer numberCatVisualization)
Sets the number cat visualization.

Parameters:
numberCatVisualization - the new number cat visualization

getCurrentSeries

public java.util.Vector getCurrentSeries()

setCurrentSeries

public void setCurrentSeries(java.util.Vector currentSeries)

getSeriesNumber

public java.util.HashMap getSeriesNumber()

putSeriesNumber

public void putSeriesNumber(java.lang.String name,
                            int index)

getSeriesNames

public java.util.Vector getSeriesNames()

setSeriesNames

public void setSeriesNames(java.util.Vector seriesNames)

isFilterCatGroups

public boolean isFilterCatGroups()

setFilterCatGroups

public void setFilterCatGroups(boolean filterCatGroups)

getCatGroups

public java.util.HashMap getCatGroups()

setCatGroups

public void setCatGroups(java.util.HashMap catGroups)

getCurrentCatGroups

public java.util.Vector getCurrentCatGroups()

setCurrentCatGroups

public void setCurrentCatGroups(java.util.Vector currentCatGroups)

getCatGroupNames

public java.util.Vector getCatGroupNames()

setCatGroupNames

public void setCatGroupNames(java.util.Vector catGroupNames)

isFilterSeries

public boolean isFilterSeries()

setFilterSeries

public void setFilterSeries(boolean filterSeries)

isFilterCategories

public boolean isFilterCategories()

setFilterCategories

public void setFilterCategories(boolean filterCategories)

getNumberSerVisualization

public java.lang.Integer getNumberSerVisualization()
Returns:
the numberSerVisualization

setNumberSerVisualization

public void setNumberSerVisualization(java.lang.Integer numberSerVisualization)
Parameters:
numberSerVisualization - the numberSerVisualization to set

isDynamicNumberCatVisualization

public boolean isDynamicNumberCatVisualization()

setDynamicNumberCatVisualization

public void setDynamicNumberCatVisualization(boolean dynamicNumberCatVisualization)

isFilterSeriesButtons

public boolean isFilterSeriesButtons()

setFilterSeriesButtons

public void setFilterSeriesButtons(boolean filterSeriesButtons)

getSeriesOrder

public java.util.ArrayList<java.lang.String> getSeriesOrder()

setSeriesOrder

public void setSeriesOrder(java.util.ArrayList<java.lang.String> seriesOrder)