Package org.eclipse.birt.chart.render
Class BaseRenderer
- java.lang.Object
-
- org.eclipse.birt.chart.render.BaseRenderer
-
- All Implemented Interfaces:
ISeriesRenderer
- Direct Known Subclasses:
AxesRenderer
,EmptyWithoutAxes
public abstract class BaseRenderer extends java.lang.Object implements ISeriesRenderer
Provides a generic framework that initiates the rendering sequence of the various chart components. Series type extensions could subclass this class if they plan on rendering everything for themselves in the plot area.
-
-
Constructor Summary
Constructors Constructor Description BaseRenderer()
The internal constructor that must be defined as public
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description IAxesDecorator
getAxesDecorator(OneAxis ax)
Returns the decorator renderer associated with current series, default is none.PlotComputation
getComputations()
DeferredCache
getDeferredCache()
DeferredCacheManager
getDeferredCacheManager()
ReturnsDeferredCacheManager
instance.IDeviceRenderer
getDevice()
double
getDeviceScale()
java.util.Collection<java.lang.Integer>
getFilteredMinSliceEntry(DataSetIterator dsi)
Returns if the corresponding category entry is filtered as minslice in legend.Chart
getModel()
BaseRenderer
getRenderer(int iIndex)
Provides access to any other renderer in the group that participates in chart renderingRunTimeContext
getRunTimeContext()
Series
getSeries()
int
getSeriesCount()
SeriesDefinition
getSeriesDefinition()
int
getSeriesIndex()
Identifies the series sequence # in the list of series renders(start from 0).ISeriesRenderingHints
getSeriesRenderingHints()
static double
getX(Location[] loa, int iProperty)
Finds particular X value from given location list.IDisplayServer
getXServer()
static double
getY(Location[] loa, int iProperty)
Finds particular Y value from given location list.static BaseRenderer[]
instances(Chart cm, RunTimeContext rtc, PlotComputation oComputations)
This method returns appropriate renders for the given chart model.boolean
isInteractivityEnabled()
Returns if interactivity is enabled on the model.boolean
isRightToLeft()
Returns if the right-left mode is enabled.boolean
isTransposed()
Returns if current chart is transposed.void
processTrigger(Trigger tg, StructureSource source)
post-process the triggers.void
render(java.util.Map<Series,LegendItemRenderingHints> htRenderers, Bounds bo)
Renders all blocks using the appropriate block z-order and the containment hierarchy.void
renderLabel(java.lang.Object oSource, int iTextRenderType, Label laDataPoint, Position lp, Location lo, Bounds bo)
This convenience method renders the data point label along with the shadow If there's a need to render the data point label and the shadow separately, each call should be made separately by calling into the primitive rendering interface directly.void
renderLabel(java.lang.Object oSource, int iTextRenderType, Label laDataPoint, Position lp, Location lo, Bounds bo, DeferredCache _dc)
Renderer label with specifiedDeferredCache
.void
renderLabel(IPrimitiveRenderer ipr, Block b, java.lang.Object oSource)
Renders label of a LabelBlock.void
renderLegend(IPrimitiveRenderer ipr, Legend lg, java.util.Map<Series,LegendItemRenderingHints> htRenderers)
Renders the legend block based on the legend rendering rules.void
renderPlot(IPrimitiveRenderer ipr, Plot p)
Renders the Plotvoid
renderTitle(IPrimitiveRenderer ipr, TitleBlock b)
Renders the Chart Title Blockvoid
set(IDeviceRenderer _ir)
Sets the device renderer for current renderer.void
set(IDisplayServer _xs)
Sets the diplay server for current renderer.void
set(RunTimeContext _rtc)
Sets the runtime context object for current renderer.void
set(Chart _cm, PlotComputation _oComputation, Series _se, SeriesDefinition _sd)
Sets the context information for current renderer.void
set(BaseRenderer[] _brna)
Sets all associated renderers used for current chart rendering.void
set(DeferredCache _dc)
Sets the deferred cache used by current renderer.void
set(ISeriesRenderingHints _srh)
Sets the series rendering hints for current renderer.void
setDeferredCacheManager(DeferredCacheManager dcm)
Set currentDeferredCacheManager
instance.Anchor
switchAnchor(Anchor anchor)
Switch Anchor value due to right-left setting.Position
switchPosition(Position po)
Switch Position value due to right-left setting.TextAlignment
switchTextAlignment(TextAlignment ta)
Switch TextAlignment value due to right-left setting.void
updateTranslucency(Fill fill, Series se)
Updates the tranlucency of the fill according to series setting.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.birt.chart.render.ISeriesRenderer
compute, renderLegendGraphic, renderSeries
-
-
-
-
Method Detail
-
set
public void set(Chart _cm, PlotComputation _oComputation, Series _se, SeriesDefinition _sd)
Sets the context information for current renderer.- Parameters:
_cm
-_o
-_se
-_ax
-_sd
-
-
set
public void set(DeferredCache _dc)
Sets the deferred cache used by current renderer.
-
set
public final void set(IDeviceRenderer _ir)
Sets the device renderer for current renderer.
-
set
public final void set(IDisplayServer _xs)
Sets the diplay server for current renderer.
-
set
public final void set(ISeriesRenderingHints _srh)
Sets the series rendering hints for current renderer.
-
set
public final void set(BaseRenderer[] _brna)
Sets all associated renderers used for current chart rendering.
-
set
public final void set(RunTimeContext _rtc)
Sets the runtime context object for current renderer.
-
getSeriesRenderingHints
public final ISeriesRenderingHints getSeriesRenderingHints()
- Returns:
- Returns the series rendering hints for current renderer.
-
getXServer
public final IDisplayServer getXServer()
- Returns:
- Returns the display server for current renderer.
-
getDeviceScale
public final double getDeviceScale()
- Returns:
- Returns the scale of current device against standard 72dpi (X/72).
-
getSeriesDefinition
public final SeriesDefinition getSeriesDefinition()
- Returns:
- Returns the series definition associated with current renderer.
-
getSeriesIndex
public final int getSeriesIndex()
Identifies the series sequence # in the list of series renders(start from 0).- Returns:
- The index of the Series being rendered
-
getSeriesCount
public final int getSeriesCount()
- Returns:
- Returns the series count for current chart rendering.
-
getDeferredCache
public final DeferredCache getDeferredCache()
- Returns:
- Returns the deferred cache associated with current renderer.
-
getRenderer
public final BaseRenderer getRenderer(int iIndex)
Provides access to any other renderer in the group that participates in chart rendering- Parameters:
iIndex
-- Returns:
- renderer
-
getRunTimeContext
public final RunTimeContext getRunTimeContext()
- Returns:
- Returns the runtime context associated with current renderer.
-
render
public void render(java.util.Map<Series,LegendItemRenderingHints> htRenderers, Bounds bo) throws ChartException
Renders all blocks using the appropriate block z-order and the containment hierarchy.- Parameters:
bo
-- Throws:
ChartException
-
getAxesDecorator
public IAxesDecorator getAxesDecorator(OneAxis ax)
Returns the decorator renderer associated with current series, default is none.
-
isTransposed
public boolean isTransposed()
Returns if current chart is transposed.
-
renderLegend
public void renderLegend(IPrimitiveRenderer ipr, Legend lg, java.util.Map<Series,LegendItemRenderingHints> htRenderers) throws ChartException
Renders the legend block based on the legend rendering rules.- Parameters:
ipr
-lg
-htRenderers
-- Throws:
ChartException
-
renderPlot
public void renderPlot(IPrimitiveRenderer ipr, Plot p) throws ChartException
Renders the Plot- Parameters:
ipr
- The Primitive Renderer of a Device Rendererp
- The Plot to render- Throws:
ChartException
-
renderLabel
public void renderLabel(IPrimitiveRenderer ipr, Block b, java.lang.Object oSource) throws ChartException
Renders label of a LabelBlock.- Parameters:
ipr
-b
-- Throws:
ChartException
-
renderTitle
public void renderTitle(IPrimitiveRenderer ipr, TitleBlock b) throws ChartException
Renders the Chart Title Block- Parameters:
ipr
- The Primitive Renderer of a Device Rendererb
- The TitleBlock to render- Throws:
ChartException
-
instances
public static final BaseRenderer[] instances(Chart cm, RunTimeContext rtc, PlotComputation oComputations) throws ChartException
This method returns appropriate renders for the given chart model. It uses extension points to identify a renderer corresponding to a custom series.- Parameters:
cm
-rtc
-oComputations
-- Returns:
- renderers
- Throws:
ChartException
-
getSeries
public final Series getSeries()
- Returns:
- Returns series associated with current renderer.
-
getModel
public final Chart getModel()
- Returns:
- Returns chart model associated with current renderer.
-
getComputations
public final PlotComputation getComputations()
- Returns:
- Returns computation object associated with current renderer.
-
getDevice
public final IDeviceRenderer getDevice()
- Returns:
- Returns device renderer associated with current renderer.
-
getY
public static final double getY(Location[] loa, int iProperty)
Finds particular Y value from given location list.- Parameters:
loa
- Location list.iProperty
- This value must be one of following:- IConstants.MIN
- IConstants.MAX
- IConstants.AVERAGE
-
getX
public static final double getX(Location[] loa, int iProperty)
Finds particular X value from given location list.- Parameters:
loa
- Location list.iProperty
- This value must be one of following:- IConstants.MIN
- IConstants.MAX
- IConstants.AVERAGE
- Returns:
- x value
-
processTrigger
public void processTrigger(Trigger tg, StructureSource source)
post-process the triggers.- Parameters:
tg
- The Trigger to modifysource
- The StructureSource associated with the Trigger
-
renderLabel
public final void renderLabel(java.lang.Object oSource, int iTextRenderType, Label laDataPoint, Position lp, Location lo, Bounds bo) throws ChartException
This convenience method renders the data point label along with the shadow If there's a need to render the data point label and the shadow separately, each call should be made separately by calling into the primitive rendering interface directly.- Throws:
ChartException
-
renderLabel
public final void renderLabel(java.lang.Object oSource, int iTextRenderType, Label laDataPoint, Position lp, Location lo, Bounds bo, DeferredCache _dc) throws ChartException
Renderer label with specifiedDeferredCache
.- Parameters:
oSource
-iTextRenderType
-laDataPoint
-lp
-lo
-bo
-_dc
-- Throws:
ChartException
-
isRightToLeft
public boolean isRightToLeft()
Returns if the right-left mode is enabled.
-
switchAnchor
public Anchor switchAnchor(Anchor anchor)
Switch Anchor value due to right-left setting.- Parameters:
anchor
-
-
switchPosition
public Position switchPosition(Position po)
Switch Position value due to right-left setting.- Parameters:
po
-
-
switchTextAlignment
public TextAlignment switchTextAlignment(TextAlignment ta)
Switch TextAlignment value due to right-left setting.- Parameters:
ta
-
-
isInteractivityEnabled
public boolean isInteractivityEnabled()
Returns if interactivity is enabled on the model.
-
getFilteredMinSliceEntry
public java.util.Collection<java.lang.Integer> getFilteredMinSliceEntry(DataSetIterator dsi)
Returns if the corresponding category entry is filtered as minslice in legend. Subclass should override this method to implement their own legend strategy.- Returns:
- return null if no minslice applied or minslice feature is not supported.
-
updateTranslucency
public void updateTranslucency(Fill fill, Series se)
Updates the tranlucency of the fill according to series setting.- Parameters:
fill
-se
-
-
setDeferredCacheManager
public void setDeferredCacheManager(DeferredCacheManager dcm)
Set currentDeferredCacheManager
instance.- Parameters:
dcm
- specified instance ofDeferredCacheMananger
.
-
getDeferredCacheManager
public DeferredCacheManager getDeferredCacheManager()
ReturnsDeferredCacheManager
instance.- Returns:
DeferredCacheManager
instance.
-
-