本文整理匯總了Java中org.jfree.ui.RectangleEdge.isTopOrBottom方法的典型用法代碼示例。如果您正苦於以下問題:Java RectangleEdge.isTopOrBottom方法的具體用法?Java RectangleEdge.isTopOrBottom怎麽用?Java RectangleEdge.isTopOrBottom使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.jfree.ui.RectangleEdge
的用法示例。
在下文中一共展示了RectangleEdge.isTopOrBottom方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: refreshTicks
import org.jfree.ui.RectangleEdge; //導入方法依賴的package包/類
/**
* Calculates the positions of the tick labels for the axis, storing the results in the
* tick label list (ready for drawing).
*
* @param g2 the graphics device.
* @param state the axis state.
* @param plotArea the area in which the plot and the axes should be drawn.
* @param dataArea the area in which the plot should be drawn.
* @param edge the location of the axis.
*
* @return A list of ticks.
*
*/
public List refreshTicks(Graphics2D g2,
AxisState state,
Rectangle2D plotArea,
Rectangle2D dataArea,
RectangleEdge edge) {
List result = new java.util.ArrayList();
if (RectangleEdge.isTopOrBottom(edge)) {
result = refreshHorizontalTicks(g2, state.getCursor(), plotArea, dataArea, edge);
}
else if (RectangleEdge.isLeftOrRight(edge)) {
result = refreshVerticalTicks(g2, state.getCursor(), plotArea, dataArea, edge);
}
return result;
}
示例2: drawSymbolicGridLines
import org.jfree.ui.RectangleEdge; //導入方法依賴的package包/類
/**
* Draws the symbolic grid lines.
* <P>
* The colors are consecutively the color specified by
* <CODE>symbolicGridPaint<CODE>
* (<CODE>DEFAULT_SYMBOLIC_GRID_LINE_PAINT</CODE> by default) and white.
*
* @param g2 the graphics device.
* @param plotArea the area within which the chart should be drawn.
* @param dataArea the area within which the plot should be drawn (a subset of the drawArea).
* @param edge the axis location.
* @param ticks the ticks.
*/
public void drawSymbolicGridLines(Graphics2D g2,
Rectangle2D plotArea,
Rectangle2D dataArea,
RectangleEdge edge,
List ticks) {
Shape savedClip = g2.getClip();
g2.clip(dataArea);
if (RectangleEdge.isTopOrBottom(edge)) {
drawSymbolicGridLinesHorizontal(g2, plotArea, dataArea, true, ticks);
}
else if (RectangleEdge.isLeftOrRight(edge)) {
drawSymbolicGridLinesVertical(g2, plotArea, dataArea, true, ticks);
}
g2.setClip(savedClip);
}
示例3: fetchLegendItems
import org.jfree.ui.RectangleEdge; //導入方法依賴的package包/類
/**
* Fetches the latest legend items.
*/
protected void fetchLegendItems() {
this.items.clear();
RectangleEdge p = getPosition();
if (RectangleEdge.isTopOrBottom(p)) {
this.items.setArrangement(this.hLayout);
}
else {
this.items.setArrangement(this.vLayout);
}
for (int s = 0; s < this.sources.length; s++) {
LegendItemCollection legendItems = this.sources[s].getLegendItems();
if (legendItems != null) {
for (int i = 0; i < legendItems.getItemCount(); i++) {
LegendItem item = legendItems.get(i);
Block block = createLegendItemBlock(item);
this.items.add(block);
}
}
}
}
示例4: reserveSpace
import org.jfree.ui.RectangleEdge; //導入方法依賴的package包/類
/**
* Estimates the space required for the axis, given a specific drawing area.
*
* @param g2 the graphics device (used to obtain font information).
* @param plot the plot that the axis belongs to.
* @param plotArea the area within which the axis should be drawn.
* @param edge the axis location (top or bottom).
* @param space the space already reserved.
*
* @return The space required to draw the axis.
*/
public AxisSpace reserveSpace(Graphics2D g2, Plot plot,
Rectangle2D plotArea,
RectangleEdge edge, AxisSpace space) {
// create a new space object if one wasn't supplied...
if (space == null) {
space = new AxisSpace();
}
// if the axis is not visible, no additional space is required...
if (!isVisible()) {
return space;
}
space = super.reserveSpace(g2, plot, plotArea, edge, space);
double maxdim = getMaxDim(g2, edge);
if (RectangleEdge.isTopOrBottom(edge)) {
space.add(maxdim, edge);
}
else if (RectangleEdge.isLeftOrRight(edge)) {
space.add(maxdim, edge);
}
return space;
}
示例5: transEnd
import org.jfree.ui.RectangleEdge; //導入方法依賴的package包/類
/**
* Translates a data value to a Java2D value for the second section of the
* axis.
*
* @param value the value.
* @param area the data area.
* @param edge the edge along which the axis lies.
* @param length1 the length of the first section.
* @param length2 the length of the second section.
*
* @return The Java2D coordinate.
*/
private double transEnd(double value, Rectangle2D area, RectangleEdge edge,
double length1, double length2) {
double min = 0.0;
double max = 0.0;
if (RectangleEdge.isTopOrBottom(edge)) {
max = area.getMaxX();
min = area.getMaxX() - area.getWidth() * length2 / (length1 + length2);
}
else if (RectangleEdge.isLeftOrRight(edge)) {
max = area.getMinY();
min = area.getMinY() + area.getHeight() * length2 / (length1 + length2);
}
if (isInverted()) {
return max - ((value - this.fixedRange.getLowerBound())
/ (this.displayEnd - this.fixedRange.getLowerBound())) * (max - min);
}
else {
return min + ((value - this.fixedRange.getLowerBound())
/ (this.displayEnd - this.fixedRange.getLowerBound())) * (max - min);
}
}
示例6: translateJava2DToValue
import org.jfree.ui.RectangleEdge; //導入方法依賴的package包/類
/**
* Converts a coordinate in Java2D space to the corresponding data
* value, assuming that the axis runs along one edge of the specified plotArea.
*
* @param java2DValue the coordinate in Java2D space.
* @param plotArea the area in which the data is plotted.
* @param edge the axis location.
*
* @return the data value.
*
* @deprecated Use java2DToValue().
*/
public double translateJava2DToValue(double java2DValue, Rectangle2D plotArea,
RectangleEdge edge) {
Range range = getRange();
double axisMin = switchedLog10(range.getLowerBound());
double axisMax = switchedLog10(range.getUpperBound());
double plotMin = 0.0;
double plotMax = 0.0;
if (RectangleEdge.isTopOrBottom(edge)) {
plotMin = plotArea.getX();
plotMax = plotArea.getMaxX();
}
else if (RectangleEdge.isLeftOrRight(edge)) {
plotMin = plotArea.getMaxY();
plotMax = plotArea.getMinY();
}
if (isInverted()) {
return Math.pow(
10, axisMax - ((java2DValue - plotMin) / (plotMax - plotMin)) * (axisMax - axisMin)
);
}
else {
return Math.pow(
10, axisMin + ((java2DValue - plotMin) / (plotMax - plotMin)) * (axisMax - axisMin)
);
}
}
示例7: java2DToValue
import org.jfree.ui.RectangleEdge; //導入方法依賴的package包/類
/**
* Converts a coordinate in Java2D space to the corresponding data
* value, assuming that the axis runs along one edge of the specified
* plotArea.
*
* @param java2DValue the coordinate in Java2D space.
* @param plotArea the area in which the data is plotted.
* @param edge the axis location.
*
* @return The data value.
*/
public double java2DToValue(double java2DValue, Rectangle2D plotArea,
RectangleEdge edge) {
Range range = getRange();
double axisMin = switchedLog10(range.getLowerBound());
double axisMax = switchedLog10(range.getUpperBound());
double plotMin = 0.0;
double plotMax = 0.0;
if (RectangleEdge.isTopOrBottom(edge)) {
plotMin = plotArea.getX();
plotMax = plotArea.getMaxX();
}
else if (RectangleEdge.isLeftOrRight(edge)) {
plotMin = plotArea.getMaxY();
plotMax = plotArea.getMinY();
}
if (isInverted()) {
return switchedPow10(axisMax - ((java2DValue - plotMin)
/ (plotMax - plotMin)) * (axisMax - axisMin));
}
else {
return switchedPow10(axisMin + ((java2DValue - plotMin)
/ (plotMax - plotMin)) * (axisMax - axisMin));
}
}
示例8: selectAutoTickUnit
import org.jfree.ui.RectangleEdge; //導入方法依賴的package包/類
/**
* Selects an appropriate tick value for the axis. The strategy is to
* display as many ticks as possible (selected from an array of 'standard'
* tick units) without the labels overlapping.
*
* @param g2 the graphics device.
* @param drawArea the area in which the plot and axes should be drawn.
* @param dataArea the area defined by the axes.
* @param edge the axis location.
*/
protected void selectAutoTickUnit(Graphics2D g2, Rectangle2D drawArea, Rectangle2D dataArea,
RectangleEdge edge) {
if (RectangleEdge.isTopOrBottom(edge)) {
selectHorizontalAutoTickUnit(g2, drawArea, dataArea, edge);
}
else if (RectangleEdge.isLeftOrRight(edge)) {
selectVerticalAutoTickUnit(g2, drawArea, dataArea, edge);
}
}
示例9: transStart
import org.jfree.ui.RectangleEdge; //導入方法依賴的package包/類
/**
* Translates a data value to a Java2D value for the first section of the
* axis.
*
* @param value the value.
* @param area the data area.
* @param edge the edge along which the axis lies.
* @param length1 the length of the first section.
* @param length2 the length of the second section.
*
* @return The Java2D coordinate.
*/
private double transStart(double value, Rectangle2D area,
RectangleEdge edge,
double length1, double length2) {
double min = 0.0;
double max = 0.0;
if (RectangleEdge.isTopOrBottom(edge)) {
min = area.getX();
max = area.getX() + area.getWidth() * length1 / (length1 + length2);
}
else if (RectangleEdge.isLeftOrRight(edge)) {
min = area.getMaxY();
max = area.getMaxY() - area.getHeight() * length1
/ (length1 + length2);
}
if (isInverted()) {
return max - ((value - this.displayStart)
/ (this.fixedRange.getUpperBound() - this.displayStart))
* (max - min);
}
else {
return min + ((value - this.displayStart)
/ (this.fixedRange.getUpperBound() - this.displayStart))
* (max - min);
}
}
示例10: selectAutoTickUnit
import org.jfree.ui.RectangleEdge; //導入方法依賴的package包/類
/**
* Selects an appropriate tick value for the axis. The strategy is to
* display as many ticks as possible (selected from an array of 'standard'
* tick units) without the labels overlapping.
*
* @param g2 the graphics device.
* @param dataArea the area defined by the axes.
* @param edge the axis location.
*/
protected void selectAutoTickUnit(Graphics2D g2,
Rectangle2D dataArea,
RectangleEdge edge) {
if (RectangleEdge.isTopOrBottom(edge)) {
selectHorizontalAutoTickUnit(g2, dataArea, edge);
}
else if (RectangleEdge.isLeftOrRight(edge)) {
selectVerticalAutoTickUnit(g2, dataArea, edge);
}
}
示例11: translateValueToJava2D
import org.jfree.ui.RectangleEdge; //導入方法依賴的package包/類
/**
* Converts a data value to a coordinate in Java2D space, assuming that
* the axis runs along one edge of the specified plotArea.
* Note that it is possible for the coordinate to fall outside the
* plotArea.
*
* @param value the data value.
* @param plotArea the area for plotting the data.
* @param edge the axis location.
*
* @return the Java2D coordinate.
*
* @deprecated Use valueToJava2D().
*/
public double translateValueToJava2D(double value, Rectangle2D plotArea,
RectangleEdge edge) {
Range range = getRange();
double axisMin = switchedLog10(range.getLowerBound());
double axisMax = switchedLog10(range.getUpperBound());
double min = 0.0;
double max = 0.0;
if (RectangleEdge.isTopOrBottom(edge)) {
min = plotArea.getMinX();
max = plotArea.getMaxX();
}
else if (RectangleEdge.isLeftOrRight(edge)) {
min = plotArea.getMaxY();
max = plotArea.getMinY();
}
value = switchedLog10(value);
if (isInverted()) {
return max - (((value - axisMin) / (axisMax - axisMin)) * (max - min));
}
else {
return min + (((value - axisMin) / (axisMax - axisMin)) * (max - min));
}
}
示例12: selectAutoTickUnit
import org.jfree.ui.RectangleEdge; //導入方法依賴的package包/類
/**
* Selects an appropriate tick value for the axis. The strategy is to
* display as many ticks as possible (selected from an array of 'standard'
* tick units) without the labels overlapping.
*
* @param g2 the graphics device.
* @param dataArea the area defined by the axes.
* @param edge the axis location.
*/
protected void selectAutoTickUnit(Graphics2D g2,
Rectangle2D dataArea,
RectangleEdge edge) {
if (RectangleEdge.isTopOrBottom(edge)) {
selectHorizontalAutoTickUnit(g2, dataArea, edge);
}
else if (RectangleEdge.isLeftOrRight(edge)) {
selectVerticalAutoTickUnit(g2, dataArea, edge);
}
}
示例13: reserveSpace
import org.jfree.ui.RectangleEdge; //導入方法依賴的package包/類
/**
* Reserve some space on each axis side because we draw a centered label at
* each extremity.
*
* @param g2 the graphics device.
* @param plot the plot.
* @param plotArea the plot area.
* @param edge the edge.
* @param space the space already reserved.
*
* @return The reserved space.
*/
public AxisSpace reserveSpace(Graphics2D g2,
Plot plot,
Rectangle2D plotArea,
RectangleEdge edge,
AxisSpace space) {
this.internalMarkerCycleBoundTick = null;
AxisSpace ret = super.reserveSpace(g2, plot, plotArea, edge, space);
if (this.internalMarkerCycleBoundTick == null) {
return ret;
}
FontMetrics fm = g2.getFontMetrics(getTickLabelFont());
Rectangle2D r = TextUtilities.getTextBounds(
this.internalMarkerCycleBoundTick.getText(), g2, fm
);
if (RectangleEdge.isTopOrBottom(edge)) {
if (isVerticalTickLabels()) {
space.add(r.getHeight() / 2, RectangleEdge.RIGHT);
}
else {
space.add(r.getWidth() / 2, RectangleEdge.RIGHT);
}
}
else if (RectangleEdge.isLeftOrRight(edge)) {
if (isVerticalTickLabels()) {
space.add(r.getWidth() / 2, RectangleEdge.TOP);
}
else {
space.add(r.getHeight() / 2, RectangleEdge.TOP);
}
}
return ret;
}
示例14: valueToJava2D
import org.jfree.ui.RectangleEdge; //導入方法依賴的package包/類
/**
* Converts a data value to a coordinate in Java2D space, assuming that the
* axis runs along one edge of the specified dataArea.
* <p>
* Note that it is possible for the coordinate to fall outside the area.
*
* @param value the data value.
* @param area the area for plotting the data.
* @param edge the edge along which the axis lies.
*
* @return The Java2D coordinate.
*/
public double valueToJava2D(double value,
Rectangle2D area,
RectangleEdge edge) {
double result = Double.NaN;
double axisMin = this.first.getFirstMillisecond(this.timeZone);
double axisMax = this.last.getLastMillisecond(this.timeZone);
if (RectangleEdge.isTopOrBottom(edge)) {
double minX = area.getX();
double maxX = area.getMaxX();
if (isInverted()) {
result = maxX + ((value - axisMin) / (axisMax - axisMin)) * (minX - maxX);
}
else {
result = minX + ((value - axisMin) / (axisMax - axisMin)) * (maxX - minX);
}
}
else if (RectangleEdge.isLeftOrRight(edge)) {
double minY = area.getMinY();
double maxY = area.getMaxY();
if (isInverted()) {
result = minY + (((value - axisMin) / (axisMax - axisMin)) * (maxY - minY));
}
else {
result = maxY - (((value - axisMin) / (axisMax - axisMin)) * (maxY - minY));
}
}
return result;
}
示例15: refreshTicks
import org.jfree.ui.RectangleEdge; //導入方法依賴的package包/類
/**
* Calculates the positions of the tick labels for the axis, storing the
* results in the tick label list (ready for drawing).
*
* @param g2 the graphics device.
* @param state the axis state.
* @param dataArea the area in which the data should be drawn.
* @param edge the location of the axis.
*
* @return A list of ticks.
*/
public List refreshTicks(Graphics2D g2,
AxisState state,
Rectangle2D dataArea,
RectangleEdge edge) {
List ticks = null;
if (RectangleEdge.isTopOrBottom(edge)) {
ticks = refreshTicksHorizontal(g2, dataArea, edge);
}
else if (RectangleEdge.isLeftOrRight(edge)) {
ticks = refreshTicksVertical(g2, dataArea, edge);
}
return ticks;
}