org.knime.base.node.viz.pie.datamodel
Class PieVizModel

java.lang.Object
  extended by org.knime.base.node.viz.pie.datamodel.PieVizModel
Direct Known Subclasses:
FixedPieVizModel, InteractivePieVizModel

public abstract class PieVizModel
extends Object

The abstract pie visualization model which provides the basic data and additional viewing option like the show section outline flag.

Author:
Tobias Koetter, University of Konstanz

Field Summary
static double DEFAULT_EXPLODE_AREA_MARGIN
          The margin of the explode are in percent of the label are rectangle.
static double DEFAULT_PIE_SIZE
          The percentage of the drawing space that should be used for drawing.
static double LABEL_AREA_MARGIN
          The margin of the label area in percent of the drawing space size.
static double MAXIMUM_EXPLODE_SIZE
          The maximum size of the explode margin in percent.
static double MAXIMUM_PIE_SIZE
          The minimum size of the pie drawing space in percent.
static double MINIMUM_ARC_ANGLE
          The default minimum arc angle of a pie section to draw.
static double MINIMUM_EXPLODE_SIZE
          The minimum size of the explode margin in percent.
static double MINIMUM_PIE_SIZE
          The minimum size of the pie drawing space in percent.
static String MISSING_VAL_SECTION_CAPTION
          The caption of the bar which holds all missing values.
static Color MISSING_VAL_SECTION_COLOR
          The caption of the bar which holds all missing values.
 
Constructor Summary
PieVizModel(boolean supportsHiliting, boolean detailsAvailable)
          Constructor for class PieVizModel.
 
Method Summary
 void clearSelection()
          Clear all selections.
 String createLabel(PieSectionDataModel section)
           
 String createLabel(PieSectionDataModel section, PieSubSectionDataModel subSection)
           
 boolean detailsAvailable()
           
 boolean drawAntialias()
           
 boolean drawSectionOutline()
           
 boolean explodeSelectedSections()
           
 double getAbsAggregationValue()
           
abstract  String getAggregationColumnName()
           
 AggregationMethod getAggregationMethod()
           
 PieHiliteCalculator getCalculator()
           
 Dimension getDrawingSpace()
           
 Rectangle2D getExplodedArea()
           
 double getExplodeSize()
           
 String getHTMLDetailData()
           
 Rectangle2D getLabelArea()
           
 LabelDisplayPolicy getLabelDisplayPolicy()
           
 double getLabelLinkSize()
           
protected abstract  PieSectionDataModel getMissingSection()
           
 Rectangle2D getPieArea()
           
 Point getPieCenter()
           
abstract  String getPieColumnName()
           
 double getPieSize()
           
protected abstract  List<PieSectionDataModel> getSections()
           
 List<PieSectionDataModel> getSections2Draw()
          Returns the sections to draw depending on the showMissing and emptySection flags.
 PieSectionDataModel getSelectedElement(Point point)
           
 Set<RowKey> getSelectedKeys()
           
 List<PieSectionDataModel> getSelectedSections()
           
 ValueScale getValueScale()
           
 boolean hasMissingSection()
           
 boolean selectElement(Point point)
          Selects the element which contains the given point.
 boolean selectElement(Rectangle2D rect)
          Selects the element which intersects the given rectangle.
 boolean setAggregationMethod(AggregationMethod aggrMethod)
           
 boolean setDrawAntialias(boolean drawAntialias)
           
 boolean setDrawingSpace(Dimension drawingSpace)
           
 boolean setDrawSectionOutline(boolean drawSectionOutline)
           
 boolean setExplodeSelectedSections(boolean explode)
           
 boolean setExplodeSize(double expSize)
           
 boolean setLabelDisplayPolicy(LabelDisplayPolicy labelDisplayPolicy)
           
 boolean setPieSize(double pieSize)
           
 boolean setShowDetails(boolean showDetails)
           
 boolean setShowMissingValSection(boolean showMissingValSection)
           
 void setValueScale(ValueScale scale)
           
 boolean showDetails()
           
 boolean showMissingValSection()
           
 boolean supportsHiliting()
           
 void unHiliteAll()
          Unhilites all sections.
 void updateHiliteInfo(Set<RowKey> keys, boolean hilite)
          Hilites the given keys in all sections.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MISSING_VAL_SECTION_CAPTION

public static final String MISSING_VAL_SECTION_CAPTION
The caption of the bar which holds all missing values.

