JRubik v0.6

es.aeat.eett.plugins.chart
Class ChartComponent

java.lang.Object
  extended byes.aeat.eett.plugins.chart.ChartComponent
All Implemented Interfaces:
java.util.EventListener, com.tonbeller.jpivot.core.ModelChangeListener

public class ChartComponent
extends java.lang.Object
implements com.tonbeller.jpivot.core.ModelChangeListener

Contains a reference to an OlapModel. Produces a chart image.


Nested Class Summary
 class ChartComponent.jpivotCategoryURLGenerator
          A URLGenerator class to generate chart urls that work with jpivot
 class ChartComponent.jpivotPieURLGenerator
          A URLGenerator class to generate pie urls that work with jpivot
 
Field Summary
(package private)  java.awt.Font axisFont
           
(package private)  java.lang.String axisFontName
           
(package private)  int axisFontSize
           
(package private)  int axisFontStyle
           
(package private)  java.awt.Font axisTickFont
           
(package private)  java.lang.String axisTickFontName
           
(package private)  int axisTickFontSize
           
(package private)  int axisTickFontStyle
           
(package private)  java.awt.Color backgroundColor
           
(package private)  int bgColorB
           
(package private)  int bgColorG
           
(package private)  int bgColorR
           
(package private)  java.util.Iterator cellIterator
           
(package private)  java.lang.String CHART_SERVLET
           
(package private)  java.lang.String CHART_SERVLET_KEY
           
(package private)  int chartHeight
           
(package private)  java.lang.String chartTitle
           
(package private)  int chartType
           
(package private)  int chartWidth
           
(package private)  int colCount
           
(package private)  int dimCount
           
(package private)  boolean dirty
           
(package private)  org.w3c.dom.Document document
           
(package private)  boolean drillThroughEnabled
           
(package private)  java.lang.String filename
           
(package private)  java.lang.String fontName
           
(package private)  int fontSize
           
(package private)  int fontStyle
           
(package private)  java.lang.String horizAxisLabel
           
(package private)  org.jfree.chart.ChartRenderingInfo info
           
(package private)  java.awt.Font legendFont
           
(package private)  java.lang.String legendFontName
           
(package private)  int legendFontSize
           
(package private)  int legendFontStyle
           
(package private)  int legendPosition
           
(package private)  java.util.Locale locale
           
private static org.apache.log4j.Logger logger
           
(package private)  com.tonbeller.jpivot.olap.model.OlapModel olapModel
           
(package private)  java.lang.String ref
           
(package private)  com.tonbeller.jpivot.olap.model.Result result
           
(package private)  org.w3c.dom.Element rootElement
           
(package private)  boolean showLegend
           
(package private)  boolean showSlicer
           
(package private)  boolean showTooltips
           
(package private)  int slicerAlignment
           
(package private)  java.awt.Font slicerFont
           
(package private)  java.lang.String slicerFontName
           
(package private)  int slicerFontSize
           
(package private)  int slicerFontStyle
           
(package private)  int slicerPosition
           
(package private)  int tickLabelRotate
           
(package private)  java.awt.Font titleFont
           
(package private)  java.lang.String vertAxisLabel
           
 
Constructor Summary
ChartComponent()
          Constructor
 
Method Summary
 org.jfree.chart.JFreeChart build()
          Entry point for producing charts, called by wcf render tag.
private  org.jfree.data.category.DefaultCategoryDataset build1dimDataset()
          Build a jfreechart CategoryDataset with a single series
private  org.jfree.data.category.DefaultCategoryDataset build2dimDataset()
          Build a jfreechart CategoryDataset with multiple series
private  java.lang.String buildSlicer()
          build slicer text string
protected  boolean canDrillThrough(com.tonbeller.jpivot.olap.model.Cell cell)
           
private  int checkRGB(int v)
          Enforce limits of 0 - 255 for RGB values.
private  void configure()
           
 java.lang.String getAxisFontName()
           
 int getAxisFontSize()
           
 int getAxisFontStyle()
           
 java.lang.String getAxisTickFontName()
           
 int getAxisTickFontSize()
           
 int getAxisTickFontStyle()
           
 int getBgColorB()
           
 int getBgColorG()
           
 int getBgColorR()
           
 int getChartHeight()
           
 java.lang.String getChartTitle()
           
 int getChartType()
           
 int getChartWidth()
           
 int getColCount()
           
 java.lang.String getFontName()
           
 int getFontSize()
           
 int getFontStyle()
           
 java.lang.String getHorizAxisLabel()
           
 java.lang.String getLegendFontName()
           
 int getLegendFontSize()
           
 int getLegendFontStyle()
           
 int getLegendPosition()
           
