use of org.jfree.chart.axis.NumberTick in project SIMVA-SoS by SESoS.
the class PolarPlot method refreshAngleTicks.
/**
* Generates a list of tick values for the angular tick marks.
*
* @return A list of {@link NumberTick} instances.
*
* @since 1.0.10
*/
protected List refreshAngleTicks() {
List ticks = new ArrayList();
for (double currentTickVal = 0.0; currentTickVal < 360.0; currentTickVal += this.angleTickUnit.getSize()) {
TextAnchor ta = calculateTextAnchor(currentTickVal);
NumberTick tick = new NumberTick(new Double(currentTickVal), this.angleTickUnit.valueToString(currentTickVal), ta, TextAnchor.CENTER, 0.0);
ticks.add(tick);
}
return ticks;
}
use of org.jfree.chart.axis.NumberTick in project SIMVA-SoS by SESoS.
the class DefaultPolarItemRenderer method drawAngularGridLines.
/**
* Draw the angular gridlines - the spokes.
*
* @param g2 the drawing surface.
* @param plot the plot (<code>null</code> not permitted).
* @param ticks the ticks (<code>null</code> not permitted).
* @param dataArea the data area.
*/
@Override
public void drawAngularGridLines(Graphics2D g2, PolarPlot plot, List ticks, Rectangle2D dataArea) {
g2.setFont(plot.getAngleLabelFont());
g2.setStroke(plot.getAngleGridlineStroke());
g2.setPaint(plot.getAngleGridlinePaint());
ValueAxis axis = plot.getAxis();
double centerValue, outerValue;
if (axis.isInverted()) {
outerValue = axis.getLowerBound();
centerValue = axis.getUpperBound();
} else {
outerValue = axis.getUpperBound();
centerValue = axis.getLowerBound();
}
Point center = plot.translateToJava2D(0, centerValue, axis, dataArea);
Iterator iterator = ticks.iterator();
while (iterator.hasNext()) {
NumberTick tick = (NumberTick) iterator.next();
double tickVal = tick.getNumber().doubleValue();
Point p = plot.translateToJava2D(tickVal, outerValue, axis, dataArea);
g2.setPaint(plot.getAngleGridlinePaint());
g2.drawLine(center.x, center.y, p.x, p.y);
if (plot.isAngleLabelsVisible()) {
int x = p.x;
int y = p.y;
g2.setPaint(plot.getAngleLabelPaint());
TextUtilities.drawAlignedString(tick.getText(), g2, x, y, tick.getTextAnchor());
}
}
}
use of org.jfree.chart.axis.NumberTick in project SIMVA-SoS by SESoS.
the class DefaultPolarItemRenderer method drawRadialGridLines.
/**
* Draw the radial gridlines - the rings.
*
* @param g2 the drawing surface (<code>null</code> not permitted).
* @param plot the plot (<code>null</code> not permitted).
* @param radialAxis the radial axis (<code>null</code> not permitted).
* @param ticks the ticks (<code>null</code> not permitted).
* @param dataArea the data area.
*/
@Override
public void drawRadialGridLines(Graphics2D g2, PolarPlot plot, ValueAxis radialAxis, List ticks, Rectangle2D dataArea) {
ParamChecks.nullNotPermitted(radialAxis, "radialAxis");
g2.setFont(radialAxis.getTickLabelFont());
g2.setPaint(plot.getRadiusGridlinePaint());
g2.setStroke(plot.getRadiusGridlineStroke());
double centerValue;
if (radialAxis.isInverted()) {
centerValue = radialAxis.getUpperBound();
} else {
centerValue = radialAxis.getLowerBound();
}
Point center = plot.translateToJava2D(0, centerValue, radialAxis, dataArea);
Iterator iterator = ticks.iterator();
while (iterator.hasNext()) {
NumberTick tick = (NumberTick) iterator.next();
double angleDegrees = plot.isCounterClockwise() ? plot.getAngleOffset() : -plot.getAngleOffset();
Point p = plot.translateToJava2D(angleDegrees, tick.getNumber().doubleValue(), radialAxis, dataArea);
int r = p.x - center.x;
int upperLeftX = center.x - r;
int upperLeftY = center.y - r;
int d = 2 * r;
Ellipse2D ring = new Ellipse2D.Double(upperLeftX, upperLeftY, d, d);
g2.setPaint(plot.getRadiusGridlinePaint());
g2.draw(ring);
}
}
Aggregations