本文整理汇总了Java中org.jfree.chart.util.Rotation.ANTICLOCKWISE属性的典型用法代码示例。如果您正苦于以下问题:Java Rotation.ANTICLOCKWISE属性的具体用法?Java Rotation.ANTICLOCKWISE怎么用?Java Rotation.ANTICLOCKWISE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.jfree.chart.util.Rotation
的用法示例。
在下文中一共展示了Rotation.ANTICLOCKWISE属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: calculateAngleForValue
private double calculateAngleForValue(double value, double total) {
if (this.direction == Rotation.CLOCKWISE) {
return this.startAngle - (value / total * 360.0);
}
else if (this.direction == Rotation.ANTICLOCKWISE) {
return this.startAngle + (value / total * 360.0);
}
throw new RuntimeException("Unrecognised Rotation type.");
}
示例2: getArcCenter
/**
* Returns the center for the specified section.
* Checks to see if the section is exploded and recalculates the
* new center if so.
*
* @param state PiePlotState
* @param key section key.
*
* @return The center for the specified section.
*
* @since 1.0.14
*/
protected Point2D getArcCenter(PiePlotState state, Comparable key) {
Point2D center = new Point2D.Double(state.getPieCenterX(), state
.getPieCenterY());
double ep = getExplodePercent(key);
double mep = getMaximumExplodePercent();
if (mep > 0.0) {
ep = ep / mep;
}
if (ep != 0) {
Rectangle2D pieArea = state.getPieArea();
Rectangle2D expPieArea = state.getExplodedPieArea();
double angle1, angle2;
Number n = this.dataset.getValue(key);
double value = n.doubleValue();
if (this.direction == Rotation.CLOCKWISE) {
angle1 = state.getLatestAngle();
angle2 = angle1 - value / state.getTotal() * 360.0;
} else if (this.direction == Rotation.ANTICLOCKWISE) {
angle1 = state.getLatestAngle();
angle2 = angle1 + value / state.getTotal() * 360.0;
} else {
throw new IllegalStateException("Rotation type not recognised.");
}
double angle = (angle2 - angle1);
Arc2D arc1 = new Arc2D.Double(pieArea, angle1, angle / 2,
Arc2D.OPEN);
Point2D point1 = arc1.getEndPoint();
Arc2D.Double arc2 = new Arc2D.Double(expPieArea, angle1, angle / 2,
Arc2D.OPEN);
Point2D point2 = arc2.getEndPoint();
double deltaX = (point1.getX() - point2.getX()) * ep;
double deltaY = (point1.getY() - point2.getY()) * ep;
center = new Point2D.Double(state.getPieCenterX() - deltaX,
state.getPieCenterY() - deltaY);
}
return center;
}
示例3: createHotSpotShape
/**
* Returns a shape representing the hotspot for a pie section.
*
* @param g2 the graphics device.
* @param dataArea the area within which the data is being rendered.
* @param selected is the item selected?
*
* @return A shape equal to the hot spot for a data item.
*/
public Shape createHotSpotShape(Graphics2D g2, Rectangle2D dataArea,
int section, boolean selected) {
Number n = this.dataset.getValue(section);
if (n == null) {
return null;
}
double value = n.doubleValue();
double angle1 = 0.0;
double angle2 = 0.0;
double total = DatasetUtilities.calculatePieDatasetTotal(this.dataset);
double lead = 0.0;
if (this.direction == Rotation.CLOCKWISE) {
for (int i = 0; i < section; i++) {
n = this.dataset.getValue(i);
if (n != null) {
value = n.doubleValue();
if (value >= 0.0) {
lead = lead + value;
}
}
}
angle1 = getStartAngle() - lead / total * 360.0;
angle2 = angle1 - value / total * 360.0;
}
else if (this.direction == Rotation.ANTICLOCKWISE) {
angle1 = getStartAngle() + lead / total * 360.0;
angle2 = angle1 + value / total * 360.0;
}
else {
throw new IllegalStateException("Rotation type not recognised.");
}
double angle = (angle2 - angle1);
if (Math.abs(angle) > getMinimumArcAngleToDraw()) {
double ep = 0.0;
double mep = getMaximumExplodePercent();
if (mep > 0.0) {
ep = getExplodePercent(getSectionKey(section)) / mep;
}
Rectangle2D arcBounds = getArcBounds(dataArea,
dataArea, angle1, angle, ep);
Arc2D.Double arc = new Arc2D.Double(arcBounds, angle1, angle,
Arc2D.PIE);
return arc;
}
return null;
}