private  java.lang.Number getNumberValue(com.tonbeller.jpivot.olap.model.Cell cell)
          Get cell value as a Number.
static javax.xml.parsers.DocumentBuilder getParser()
           
 boolean getShowLegend()
           
 int getSlicerAlignment()
           
 java.lang.String getSlicerFontName()
           
 int getSlicerFontSize()
           
 int getSlicerFontStyle()
           
 int getSlicerPosition()
           
 java.lang.String getVertAxisLabel()
           
 boolean isDirty()
          true means that render() will create a new chart
 boolean isDrillThroughEnabled()
           
 boolean isShowSlicer()
           
 void modelChanged(com.tonbeller.jpivot.core.ModelChangeEvent e)
           
 org.w3c.dom.Document render(org.jfree.chart.ChartPanel paneChart, java.lang.String nameFileOutXml, java.lang.String nameFileOutPng)
           
 void setAxisFontName(java.lang.String axisFontName)
           
 void setAxisFontSize(int axisFontSize)
           
 void setAxisFontStyle(int axisFontStyle)
           
 void setAxisTickFontName(java.lang.String axisTickFontName)
           
 void setAxisTickFontSize(int axisTickFontSize)
           
 void setAxisTickFontStyle(int axisTickFontStyle)
           
 void setBgColorB(int bgColorB)
           
 void setBgColorG(int bgColorG)
           
 void setBgColorR(int bgColorR)
           
 void setChartHeight(int chartHeight)
           
 void setChartTitle(java.lang.String chartTitle)
           
 void setChartType(int chartType)
           
 void setChartWidth(int chartWidth)
           
 void setDirty(boolean dirty)
           
 void setDrillThroughEnabled(boolean drillThroughEnabled)
           
 void setFontName(java.lang.String fontname)
           
 void setFontSize(int fontSize)
           
 void setFontStyle(int fontStyle)
           
 void setHorizAxisLabel(java.lang.String axisLabel)
           
 void setLegendFontName(java.lang.String legendFontName)
           
 void setLegendFontSize(int legendFontSize)
           
 void setLegendFontStyle(int legendFontStyle)
           
 void setLegendPosition(int legendPosition)
           
 void setShowLegend(boolean showLegend)
           
 void setShowSlicer(boolean showSlicer)
           
 void setSlicerAlignment(int slicerAlignment)
           
 void setSlicerFontName(java.lang.String slicerFontName)
           
 void setSlicerFontSize(int slicerFontSize)
           
 void setSlicerFontStyle(int slicerFontStyle)
           
 void setSlicerPosition(int slicerPosition)
           
 void setVertAxisLabel(java.lang.String axisLabel)
           
 void structureChanged(com.tonbeller.jpivot.core.ModelChangeEvent e)
           
 java.lang.String writeImageMap(java.lang.String name, org.jfree.chart.ChartRenderingInfo info, boolean useOverLibForToolTips)
          Writes an image map as a String This function has been requested to be added to jfreechart Also requires slight change to ChartEntity.getImageMapAreaTag() to produce valid xml tag and use & entity in urls.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static org.apache.log4j.Logger logger

ref

java.lang.String ref

document

org.w3c.dom.Document document

olapModel

com.tonbeller.jpivot.olap.model.OlapModel olapModel

dirty

boolean dirty

locale

java.util.Locale locale

result

com.tonbeller.jpivot.olap.model.Result result

cellIterator

java.util.Iterator cellIterator

dimCount

int dimCount

rootElement

org.w3c.dom.Element rootElement

colCount

int colCount

CHART_SERVLET

java.lang.String CHART_SERVLET

CHART_SERVLET_KEY

final java.lang.String CHART_SERVLET_KEY
See Also:
Constant Field Values

filename

java.lang.String filename

chartTitle

java.lang.String chartTitle

titleFont

java.awt.Font titleFont

fontName

java.lang.String fontName

fontStyle

int fontStyle

fontSize

int fontSize

slicerFont

java.awt.Font slicerFont

slicerFontName

java.lang.String slicerFontName

slicerFontStyle

int slicerFontStyle

slicerFontSize

int slicerFontSize

axisFont

java.awt.Font axisFont

axisFontName

java.lang.String axisFontName

axisFontStyle

int axisFontStyle

axisFontSize

int axisFontSize

axisTickFont

java.awt.Font axisTickFont

axisTickFontName

java.lang.String axisTickFontName

axisTickFontStyle

int axisTickFontStyle

axisTickFontSize

