it.eng.spagobi.engines.chart.bo
Class ChartImpl

java.lang.Object
  extended by it.eng.spagobi.engines.chart.bo.ChartImpl
All Implemented Interfaces:
IChart
Direct Known Subclasses:
BarCharts, BlockCharts, BoxCharts, ClusterCharts, DialCharts, LineChart, PieCharts, ScatterCharts, TargetCharts, XYCharts

public class ChartImpl
extends java.lang.Object
implements IChart

Author:
Giulio Gavardi giulio.gavardi@eng.it

Field Summary
static java.lang.String BARCHART
           
static java.lang.String blockchart
           
static java.lang.String BLOCKCHART
           
static java.lang.String BOXCHART
           
static java.lang.String bullet
           
static java.lang.String CLUSTERCHART
           
protected  java.awt.Color color
           
static java.lang.String COLOR_STYLE
           
static java.lang.String COLORS_BACKGROUND
          title dimension
static java.lang.String combined_category_bar
           
static java.lang.String CONF
          TAG CONF
static java.lang.String CONF_DATASET
          dataset for configuration
protected  java.lang.String confDataset
           
protected  java.lang.String data
           
protected  StyleLabel defaultLabelsStyle
           
static java.lang.String DIAL_CHART
           
static java.lang.String DIMENSION_HEIGHT
           
static java.lang.String DIMENSION_WIDTH
          dimensions of chart
protected  boolean filter
           
static java.lang.String FONT_STYLE
           
protected  int height
           
protected  boolean isLovConfDefined
           
protected  boolean legend
           
static java.lang.String LEGEND
          if true draw legend
static java.lang.String LEGEND_POSITION
          legend position; bottom, top, left, right
static java.lang.String LEGEND_STYLE
          legend style; font, sizem color
protected  java.lang.String legendPosition
           
static java.lang.String linkablebar
           
static java.lang.String linkablepie
           
protected  java.util.Locale locale
           
static java.lang.String markerscatter
           
static java.lang.String meter
           
protected  boolean multichart
           
protected  java.lang.String name
           
static java.lang.String NAME
          Nameof the chart., can be parametrized
static java.lang.String NAME_STYLE
          parameters for style tags
static java.lang.String ORIENTATION_STYLE
           
protected  java.lang.String orientationMultichart
           
static java.lang.String overlaid_barline
           
static java.lang.String overlaid_stackedbarline
           
protected  java.util.Map parametersObject
           
static java.lang.String PIECHART
           
static java.lang.String POSITION_SLIDER
          top or bottom, where to put slider
protected  java.lang.String positionSlider
           
protected  it.eng.spago.security.IEngUserProfile profile
           
static java.lang.String SCATTERCHART
           
static java.lang.String SERIES_LABELS
          Labels for series, should be put outside CONF
protected  java.util.HashMap seriesLabelsMap
           
static java.lang.String simplebar
           
static java.lang.String simplebox
           
static java.lang.String simplecluster
           
static java.lang.String simpledial
           
static java.lang.String simplepie
           
static java.lang.String simplescatter
           
static java.lang.String simpletimeblock
           
static java.lang.String SIZE_STYLE
           
protected  boolean slider
           
static java.lang.String SLIDER_START_FROM_END
          if true the slider starts from last n categories
protected  boolean sliderStartFromEnd
           
static java.lang.String sparkline
           
static java.lang.String speedometer
           
static java.lang.String speedometerMultiValue
           
static java.lang.String stacked_bar
           
static java.lang.String stacked_bar_group
           
static java.lang.String STYLE_LABELS_DEFAULT
          tag for style default labels
static java.lang.String STYLE_SUBTITLE
          tag for style subTitle
static java.lang.String STYLE_TITLE
          tag for style title
protected  StyleLabel styleLegend
           
protected  StyleLabel styleSubTitle
           
protected  StyleLabel styleTitle
           
protected  java.lang.String subName
           
protected  java.lang.String subtype
           
static java.lang.String TARGETCHART
           
static java.lang.String thermomether
           
static java.lang.String TITLE_DIMENSION
          title dimension
protected  int titleDimension
           
protected  java.lang.String type
           
static java.lang.String VIEW_FILTER
          if true view filter
static java.lang.String VIEW_SLIDER
          if true view slider
protected  int width
           
static java.lang.String winlose
           