See Also:
Constant Field Values

MISSING_VAL_SECTION_COLOR

public static final Color MISSING_VAL_SECTION_COLOR
The caption of the bar which holds all missing values.


DEFAULT_PIE_SIZE

public static final double DEFAULT_PIE_SIZE
The percentage of the drawing space that should be used for drawing. (0.9 = 90 percent)

See Also:
Constant Field Values

MAXIMUM_PIE_SIZE

public static final double MAXIMUM_PIE_SIZE
The minimum size of the pie drawing space in percent. (0.3 = 30 percent).

See Also:
Constant Field Values

MINIMUM_PIE_SIZE

public static final double MINIMUM_PIE_SIZE
The minimum size of the pie drawing space in percent. (0.3 = 30 percent).

See Also:
Constant Field Values

LABEL_AREA_MARGIN

public static final double LABEL_AREA_MARGIN
The margin of the label area in percent of the drawing space size. (0.2 = 20 percent).

See Also:
Constant Field Values

DEFAULT_EXPLODE_AREA_MARGIN

public static final double DEFAULT_EXPLODE_AREA_MARGIN
The margin of the explode are in percent of the label are rectangle. (0.2 = 20 percent)

See Also:
Constant Field Values

MINIMUM_EXPLODE_SIZE

public static final double MINIMUM_EXPLODE_SIZE
The minimum size of the explode margin in percent. (0.9 = 90%)

See Also:
Constant Field Values

MAXIMUM_EXPLODE_SIZE

public static final double MAXIMUM_EXPLODE_SIZE
The maximum size of the explode margin in percent. (0.9 = 90%)

See Also:
Constant Field Values

MINIMUM_ARC_ANGLE

public static final double MINIMUM_ARC_ANGLE
The default minimum arc angle of a pie section to draw.

See Also:
Constant Field Values
Constructor Detail

PieVizModel

public PieVizModel(boolean supportsHiliting,
                   boolean detailsAvailable)
Constructor for class PieVizModel.

Parameters:
supportsHiliting - true if hiliting should be supported
detailsAvailable - true if details are available
Method Detail

detailsAvailable

public boolean detailsAvailable()
Returns:
true if at least one section contains more than one sub section.

getPieColumnName

public abstract String getPieColumnName()
Returns:
the name of the pie column

getAggregationColumnName

public abstract String getAggregationColumnName()
Returns:
the optional name of the aggregation column

getSections

protected abstract List<PieSectionDataModel> getSections()
Returns:
all data sections

getMissingSection

protected abstract PieSectionDataModel getMissingSection()
Returns:
the missing value data section which could be empty

getCalculator

public PieHiliteCalculator getCalculator()
Returns:
the hilite shape calculator

getValueScale

public ValueScale getValueScale()
Returns:
the value scale to use

setValueScale

public void setValueScale(ValueScale scale)
Parameters:
scale - the value scale to use

setPieSize

public boolean setPieSize(double pieSize)
Parameters:
pieSize - the pieSize in percent of the drawing space. (0.9 = 90 percent)
Returns:
true if the size has changed

getPieSize

public double getPieSize()
Returns:
the size of the pie in percent of the drawing space (0.9 = 90 percent)

setExplodeSize

public boolean setExplodeSize(double expSize)
Parameters:
expSize - the explode size in percent of the drawing space (0.9 = 90%)
Returns:
true if the size has changed

getExplodeSize

public double getExplodeSize()
Returns:
the explode size in percent of the drawing space (0.9 = 90%)

setLabelDisplayPolicy

public boolean setLabelDisplayPolicy(LabelDisplayPolicy labelDisplayPolicy)
Parameters:
labelDisplayPolicy - the label display policy
Returns:
true if the property has changed

getLabelDisplayPolicy

public LabelDisplayPolicy getLabelDisplayPolicy()
Returns:
the label display policy to use

showMissingValSection

public boolean showMissingValSection()
Returns:
true if a section with the missing values should be displayed

setShowMissingValSection

public boolean setShowMissingValSection(boolean showMissingValSection)
Parameters:
showMissingValSection - true if the missing value section should be displayed if it's available
Returns:
true if the property has changed

setShowDetails

public boolean setShowDetails(boolean showDetails)
Parameters:
showDetails - true if also the sub sections should be displayed
Returns:
true if the property has changed