int axisTickFontSize

legendFont

java.awt.Font legendFont

legendFontName

java.lang.String legendFontName

legendFontStyle

int legendFontStyle

legendFontSize

int legendFontSize

legendPosition

int legendPosition

slicerPosition

int slicerPosition

slicerAlignment

int slicerAlignment

backgroundColor

java.awt.Color backgroundColor

bgColorR

int bgColorR

bgColorG

int bgColorG

bgColorB

int bgColorB

chartType

int chartType

chartHeight

int chartHeight

chartWidth

int chartWidth

horizAxisLabel

java.lang.String horizAxisLabel

vertAxisLabel

java.lang.String vertAxisLabel

showLegend

boolean showLegend

showSlicer

boolean showSlicer

showTooltips

boolean showTooltips

drillThroughEnabled

boolean drillThroughEnabled

info

org.jfree.chart.ChartRenderingInfo info

tickLabelRotate

int tickLabelRotate
Constructor Detail

ChartComponent

public ChartComponent()
Constructor

Method Detail

configure

private void configure()

build

public org.jfree.chart.JFreeChart build()
                                 throws java.lang.Exception
Entry point for producing charts, called by wcf render tag. Produces a jfreechart dataset from olap model, then creates a chart and writes it to the servlet container temp directory. Returns a DOM document for Renderer to transform into html. Requires that jfreechart servlet is installed in this application context.

Throws:
java.lang.Exception

render

public org.w3c.dom.Document render(org.jfree.chart.ChartPanel paneChart,
                                   java.lang.String nameFileOutXml,
                                   java.lang.String nameFileOutPng)
                            throws java.lang.Exception
Throws:
java.lang.Exception

getParser

public static javax.xml.parsers.DocumentBuilder getParser()

writeImageMap

public java.lang.String writeImageMap(java.lang.String name,
                                      org.jfree.chart.ChartRenderingInfo info,
                                      boolean useOverLibForToolTips)
Writes an image map as a String This function has been requested to be added to jfreechart Also requires slight change to ChartEntity.getImageMapAreaTag() to produce valid xml tag and use & entity in urls. Diffs sent to jfreechart project - so hopefully this will be in there soon