static java.lang.String XYCHART
           
 
Constructor Summary
ChartImpl()
           
 
Method Summary
 DatasetMap calculateValue()
          Calculate value.
 void configureChart(it.eng.spago.base.SourceBean content)
          configureChart reads the content of the template and sets the chart parameters.
 org.jfree.chart.JFreeChart createChart(DatasetMap dataset)
          This function creates the chart object.
static ChartImpl createChart(java.lang.String type, java.lang.String subtype)
          This function creates the object of the right subtype as specified by type and subtype parameters found in template.
 void drawLegend(org.jfree.chart.JFreeChart chart)
           
 org.jfree.data.general.Dataset filterDataset(org.jfree.data.general.Dataset dataset, java.util.HashMap categories, int catSelected, int numberCatsVisualization)
          Filter dataset.
 java.lang.String getChangeViewLabel(java.lang.String theme, int i)
          Gets the change view label.
 boolean getChangeViewParameter(java.lang.String changePar)
          Gets the change view parameter.
 java.lang.String getChangeViewParameterLabel(java.lang.String changePar, int i)
          Gets the change view parameter label.
 java.awt.Color getColor()
          Gets the color.
 java.lang.String getConfDataset()
          Gets the conf dataset.
 java.lang.String getData()
          Gets the data.
 int getHeight()
          Gets the height.
 java.lang.String getLegendPosition()
           
 java.util.Locale getLocale()
           
 boolean getMultichart()
           
 java.lang.String getName()
          Gets the name.
 java.lang.String getOrientationMultichart()
           
 java.util.Map getParametersObject()
          Gets the parameters object.
 java.lang.String getPositionSlider()
           
 java.util.List getPossibleChangePars()
          Gets the possible change pars.
 it.eng.spago.security.IEngUserProfile getProfile()
          Gets the profile.
 java.util.HashMap getSeriesLabels()
           
 java.lang.String getSubName()
           
 java.lang.String getSubtype()
          Gets the subtype.
 int getTitleDimension()
           
 java.lang.String getType()
          Gets the type.
 int getWidth()
          Gets the width.
 boolean isChangeableView()
          Checks if is changeable view.
 boolean isFilter()
           
 boolean isLegend()
          Checks if is legend.
 boolean isLinkable()
          Checks if is linkable.
 boolean isLovConfDefined()
          Checks if is lov conf defined.
 boolean isSlider()
           
 boolean isSliderStartFromEnd()
           
 void setChangeViewChecked(boolean b)
          Sets the change view checked.
 void setChangeViewsParameter(java.lang.String changePar, boolean how)
          Sets the change views parameter.
 void setColor(java.awt.Color color)
          Sets the color.
 void setConfDataset(java.lang.String confDataset)
          Sets the conf dataset.
 void setData(java.lang.String _data)
          Sets the data.
 void setFilter(boolean filter)
           
 void setHeight(int _height)
          Sets the height.
 void setLegend(boolean legend)
          Sets the legend.
 void setLegendPosition(java.lang.String legendPosition)
           
 void setLocale(java.util.Locale locale)
           
 void setLocalizedTitle()
           
 void setLovConfDefined(boolean isLovConfDefined)
          Sets the lov conf defined.
 void setMultichart(boolean multichart)
           
 void setName(java.lang.String _name)
          Sets the name.
 void setOrientationMultichart(java.lang.String orientationMultichart)
           
 void setParametersObject(java.util.Map parametersObject)
          Sets the parameters object.
 void setPositionSlider(java.lang.String positionSlider)
           
 void setProfile(it.eng.spago.security.IEngUserProfile profile)
          Sets the profile.
 void setSeriesLabels(java.util.HashMap seriesLabels)
           
 void setSlider(boolean slider)
           
 void setSliderStartFromEnd(boolean sliderStartFromEnd)
           
 org.jfree.chart.title.TextTitle setStyleTitle(java.lang.String title, StyleLabel titleLabel)
           
 void setSubName(java.lang.String _name)
           
 void setSubTitleParameter(java.util.List atts)
           
 void setSubTitleParameter(java.lang.String attValue)
           
 void setSubtype(java.lang.String subtype)
          Sets the subtype.
 void setTitleDimension(int titleDimension)
           
 void setTitleParameter(java.util.List atts)
           
 void setTitleParameter(java.lang.String attValue)
           
 void setType(java.lang.String type)
          Sets the type.
 void setWidth(int _width)
          Sets the width.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

titleDimension

protected int titleDimension

name

protected java.lang.String name

subName