showDetails

public boolean showDetails()
Returns:
true if the sub sections of a section should be displayed

setDrawSectionOutline

public boolean setDrawSectionOutline(boolean drawSectionOutline)
Parameters:
drawSectionOutline - true if the section outline should be drawn
Returns:
true if the property has changed

drawSectionOutline

public boolean drawSectionOutline()
Returns:
true if the section outline should be drawn

setExplodeSelectedSections

public boolean setExplodeSelectedSections(boolean explode)
Parameters:
explode - true if selected sections should be exploded drawn
Returns:
true if the property has changed

explodeSelectedSections

public boolean explodeSelectedSections()
Returns:
true if selected section should be exploded drawn

setDrawAntialias

public boolean setDrawAntialias(boolean drawAntialias)
Parameters:
drawAntialias - true if the shapes should be drawn using antialiasing
Returns:
true if the property has changed

drawAntialias

public boolean drawAntialias()
Returns:
true if the shapes should be drawn using antialiasing

getAggregationMethod

public AggregationMethod getAggregationMethod()
Returns:
the actual AggregationMethod

setAggregationMethod

public boolean setAggregationMethod(AggregationMethod aggrMethod)
Parameters:
aggrMethod - the aggrMethod to set
Returns:
true if the method has changed

getSections2Draw

public List<PieSectionDataModel> getSections2Draw()
Returns the sections to draw depending on the showMissing and emptySection flags.

Returns:
all sections to draw as a unmodifiable List

hasMissingSection

public boolean hasMissingSection()
Returns:
true if this model contains a missing section

getDrawingSpace

public Dimension getDrawingSpace()
Returns:
the size of the available drawing space

setDrawingSpace

public boolean setDrawingSpace(Dimension drawingSpace)
Parameters:
drawingSpace - the drawingSpace to set
Returns:
true if the parameter has changed

getLabelArea

public Rectangle2D getLabelArea()
Returns:
the Rectangle2D that defines the maximum surrounding of the label area which includes the getExplodedArea()

getExplodedArea

public Rectangle2D getExplodedArea()
Returns:
the Rectangle2D that defines the maximum surrounding of the exploded sections which includes the getPieArea() rectangle

getPieArea

public Rectangle2D getPieArea()
Returns:
the Rectangle2D to draw the pie in which is surrounded by the getExplodedArea() rectangle which in turn is surrounded by the getLabelArea() rectangle.

getPieCenter

public Point getPieCenter()
Returns:
the center point of the pie

getLabelLinkSize

public double getLabelLinkSize()
Returns:
the size of the label links

getAbsAggregationValue

public double getAbsAggregationValue()
Returns:
the total absolute aggregation value of the sections to draw

updateHiliteInfo

public void updateHiliteInfo(Set<RowKey> keys,
                             boolean hilite)
Hilites the given keys in all sections.

Parameters:
keys - the keys to (un)hilite
hilite - true if the keys should be hilited

unHiliteAll

public void unHiliteAll()
Unhilites all sections.


getSelectedKeys

public Set<RowKey> getSelectedKeys()
Returns:
the keys of all selected sections

clearSelection

public void clearSelection()
Clear all selections.


getSelectedElement

public PieSectionDataModel getSelectedElement(Point point)
Parameters:
point - the point to check for selection
Returns:
the element that contains the selected point or null if none is selected

selectElement

public boolean selectElement(Point point)
Selects the element which contains the given point.

Parameters:
point - the point on the screen to select
Returns:
true if the selection has changed

selectElement

public boolean selectElement(Rectangle2D rect)
Selects the element which intersects the given rectangle.

Parameters:
rect - the rectangle on the screen to select
Returns:
true if the selection has changed

supportsHiliting

public boolean supportsHiliting()
Returns:
true if hiliting is supported

createLabel

public String createLabel(PieSectionDataModel section)
Parameters:
section - the section to create the label for
Returns:
the label of this section depending on the visualization flags

createLabel

public String createLabel(PieSectionDataModel section,
                          PieSubSectionDataModel subSection)
Parameters:
section - the main section
subSection - the sub section of interest
Returns:
the label for the sub section including some section information

getHTMLDetailData

public String getHTMLDetailData()
Returns:
the HTML String with the detail information of the selected section

getSelectedSections

public List<PieSectionDataModel> getSelectedSections()
Returns:
a List of all selected p


Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.