public class IlvChartFlowObject extends Object implements IlvFlowObject
IlvChart
in a flow of text.
The size of the chart in the flow can be specified either as a fixed size,
or as a percentage of the page size. In the latter case, one dimension is
specified as a percentage of the corresponding page dimension, the other one
being automatically computed according to a given aspect ratio. For example,
to print an IlvChart
in a flow with a chart height equals to
25% of the page height with an aspect ratio of 0.75 between the two chart
dimensions, the code is:
IlvChart chart = ...; IlvPrintableDocument document = new IlvPrintableDocument("ChartInFlow"); IlvPrintingController controller = new IlvPrintingController(document); IlvFlow flow = document.getFlow(); IlvChartFlowObject printChart = new IlvChartFlowObject(chart, flow, 0, 25, .75f); flow.add(printChart, IlvFlow.BOTTOM_ALIGNMENT);
setPercentWidth(int, float)
,
setPercentHeight(int, float)
,
IlvFlow.add(IlvFlowObject,int)
Constructor and Description |
---|
IlvChartFlowObject(IlvChart chart,
IlvFlow flow,
IlvUnit.Dimension size)
Creates a new
IlvChartFlowObject with the specified size. |
IlvChartFlowObject(IlvChart chart,
IlvFlow flow,
int percentWidth,
int percentHeight,
float aspectRatio)
Creates a new
IlvChartFlowObject with a size expressed as
a percentage of the page dimension. |
Modifier and Type | Method and Description |
---|---|
void |
draw(Graphics graphics,
double x,
double y)
Draw this flow object in the specified graphics at the specified location.
|
IlvChart |
getChart()
Returns the printed chart.
|
IlvFlow |
getFlow()
Returns the destination flow.
|
IlvUnit.Dimension |
getSize()
Returns the dimension of this flow object.
|
void |
setPercentHeight(int percentHeight,
float aspectRatio)
Sets the amount of the page height the chart should cover.
|
void |
setPercentSize(int percentWidth,
int percentHeight)
Sets the amount of the page width and of the page height that the chart should
cover.
|
void |
setPercentWidth(int percentWidth,
float aspectRatio)
Sets the amount of the page width the chart should cover.
|
public IlvChartFlowObject(IlvChart chart, IlvFlow flow, IlvUnit.Dimension size)
IlvChartFlowObject
with the specified size.chart
- The chart to print.flow
- The destination flow.size
- The dimension on the page.public IlvChartFlowObject(IlvChart chart, IlvFlow flow, int percentWidth, int percentHeight, float aspectRatio)
IlvChartFlowObject
with a size expressed as
a percentage of the page dimension. You might specify either both the
amount of the page width and the amount of the page height explicitly, or
specify only one dimension, the other one being computed according to
a specified aspect ratio.chart
- The chart to print.flow
- The destination flow.percentWidth
- The percentage of the page width the chart will take.
A 0 value means the width is computed from the specified height and
aspect ratio parameters.percentHeight
- The percentage of the page height the chart will take.
A 0 value means the height is computed from the specified width and
aspect ratio parameters.aspectRatio
- The aspect ratio to use to compute the dual dimension.public IlvChart getChart()
public IlvFlow getFlow()
public void setPercentWidth(int percentWidth, float aspectRatio)
percentWidth
- The amount of the page width.aspectRatio
- The aspect ratio used to compute the chart height.public void setPercentHeight(int percentHeight, float aspectRatio)
percentHeight
- The amount of the page height.aspectRatio
- The aspect ratio used to computed the chart width.public void setPercentSize(int percentWidth, int percentHeight)
percentWidth
- The amount of the page width.percentHeight
- The amount of the page height.public void draw(Graphics graphics, double x, double y)
draw
in interface IlvFlowObject
public IlvUnit.Dimension getSize()
getSize
in interface IlvFlowObject
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.