protected java.lang.String subName

width

protected int width

height

protected int height

data

protected java.lang.String data

confDataset

protected java.lang.String confDataset

isLovConfDefined

protected boolean isLovConfDefined

profile

protected it.eng.spago.security.IEngUserProfile profile

type

protected java.lang.String type

subtype

protected java.lang.String subtype

color

protected java.awt.Color color

legend

protected boolean legend

legendPosition

protected java.lang.String legendPosition

parametersObject

protected java.util.Map parametersObject

filter

protected boolean filter

slider

protected boolean slider

sliderStartFromEnd

protected boolean sliderStartFromEnd

positionSlider

protected java.lang.String positionSlider

styleTitle

protected StyleLabel styleTitle

styleSubTitle

protected StyleLabel styleSubTitle

defaultLabelsStyle

protected StyleLabel defaultLabelsStyle

styleLegend

protected StyleLabel styleLegend

seriesLabelsMap

protected java.util.HashMap seriesLabelsMap

multichart

protected boolean multichart

orientationMultichart

protected java.lang.String orientationMultichart

locale

protected java.util.Locale locale

DIAL_CHART

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

speedometer

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

speedometerMultiValue

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

simpledial

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

thermomether

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

meter

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

bullet

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

PIECHART

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

simplepie

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

linkablepie

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

BARCHART

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

simplebar

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

linkablebar

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

overlaid_barline

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

stacked_bar

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

stacked_bar_group

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

overlaid_stackedbarline

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

combined_category_bar

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

BOXCHART

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

simplebox

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

CLUSTERCHART

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

simplecluster

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

XYCHART

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

blockchart

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

SCATTERCHART

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

simplescatter

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

markerscatter

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

TARGETCHART

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

sparkline

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

winlose

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

BLOCKCHART

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

simpletimeblock

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

NAME

public static final java.lang.String NAME
Nameof the chart., can be parametrized

See Also:
Constant Field Values

STYLE_TITLE

public static final java.lang.String STYLE_TITLE
tag for style title

See Also:
Constant Field Values

STYLE_SUBTITLE

public static final java.lang.String STYLE_SUBTITLE
tag for style subTitle

See Also:
Constant Field Values

STYLE_LABELS_DEFAULT

public static final java.lang.String STYLE_LABELS_DEFAULT
tag for style default labels

See Also:
Constant Field Values

NAME_STYLE

public static final java.lang.String NAME_STYLE
parameters for style tags

See Also:
Constant Field Values

FONT_STYLE

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

SIZE_STYLE

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

COLOR_STYLE

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

ORIENTATION_STYLE

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

TITLE_DIMENSION

public static final java.lang.String TITLE_DIMENSION
title dimension

See Also:
Constant Field Values

COLORS_BACKGROUND

public static final java.lang.String COLORS_BACKGROUND
title dimension

See Also:
Constant Field Values

DIMENSION_WIDTH

public static final java.lang.String DIMENSION_WIDTH
dimensions of chart

See Also:
Constant Field Values

DIMENSION_HEIGHT

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

CONF_DATASET

public static final java.lang.String CONF_DATASET
dataset for configuration

See Also:
Constant Field Values

CONF

public static final java.lang.String CONF
TAG CONF

See Also:
Constant Field Values

LEGEND

public static final java.lang.String LEGEND
if true draw legend

See Also:
Constant Field Values

LEGEND_POSITION

public static final java.lang.String LEGEND_POSITION
legend position; bottom, top, left, right

See Also:
Constant Field Values

LEGEND_STYLE

public static final java.lang.String LEGEND_STYLE
legend style; font, sizem color

See Also:
Constant Field Values

VIEW_FILTER

public static final java.lang.String VIEW_FILTER
if true view filter

See Also:
Constant Field Values

VIEW_SLIDER

public static final java.lang.String VIEW_SLIDER
if true view slider

See Also:
Constant Field Values

SLIDER_START_FROM_END

public static final java.lang.String SLIDER_START_FROM_END
if true the slider starts from last n categories

See Also:
Constant Field Values

POSITION_SLIDER

public static final java.lang.String POSITION_SLIDER
top or bottom, where to put slider

See Also:
Constant Field Values

SERIES_LABELS

public static final java.lang.String SERIES_LABELS
Labels for series, should be put outside CONF

See Also:
Constant Field Values
Constructor Detail

ChartImpl

public ChartImpl()
Method Detail

configureChart

