Thus, DefaultPolarItemRenderer accepts at all polar points, converts the polar points to normal Java2D coordinates, makes Polygon with these points, and then draws. Here is how I got this to draw points instead of a polygon:
public class MyDefaultPolarItemRenderer extends DefaultPolarItemRenderer { @Override public void drawSeries(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, PlotRenderingInfo info, PolarPlot plot, XYDataset dataset, int seriesIndex) { int numPoints = dataset.getItemCount(seriesIndex); for (int i = 0; i < numPoints; i++) { double theta = dataset.getXValue(seriesIndex, i); double radius = dataset.getYValue(seriesIndex, i); Point p = plot.translateValueThetaRadiusToJava2D(theta, radius, dataArea); Ellipse2D el = new Ellipse2D.Double(px, py, 5, 5); g2.fill(el); g2.draw(el); } } }
and then an instance of this class elsewhere:
MyDefaultPolarItemRenderer dpir = new MyDefaultPolarItemRenderer(); dpir.setPlot(plot); plot.setRenderer(dpir);
Mike speed
source share