Parameters:
name - the map name.
info - the chart rendering info.
useOverLibForToolTips - whether to use OverLIB for tooltips (http://www.bosrup.com/web/overlib/).

buildSlicer

private java.lang.String buildSlicer()
build slicer text string


build1dimDataset

private org.jfree.data.category.DefaultCategoryDataset build1dimDataset()
Build a jfreechart CategoryDataset with a single series


getNumberValue

private java.lang.Number getNumberValue(com.tonbeller.jpivot.olap.model.Cell cell)
Get cell value as a Number. Parses the cell value string using the locale set in this.locale.

Parameters:
cell -
Returns:
value as Number (can be null)

build2dimDataset

private org.jfree.data.category.DefaultCategoryDataset build2dimDataset()
Build a jfreechart CategoryDataset with multiple series


getColCount

public int getColCount()
Returns:
int

isDirty

public boolean isDirty()
true means that render() will create a new chart


setDirty

public void setDirty(boolean dirty)

modelChanged

public void modelChanged(com.tonbeller.jpivot.core.ModelChangeEvent e)
Specified by:
modelChanged in interface com.tonbeller.jpivot.core.ModelChangeListener

structureChanged

public void structureChanged(com.tonbeller.jpivot.core.ModelChangeEvent e)
Specified by:
structureChanged in interface com.tonbeller.jpivot.core.ModelChangeListener

getChartHeight

public int getChartHeight()
Returns:
int

setChartHeight

public void setChartHeight(int chartHeight)
Parameters:
chartHeight -

getChartTitle

public java.lang.String getChartTitle()
Returns:
String

setChartTitle

public void setChartTitle(java.lang.String chartTitle)
Parameters:
chartTitle -

getChartType

public int getChartType()
Returns:
int

setChartType

public void setChartType(int chartType)
Parameters:
chartType -

getChartWidth

public int getChartWidth()
Returns:
int

setChartWidth

public void setChartWidth(int chartWidth)
Parameters:
chartWidth -

getHorizAxisLabel

public java.lang.String getHorizAxisLabel()
Returns:
String

setHorizAxisLabel

public void setHorizAxisLabel(java.lang.String axisLabel)
Parameters:
axisLabel -

getShowLegend

public boolean getShowLegend()
Returns:
boolean

setShowLegend

public void setShowLegend(boolean showLegend)
Parameters:
showLegend -

getFontName

public java.lang.String getFontName()
Returns:
String

setFontName

public void setFontName(java.lang.String fontname)
Parameters:
fontname -

getVertAxisLabel

public java.lang.String getVertAxisLabel()
Returns:
String

setVertAxisLabel

public void setVertAxisLabel(java.lang.String axisLabel)
Parameters:
axisLabel -

getFontSize

public int getFontSize()
Returns:
int

setFontSize

public void setFontSize(int fontSize)
Parameters:
fontSize -

getFontStyle

public int getFontStyle()
Returns:
int

setFontStyle

public void setFontStyle(int fontStyle)
Parameters:
fontStyle -

getBgColorB

public int getBgColorB()
Returns:
int

setBgColorB

public void setBgColorB(int bgColorB)
Parameters:
bgColorB -

getBgColorG

public int getBgColorG()
Returns:
int

setBgColorG

public void setBgColorG(int bgColorG)
Parameters:
bgColorG -

getBgColorR

public int getBgColorR()
Returns:
int

setBgColorR

public void setBgColorR(int bgColorR)
Parameters:
bgColorR -

checkRGB

private int checkRGB(int v)
Enforce limits of 0 - 255 for RGB values.


canDrillThrough

protected boolean canDrillThrough(com.tonbeller.jpivot.olap.model.Cell cell)

isDrillThroughEnabled

public boolean isDrillThroughEnabled()

setDrillThroughEnabled

public void setDrillThroughEnabled(boolean drillThroughEnabled)

getAxisFontName

public java.lang.String getAxisFontName()
Returns:
String

setAxisFontName

public void setAxisFontName(java.lang.String axisFontName)
Parameters:
axisFontName -

getAxisFontSize

public int getAxisFontSize()
Returns:
int

setAxisFontSize

public void setAxisFontSize(int axisFontSize)
Parameters:
axisFontSize -

getAxisFontStyle

public int getAxisFontStyle()
Returns:
int

setAxisFontStyle

public void setAxisFontStyle(int axisFontStyle)
Parameters:
axisFontStyle -

getLegendFontName

public java.lang.String getLegendFontName()
Returns:
int

setLegendFontName

public void setLegendFontName(java.lang.String legendFontName)
Parameters:
legendFontName -

getLegendFontSize

public int getLegendFontSize()
Returns:
int

setLegendFontSize

public void setLegendFontSize(int legendFontSize)
Parameters:
legendFontSize -

getLegendFontStyle

public int getLegendFontStyle()
Returns:
int

setLegendFontStyle

public void setLegendFontStyle(int legendFontStyle)
Parameters:
legendFontStyle -

getSlicerAlignment

public int getSlicerAlignment()
Returns:
int

setSlicerAlignment

public void setSlicerAlignment(int slicerAlignment)
Parameters:
slicerAlignment -

getSlicerFontName

public java.lang.String getSlicerFontName()
Returns:
String

setSlicerFontName

public void setSlicerFontName(java.lang.String slicerFontName)
Parameters:
slicerFontName -

getSlicerFontSize

public int getSlicerFontSize()
Returns:
int

setSlicerFontSize

public void setSlicerFontSize(int slicerFontSize)
Parameters:
slicerFontSize -

getSlicerFontStyle

public int getSlicerFontStyle()
Returns:
int

setSlicerFontStyle

public void setSlicerFontStyle(int slicerFontStyle)
Parameters:
slicerFontStyle -

getSlicerPosition

public int getSlicerPosition()
Returns:
int

setSlicerPosition

public void setSlicerPosition(int slicerPosition)
Parameters:
slicerPosition -

getLegendPosition

public int getLegendPosition()
Returns:
int

setLegendPosition

public void setLegendPosition(int legendPosition)
Parameters:
legendPosition -

getAxisTickFontName

public java.lang.String getAxisTickFontName()
Returns:
String

setAxisTickFontName

public void setAxisTickFontName(java.lang.String axisTickFontName)
Parameters:
axisTickFontName -

getAxisTickFontSize

public int getAxisTickFontSize()
Returns:
int

setAxisTickFontSize

public void setAxisTickFontSize(int axisTickFontSize)
Parameters:
axisTickFontSize -

getAxisTickFontStyle

public int getAxisTickFontStyle()
Returns:
int

setAxisTickFontStyle

public void setAxisTickFontStyle(int axisTickFontStyle)
Parameters:
axisTickFontStyle -

isShowSlicer

public boolean isShowSlicer()

setShowSlicer

public void setShowSlicer(boolean showSlicer)
Parameters:
showSlicer -

JRubik v0.6

JRubik v0.6