public void configureChart(it.eng.spago.base.SourceBean content)
configureChart reads the content of the template and sets the chart parameters.

Specified by:
configureChart in interface IChart
Parameters:
content - the content

createChart

public org.jfree.chart.JFreeChart createChart(DatasetMap dataset)
This function creates the chart object.

Specified by:
createChart in interface IChart
Parameters:
chartTitle - the chart title
dataset - the dataset
Returns:
the j free chart

createChart

public static ChartImpl createChart(java.lang.String type,
                                    java.lang.String subtype)
This function creates the object of the right subtype as specified by type and subtype parameters found in template.

Parameters:
type - the type
subtype - the subtype
Returns:
the chart impl

getData

public java.lang.String getData()
Description copied from interface: IChart
Gets the data.

Specified by:
getData in interface IChart
Returns:
the data

getHeight

public int getHeight()
Description copied from interface: IChart
Gets the height.

Specified by:
getHeight in interface IChart
Returns:
the height

getName

public java.lang.String getName()
Description copied from interface: IChart
Gets the name.

Specified by:
getName in interface IChart
Returns:
the name

getWidth

public int getWidth()
Description copied from interface: IChart
Gets the width.

Specified by:
getWidth in interface IChart
Returns:
the width

setData

public void setData(java.lang.String _data)
Description copied from interface: IChart
Sets the data.

Specified by:
setData in interface IChart
Parameters:
_data - the new data

setHeight

public void setHeight(int _height)
Description copied from interface: IChart
Sets the height.

Specified by:
setHeight in interface IChart
Parameters:
_height - the new height

setName

public void setName(java.lang.String _name)
Description copied from interface: IChart
Sets the name.

Specified by:
setName in interface IChart
Parameters:
_name - the new name

setSubName

public void setSubName(java.lang.String _name)

getSubName

public java.lang.String getSubName()
Returns:
the subName

setWidth

public void setWidth(int _width)
Description copied from interface: IChart
Sets the width.

Specified by:
setWidth in interface IChart
Parameters:
_width - the new width

calculateValue

public DatasetMap calculateValue()
                          throws java.lang.Exception
Description copied from interface: IChart
Calculate value.

Specified by:
calculateValue in interface IChart
Returns:
A map of datasets (usually only one)
Throws:
java.lang.Exception - the exception

getConfDataset

public java.lang.String getConfDataset()
Gets the conf dataset.

Returns:
the conf dataset

setConfDataset

public void setConfDataset(java.lang.String confDataset)
Sets the conf dataset.

Parameters:
confDataset - the new conf dataset

getProfile

public it.eng.spago.security.IEngUserProfile getProfile()
Gets the profile.

Returns:
the profile

setProfile

public void setProfile(it.eng.spago.security.IEngUserProfile profile)
Sets the profile.

Parameters:
profile - the new profile

isLovConfDefined

public boolean isLovConfDefined()
Checks if is lov conf defined.

Returns:
true, if is lov conf defined

setLovConfDefined

public void setLovConfDefined(boolean isLovConfDefined)
Sets the lov conf defined.

Parameters:
isLovConfDefined - the new lov conf defined

isLinkable

public boolean isLinkable()
Description copied from interface: IChart
Checks if is linkable.

Specified by:
isLinkable in interface IChart
Returns:
true, if is linkable

getType

public java.lang.String getType()
Gets the type.

Returns:
the type

setType

public void setType(java.lang.String type)
Sets the type.

Parameters:
type - the new type

getSubtype

public java.lang.String getSubtype()
Gets the subtype.

Returns:
the subtype

setSubtype

public void setSubtype(java.lang.String subtype)
Sets the subtype.

Parameters:
subtype - the new subtype

isChangeableView

public boolean isChangeableView()
Description copied from interface: IChart
Checks if is changeable view.

Specified by:
isChangeableView in interface IChart
Returns:
true, if is changeable view

getChangeViewLabel

public java.lang.String getChangeViewLabel(java.lang.String theme,
                                           int i)
Gets the change view label.

Parameters:
theme - the theme
i - the i
Returns:
the change view label

setChangeViewChecked

public void setChangeViewChecked(boolean b)
Description copied from interface: IChart
Sets the change view checked.

Specified by:
setChangeViewChecked in interface IChart
Parameters:
b - the new change view checked

getPossibleChangePars

public java.util.List getPossibleChangePars()
Description copied from interface: IChart
Gets the possible change pars.

