@Test public void testDrawWithNullInfo() { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.addValue(35.0, "S1", "C1"); dataset.addValue(45.0, "S1", "C2"); dataset.addValue(55.0, "S1", "C3"); dataset.addValue(15.0, "S1", "C4"); dataset.addValue(25.0, "S1", "C5"); SpiderWebPlot plot = new SpiderWebPlot(dataset); JFreeChart chart = new JFreeChart(plot); BufferedImage image = new BufferedImage(200 , 100, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = image.createGraphics(); chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, null); g2.dispose(); }
@Override public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor, PlotState parentState, PlotRenderingInfo info) { RectangleInsets insets = getInsets(); insets.trim(area); if (info != null) { info.setPlotArea(area); info.setDataArea(area); } drawBackground(g2, area); drawOutline(g2, area); Shape savedClip = g2.getClip(); g2.clip(area); Composite originalComposite = g2.getComposite(); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, getForegroundAlpha())); if (!DatasetUtilities.isEmptyOrNull(this.dataset)) { int seriesCount, catCount; if (this.dataExtractOrder == TableOrder.BY_ROW) { seriesCount = this.dataset.getRowCount(); catCount = this.dataset.getColumnCount(); } else { seriesCount = this.dataset.getColumnCount(); catCount = this.dataset.getRowCount(); } if (this.maxValue == DEFAULT_MAX_VALUE) { calculateMaxValue(seriesCount, catCount); } double gapHorizontal = area.getWidth() * getInteriorGap(); double gapVertical = area.getHeight() * getInteriorGap(); double X = area.getX() + gapHorizontal / 2; double Y = area.getY() + gapVertical / 2; double W = area.getWidth() - gapHorizontal; double H = area.getHeight() - gapVertical; double headW = area.getWidth() * this.headPercent; double headH = area.getHeight() * this.headPercent; double min = Math.min(W, H) / 2; X = (X + X + W) / 2 - min; Y = (Y + Y + H) / 2 - min; W = 2 * min; H = 2 * min; Point2D centre = new Point2D.Double(X + W / 2, Y + H / 2); Rectangle2D radarArea = new Rectangle2D.Double(X, Y, W, H); for (int cat = 0; cat < catCount; cat++) { double angle = getStartAngle() + (getDirection().getFactor() * cat * 360 / catCount); Point2D endPoint = getWebPoint(radarArea, angle, 1); Line2D line = new Line2D.Double(centre, endPoint); g2.setPaint(this.axisLinePaint); g2.setStroke(this.axisLineStroke); g2.draw(line); drawLabel(g2, radarArea, 0.0, cat, angle, 360.0 / catCount); } for (int series = 0; series < seriesCount; series++) { drawRadarPoly(g2, radarArea, centre, info, series, catCount, headH, headW); } } else { drawNoDataMessage(g2, area); } g2.setClip(savedClip); g2.setComposite(originalComposite); drawOutline(g2, area); }
SpiderWebPlot extends Plot implements Cloneable, Serializable { @Override public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor, PlotState parentState, PlotRenderingInfo info) { RectangleInsets insets = getInsets(); insets.trim(area); if (info != null) { info.setPlotArea(area); info.setDataArea(area); } drawBackground(g2, area); drawOutline(g2, area); Shape savedClip = g2.getClip(); g2.clip(area); Composite originalComposite = g2.getComposite(); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, getForegroundAlpha())); if (!DatasetUtilities.isEmptyOrNull(this.dataset)) { int seriesCount, catCount; if (this.dataExtractOrder == TableOrder.BY_ROW) { seriesCount = this.dataset.getRowCount(); catCount = this.dataset.getColumnCount(); } else { seriesCount = this.dataset.getColumnCount(); catCount = this.dataset.getRowCount(); } if (this.maxValue == DEFAULT_MAX_VALUE) { calculateMaxValue(seriesCount, catCount); } double gapHorizontal = area.getWidth() * getInteriorGap(); double gapVertical = area.getHeight() * getInteriorGap(); double X = area.getX() + gapHorizontal / 2; double Y = area.getY() + gapVertical / 2; double W = area.getWidth() - gapHorizontal; double H = area.getHeight() - gapVertical; double headW = area.getWidth() * this.headPercent; double headH = area.getHeight() * this.headPercent; double min = Math.min(W, H) / 2; X = (X + X + W) / 2 - min; Y = (Y + Y + H) / 2 - min; W = 2 * min; H = 2 * min; Point2D centre = new Point2D.Double(X + W / 2, Y + H / 2); Rectangle2D radarArea = new Rectangle2D.Double(X, Y, W, H); for (int cat = 0; cat < catCount; cat++) { double angle = getStartAngle() + (getDirection().getFactor() * cat * 360 / catCount); Point2D endPoint = getWebPoint(radarArea, angle, 1); Line2D line = new Line2D.Double(centre, endPoint); g2.setPaint(this.axisLinePaint); g2.setStroke(this.axisLineStroke); g2.draw(line); drawLabel(g2, radarArea, 0.0, cat, angle, 360.0 / catCount); } for (int series = 0; series < seriesCount; series++) { drawRadarPoly(g2, radarArea, centre, info, series, catCount, headH, headW); } } else { drawNoDataMessage(g2, area); } g2.setClip(savedClip); g2.setComposite(originalComposite); drawOutline(g2, area); } }
SpiderWebPlot extends Plot implements Cloneable, Serializable { @Override public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor, PlotState parentState, PlotRenderingInfo info) { RectangleInsets insets = getInsets(); insets.trim(area); if (info != null) { info.setPlotArea(area); info.setDataArea(area); } drawBackground(g2, area); drawOutline(g2, area); Shape savedClip = g2.getClip(); g2.clip(area); Composite originalComposite = g2.getComposite(); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, getForegroundAlpha())); if (!DatasetUtilities.isEmptyOrNull(this.dataset)) { int seriesCount, catCount; if (this.dataExtractOrder == TableOrder.BY_ROW) { seriesCount = this.dataset.getRowCount(); catCount = this.dataset.getColumnCount(); } else { seriesCount = this.dataset.getColumnCount(); catCount = this.dataset.getRowCount(); } if (this.maxValue == DEFAULT_MAX_VALUE) { calculateMaxValue(seriesCount, catCount); } double gapHorizontal = area.getWidth() * getInteriorGap(); double gapVertical = area.getHeight() * getInteriorGap(); double X = area.getX() + gapHorizontal / 2; double Y = area.getY() + gapVertical / 2; double W = area.getWidth() - gapHorizontal; double H = area.getHeight() - gapVertical; double headW = area.getWidth() * this.headPercent; double headH = area.getHeight() * this.headPercent; double min = Math.min(W, H) / 2; X = (X + X + W) / 2 - min; Y = (Y + Y + H) / 2 - min; W = 2 * min; H = 2 * min; Point2D centre = new Point2D.Double(X + W / 2, Y + H / 2); Rectangle2D radarArea = new Rectangle2D.Double(X, Y, W, H); for (int cat = 0; cat < catCount; cat++) { double angle = getStartAngle() + (getDirection().getFactor() * cat * 360 / catCount); Point2D endPoint = getWebPoint(radarArea, angle, 1); Line2D line = new Line2D.Double(centre, endPoint); g2.setPaint(this.axisLinePaint); g2.setStroke(this.axisLineStroke); g2.draw(line); drawLabel(g2, radarArea, 0.0, cat, angle, 360.0 / catCount); } for (int series = 0; series < seriesCount; series++) { drawRadarPoly(g2, radarArea, centre, info, series, catCount, headH, headW); } } else { drawNoDataMessage(g2, area); } g2.setClip(savedClip); g2.setComposite(originalComposite); drawOutline(g2, area); } SpiderWebPlot();  SpiderWebPlot(CategoryDataset dataset);  SpiderWebPlot(CategoryDataset dataset, TableOrder extract); }
SpiderWebPlot extends Plot implements Cloneable, Serializable { @Override public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor, PlotState parentState, PlotRenderingInfo info) { RectangleInsets insets = getInsets(); insets.trim(area); if (info != null) { info.setPlotArea(area); info.setDataArea(area); } drawBackground(g2, area); drawOutline(g2, area); Shape savedClip = g2.getClip(); g2.clip(area); Composite originalComposite = g2.getComposite(); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, getForegroundAlpha())); if (!DatasetUtilities.isEmptyOrNull(this.dataset)) { int seriesCount, catCount; if (this.dataExtractOrder == TableOrder.BY_ROW) { seriesCount = this.dataset.getRowCount(); catCount = this.dataset.getColumnCount(); } else { seriesCount = this.dataset.getColumnCount(); catCount = this.dataset.getRowCount(); } if (this.maxValue == DEFAULT_MAX_VALUE) { calculateMaxValue(seriesCount, catCount); } double gapHorizontal = area.getWidth() * getInteriorGap(); double gapVertical = area.getHeight() * getInteriorGap(); double X = area.getX() + gapHorizontal / 2; double Y = area.getY() + gapVertical / 2; double W = area.getWidth() - gapHorizontal; double H = area.getHeight() - gapVertical; double headW = area.getWidth() * this.headPercent; double headH = area.getHeight() * this.headPercent; double min = Math.min(W, H) / 2; X = (X + X + W) / 2 - min; Y = (Y + Y + H) / 2 - min; W = 2 * min; H = 2 * min; Point2D centre = new Point2D.Double(X + W / 2, Y + H / 2); Rectangle2D radarArea = new Rectangle2D.Double(X, Y, W, H); for (int cat = 0; cat < catCount; cat++) { double angle = getStartAngle() + (getDirection().getFactor() * cat * 360 / catCount); Point2D endPoint = getWebPoint(radarArea, angle, 1); Line2D line = new Line2D.Double(centre, endPoint); g2.setPaint(this.axisLinePaint); g2.setStroke(this.axisLineStroke); g2.draw(line); drawLabel(g2, radarArea, 0.0, cat, angle, 360.0 / catCount); } for (int series = 0; series < seriesCount; series++) { drawRadarPoly(g2, radarArea, centre, info, series, catCount, headH, headW); } } else { drawNoDataMessage(g2, area); } g2.setClip(savedClip); g2.setComposite(originalComposite); drawOutline(g2, area); } SpiderWebPlot();  SpiderWebPlot(CategoryDataset dataset);  SpiderWebPlot(CategoryDataset dataset, TableOrder extract); @Override String getPlotType(); CategoryDataset getDataset(); void setDataset(CategoryDataset dataset); boolean isWebFilled(); void setWebFilled(boolean flag); TableOrder getDataExtractOrder(); void setDataExtractOrder(TableOrder order); double getHeadPercent(); void setHeadPercent(double percent); double getStartAngle(); void setStartAngle(double angle); double getMaxValue(); void setMaxValue(double value); Rotation getDirection(); void setDirection(Rotation direction); double getInteriorGap(); void setInteriorGap(double percent); double getAxisLabelGap(); void setAxisLabelGap(double gap); Paint getAxisLinePaint(); void setAxisLinePaint(Paint paint); Stroke getAxisLineStroke(); void setAxisLineStroke(Stroke stroke); Paint getSeriesPaint(); void setSeriesPaint(Paint paint); Paint getSeriesPaint(int series); void setSeriesPaint(int series, Paint paint); Paint getBaseSeriesPaint(); void setBaseSeriesPaint(Paint paint); Paint getSeriesOutlinePaint(); void setSeriesOutlinePaint(Paint paint); Paint getSeriesOutlinePaint(int series); void setSeriesOutlinePaint(int series, Paint paint); Paint getBaseSeriesOutlinePaint(); void setBaseSeriesOutlinePaint(Paint paint); Stroke getSeriesOutlineStroke(); void setSeriesOutlineStroke(Stroke stroke); Stroke getSeriesOutlineStroke(int series); void setSeriesOutlineStroke(int series, Stroke stroke); Stroke getBaseSeriesOutlineStroke(); void setBaseSeriesOutlineStroke(Stroke stroke); Shape getLegendItemShape(); void setLegendItemShape(Shape shape); Font getLabelFont(); void setLabelFont(Font font); Paint getLabelPaint(); void setLabelPaint(Paint paint); CategoryItemLabelGenerator getLabelGenerator(); void setLabelGenerator(CategoryItemLabelGenerator generator); CategoryToolTipGenerator getToolTipGenerator(); void setToolTipGenerator(CategoryToolTipGenerator generator); CategoryURLGenerator getURLGenerator(); void setURLGenerator(CategoryURLGenerator generator); @Override List<LegendItem> getLegendItems(); @Override void draw(Graphics2D g2, Rectangle2D area, Point2D anchor,
            PlotState parentState, PlotRenderingInfo info); @Override boolean equals(Object obj); @Override Object clone(); }
