JIDE 3.5.15

com.jidesoft.chart.render
Class RaisedBarRenderer

java.lang.Object
  extended by com.jidesoft.chart.render.AbstractRenderer
      extended by com.jidesoft.chart.render.AbstractBarRenderer
          extended by com.jidesoft.chart.render.RaisedBarRenderer
All Implemented Interfaces:
BarRenderer, BarRenderer2D

public class RaisedBarRenderer
extends AbstractBarRenderer
implements BarRenderer2D

A Bar Renderer that makes the bar appear to be raised out of the screen like a candy bar.

This renderer takes account of negative heights. If a negative height is supplied, then the y coordinate and height are adjusted so that the height becomes positive and the shape is paintable.

NOTE: Widths are currently assumed to be positive


Field Summary
 
Fields inherited from class com.jidesoft.chart.render.AbstractRenderer
alwaysShowOutlines, PROPERTY_OUTLINE_WIDTH, ROLLOVER_INTENSITY, support
 
Constructor Summary
RaisedBarRenderer()
           
RaisedBarRenderer(int edgeSize)
          Create a RaisedBarRenderer using the supplied edge size
 
Method Summary
protected  Paint createBottomPaint(Orientation orientation, Color color, int x, int y, int width, int edgeSize)
          Create a Paint to use for the bottom part of the bar
protected  Paint createLeftPaint(Orientation orientation, Color color, int x, int y, int width, int edgeSize)
          Create a Paint to use for the left part of the bar
protected  Paint createLowerTopPaint(Orientation orientation, Color color, int x, int y, int width, int edgeSize)
          Create a Paint to use for the lower half of the top of the bar
protected  Paint createRightPaint(Orientation orientation, Color color, int x, int y, int width, int edgeSize)
          Create a Paint to use for the right part of the bar
protected  Paint createUpperTopPaint(Orientation orientation, Color color, int x, int y, int width, int edgeSize)
          Create a Paint to use for the upper half of the top of the bar
 int getEdgeSize()
           
 int getMinimumBreadth()
           
 Shape renderBar(Graphics2D g, Chart chart, ChartModel m, Chartable p, boolean isSelected, boolean hasRollover, boolean hasFocus, double x, double y, double width, double height)
          There is one call to this method for each bar to be rendered in a bar chart.
 Shape renderBar(Graphics g, Chart chart, ChartModel m, Chartable p, boolean isSelected, boolean hasRollover, boolean hasFocus, int x, int y, int width, int height)
          There is one call to this method for each bar to be rendered in a bar chart.
 void setEdgeSize(int edgeSize)
          Specify the size, in pixels, of the edge effect that gives the raised bars their 'candy bar' appearance.
 
Methods inherited from class com.jidesoft.chart.render.AbstractBarRenderer
computeLabel, createBarPaint, getBarColor, getLabelStyle, getPointLabeler, isLabelsVisible, isZeroHeightBarsVisible, renderBarLabel, setLabelStyle, setLabelsVisible, setPointLabeler, setZeroHeightBarsVisible
 
Methods inherited from class com.jidesoft.chart.render.AbstractRenderer
addPropertyChangeListener, getOutlineColor, getOutlineWidth, getSelectionColor, isAlwaysShowOutlines, removePropertyChangeListener, setAlwaysShowOutlines, setOutlineColor, setOutlineWidth, setSelectionColor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RaisedBarRenderer

public RaisedBarRenderer()

RaisedBarRenderer

public RaisedBarRenderer(int edgeSize)
Create a RaisedBarRenderer using the supplied edge size

Parameters:
edgeSize - the edge size for the raised effect
Method Detail

getEdgeSize

public int getEdgeSize()
Returns:
the size of the edge effect, in pixels, that gives bars their 'candy bar' appearance

setEdgeSize

public void setEdgeSize(int edgeSize)
Specify the size, in pixels, of the edge effect that gives the raised bars their 'candy bar' appearance. By default, this is 20 pixels, but you may want to set it to a smaller value if you have narrow bars.

Parameters:
edgeSize - the new edge size

renderBar

public Shape renderBar(Graphics2D g,
                       Chart chart,
                       ChartModel m,
                       Chartable p,
                       boolean isSelected,
                       boolean hasRollover,
                       boolean hasFocus,
                       double x,
                       double y,
                       double width,
                       double height)
There is one call to this method for each bar to be rendered in a bar chart.

Specified by:
renderBar in interface BarRenderer2D
Parameters:
g - the graphics context onto which the bar is drawn
chart - the chart object
m - the chart model from which the bar/point comes
p - the point of the model corresponding to the bar
isSelected - whether the bar is currently selected
hasRollover - whether the bar currently is under the mouse cursor
hasFocus - whether the bar currently has focus (not yet supported)
x - the x pixel coordinate for the top left of the bar
y - the y pixel coordinate for the top left of the bar
width - the width of the bar in pixels
height - the height of the bar in pixels

renderBar

public Shape renderBar(Graphics g,
                       Chart chart,
                       ChartModel m,
                       Chartable p,
                       boolean isSelected,
                       boolean hasRollover,
                       boolean hasFocus,
                       int x,
                       int y,
                       int width,
                       int height)
There is one call to this method for each bar to be rendered in a bar chart.

Specified by:
renderBar in interface BarRenderer
Parameters:
g - the graphics context onto which the bar is drawn
chart - the chart object
m - the chart model from which the bar/point comes
p - the point of the model corresponding to the bar
isSelected - whether the bar is currently selected
hasRollover - whether the bar currently is under the mouse cursor
hasFocus - whether the bar currently has focus (not yet supported)
x - the x pixel coordinate for the top left of the bar
y - the y pixel coordinate for the top left of the bar
width - the width of the bar in pixels
height - the height of the bar in pixels

createUpperTopPaint

protected Paint createUpperTopPaint(Orientation orientation,
                                    Color color,
                                    int x,
                                    int y,
                                    int width,
                                    int edgeSize)
Create a Paint to use for the upper half of the top of the bar


createLowerTopPaint

protected Paint createLowerTopPaint(Orientation orientation,
                                    Color color,
                                    int x,
                                    int y,
                                    int width,
                                    int edgeSize)
Create a Paint to use for the lower half of the top of the bar


createBottomPaint

protected Paint createBottomPaint(Orientation orientation,
                                  Color color,
                                  int x,
                                  int y,
                                  int width,
                                  int edgeSize)
Create a Paint to use for the bottom part of the bar


createLeftPaint

protected Paint createLeftPaint(Orientation orientation,
                                Color color,
                                int x,
                                int y,
                                int width,
                                int edgeSize)
Create a Paint to use for the left part of the bar


createRightPaint

protected Paint createRightPaint(Orientation orientation,
                                 Color color,
                                 int x,
                                 int y,
                                 int width,
                                 int edgeSize)
Create a Paint to use for the right part of the bar


getMinimumBreadth

public int getMinimumBreadth()
Specified by:
getMinimumBreadth in interface BarRenderer
Specified by:
getMinimumBreadth in interface BarRenderer2D

JIDE 3.5.15