Specified by:
getPossibleChangePars in interface IChart
Returns:
the possible change pars

setChangeViewsParameter

public void setChangeViewsParameter(java.lang.String changePar,
                                    boolean how)
Description copied from interface: IChart
Sets the change views parameter.

Specified by:
setChangeViewsParameter in interface IChart
Parameters:
changePar - the change par
how - the how

getChangeViewParameter

public boolean getChangeViewParameter(java.lang.String changePar)
Description copied from interface: IChart
Gets the change view parameter.

Specified by:
getChangeViewParameter in interface IChart
Parameters:
changePar - the change par
Returns:
the change view parameter

getChangeViewParameterLabel

public java.lang.String getChangeViewParameterLabel(java.lang.String changePar,
                                                    int i)
Description copied from interface: IChart
Gets the change view parameter label.

Specified by:
getChangeViewParameterLabel in interface IChart
Parameters:
changePar - the change par
i - the i
Returns:
the change view parameter label

getColor

public java.awt.Color getColor()
Gets the color.

Returns:
the color

setColor

public void setColor(java.awt.Color color)
Sets the color.

Parameters:
color - the new color

filterDataset

public org.jfree.data.general.Dataset filterDataset(org.jfree.data.general.Dataset dataset,
                                                    java.util.HashMap categories,
                                                    int catSelected,
                                                    int numberCatsVisualization)
Description copied from interface: IChart
Filter dataset.

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

isLegend

public boolean isLegend()
Description copied from interface: IChart
Checks if is legend.

Specified by:
isLegend in interface IChart
Returns:
true, if is legend

setLegend

public void setLegend(boolean legend)
Description copied from interface: IChart
Sets the legend.

Specified by:
setLegend in interface IChart
Parameters:
legend - the new legend

getParametersObject

public java.util.Map getParametersObject()
Description copied from interface: IChart
Gets the parameters object.

Specified by:
getParametersObject in interface IChart
Returns:
the parameters object

setParametersObject

public void setParametersObject(java.util.Map parametersObject)
Description copied from interface: IChart
Sets the parameters object.

Specified by:
setParametersObject in interface IChart
Parameters:
parametersObject - the new parameters object

isFilter

public boolean isFilter()

setFilter

public void setFilter(boolean filter)

isSlider

public boolean isSlider()

getPositionSlider

public java.lang.String getPositionSlider()
Returns:
the positionSlider

setPositionSlider

public void setPositionSlider(java.lang.String positionSlider)
Parameters:
positionSlider - the positionSlider to set

setSlider

public void setSlider(boolean slider)

setTitleParameter

public void setTitleParameter(java.util.List atts)

setSubTitleParameter

public void setSubTitleParameter(java.util.List atts)

setSubTitleParameter

public void setSubTitleParameter(java.lang.String attValue)

setTitleParameter

public void setTitleParameter(java.lang.String attValue)

setStyleTitle

public org.jfree.chart.title.TextTitle setStyleTitle(java.lang.String title,
                                                     StyleLabel titleLabel)

getTitleDimension

public int getTitleDimension()
Specified by:
getTitleDimension in interface IChart

setTitleDimension

public void setTitleDimension(int titleDimension)
Specified by:
setTitleDimension in interface IChart

getSeriesLabels

public java.util.HashMap getSeriesLabels()

setSeriesLabels

public void setSeriesLabels(java.util.HashMap seriesLabels)

getLegendPosition

public java.lang.String getLegendPosition()

setLegendPosition

public void setLegendPosition(java.lang.String legendPosition)

getMultichart

public boolean getMultichart()
Returns:
the multichart

setMultichart

public void setMultichart(boolean multichart)
Parameters:
multichart - the multichart to set

getOrientationMultichart

public java.lang.String getOrientationMultichart()
Returns:
the orientationMultichart

setOrientationMultichart

public void setOrientationMultichart(java.lang.String orientationMultichart)
Parameters:
orientationMultichart - the orientationMultichart to set

drawLegend

public void drawLegend(org.jfree.chart.JFreeChart chart)

setLocalizedTitle

public void setLocalizedTitle()
Specified by:
setLocalizedTitle in interface IChart

isSliderStartFromEnd

public boolean isSliderStartFromEnd()

setSliderStartFromEnd

public void setSliderStartFromEnd(boolean sliderStartFromEnd)

getLocale

public java.util.Locale getLocale()

setLocale

public void setLocale(java.util.Locale locale)