SpiderWebPlot extends Plot implements Cloneable, Serializable { @Override public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor, PlotState parentState, PlotRenderingInfo info) { RectangleInsets insets = getInsets(); insets.trim(area); if (info != null) { info.setPlotArea(area); info.setDataArea(area); } drawBackground(g2, area); drawOutline(g2, area); Shape savedClip = g2.getClip(); g2.clip(area); Composite originalComposite = g2.getComposite(); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, getForegroundAlpha())); if (!DatasetUtilities.isEmptyOrNull(this.dataset)) { int seriesCount, catCount; if (this.dataExtractOrder == TableOrder.BY_ROW) { seriesCount = this.dataset.getRowCount(); catCount = this.dataset.getColumnCount(); } else { seriesCount = this.dataset.getColumnCount(); catCount = this.dataset.getRowCount(); } if (this.maxValue == DEFAULT_MAX_VALUE) { calculateMaxValue(seriesCount, catCount); } double gapHorizontal = area.getWidth() * getInteriorGap(); double gapVertical = area.getHeight() * getInteriorGap(); double X = area.getX() + gapHorizontal / 2; double Y = area.getY() + gapVertical / 2; double W = area.getWidth() - gapHorizontal; double H = area.getHeight() - gapVertical; double headW = area.getWidth() * this.headPercent; double headH = area.getHeight() * this.headPercent; double min = Math.min(W, H) / 2; X = (X + X + W) / 2 - min; Y = (Y + Y + H) / 2 - min; W = 2 * min; H = 2 * min; Point2D centre = new Point2D.Double(X + W / 2, Y + H / 2); Rectangle2D radarArea = new Rectangle2D.Double(X, Y, W, H); for (int cat = 0; cat < catCount; cat++) { double angle = getStartAngle() + (getDirection().getFactor() * cat * 360 / catCount); Point2D endPoint = getWebPoint(radarArea, angle, 1); Line2D line = new Line2D.Double(centre, endPoint); g2.setPaint(this.axisLinePaint); g2.setStroke(this.axisLineStroke); g2.draw(line); drawLabel(g2, radarArea, 0.0, cat, angle, 360.0 / catCount); } for (int series = 0; series < seriesCount; series++) { drawRadarPoly(g2, radarArea, centre, info, series, catCount, headH, headW); } } else { drawNoDataMessage(g2, area); } g2.setClip(savedClip); g2.setComposite(originalComposite); drawOutline(g2, area); } SpiderWebPlot();  SpiderWebPlot(CategoryDataset dataset);  SpiderWebPlot(CategoryDataset dataset, TableOrder extract); @Override String getPlotType(); CategoryDataset getDataset(); void setDataset(CategoryDataset dataset); boolean isWebFilled(); void setWebFilled(boolean flag); TableOrder getDataExtractOrder(); void setDataExtractOrder(TableOrder order); double getHeadPercent(); void setHeadPercent(double percent); double getStartAngle(); void setStartAngle(double angle); double getMaxValue(); void setMaxValue(double value); Rotation getDirection(); void setDirection(Rotation direction); double getInteriorGap(); void setInteriorGap(double percent); double getAxisLabelGap(); void setAxisLabelGap(double gap); Paint getAxisLinePaint(); void setAxisLinePaint(Paint paint); Stroke getAxisLineStroke(); void setAxisLineStroke(Stroke stroke); Paint getSeriesPaint(); void setSeriesPaint(Paint paint); Paint getSeriesPaint(int series); void setSeriesPaint(int series, Paint paint); Paint getBaseSeriesPaint(); void setBaseSeriesPaint(Paint paint); Paint getSeriesOutlinePaint(); void setSeriesOutlinePaint(Paint paint); Paint getSeriesOutlinePaint(int series); void setSeriesOutlinePaint(int series, Paint paint); Paint getBaseSeriesOutlinePaint(); void setBaseSeriesOutlinePaint(Paint paint); Stroke getSeriesOutlineStroke(); void setSeriesOutlineStroke(Stroke stroke); Stroke getSeriesOutlineStroke(int series); void setSeriesOutlineStroke(int series, Stroke stroke); Stroke getBaseSeriesOutlineStroke(); void setBaseSeriesOutlineStroke(Stroke stroke); Shape getLegendItemShape(); void setLegendItemShape(Shape shape); Font getLabelFont(); void setLabelFont(Font font); Paint getLabelPaint(); void setLabelPaint(Paint paint); CategoryItemLabelGenerator getLabelGenerator(); void setLabelGenerator(CategoryItemLabelGenerator generator); CategoryToolTipGenerator getToolTipGenerator(); void setToolTipGenerator(CategoryToolTipGenerator generator); CategoryURLGenerator getURLGenerator(); void setURLGenerator(CategoryURLGenerator generator); @Override List<LegendItem> getLegendItems(); @Override void draw(Graphics2D g2, Rectangle2D area, Point2D anchor,
            PlotState parentState, PlotRenderingInfo info); @Override boolean equals(Object obj); @Override Object clone(); static final double DEFAULT_HEAD; static final double DEFAULT_AXIS_LABEL_GAP; static final double DEFAULT_INTERIOR_GAP; static final double MAX_INTERIOR_GAP; static final double DEFAULT_START_ANGLE; static final Font DEFAULT_LABEL_FONT; static final Paint DEFAULT_LABEL_PAINT; static final Paint DEFAULT_LABEL_BACKGROUND_PAINT; static final Paint DEFAULT_LABEL_OUTLINE_PAINT; static final Stroke DEFAULT_LABEL_OUTLINE_STROKE; static final Paint DEFAULT_LABEL_SHADOW_PAINT; static final double DEFAULT_MAX_VALUE; }