Example usage for java.awt AlphaComposite getInstance

List of usage examples for java.awt AlphaComposite getInstance

Introduction

In this page you can find the example usage for java.awt AlphaComposite getInstance.

Prototype

public static AlphaComposite getInstance(int rule, float alpha) 

Source Link

Document

Creates an AlphaComposite object with the specified rule and the constant alpha to multiply with the alpha of the source.

Usage

From source file:org.nuclos.client.ui.resplan.header.JHeaderGrid.java

@Override
protected void paintComponent(Graphics g) {
    Graphics2D g2d = (Graphics2D) g;

    super.paintComponent(g2d);

    g2d.setPaint(gridColor);/*from  w  ww .  j av  a 2 s. c o m*/

    Rectangle clipBounds = g.getClipBounds();

    int[] indices = stripRangeForRect(clipBounds);
    int startIndex = indices[0];
    int endIndex = indices[1];

    Point p1, p2;
    p1 = new Point();
    p2 = new Point(getWidth(), getHeight());
    for (int i = startIndex; i <= endIndex; i++) {
        int gridLine = getGridLine(i);
        orientation.updateCoord(p1, gridLine);
        orientation.updateCoord(p2, gridLine);
        g2d.drawLine(p1.x, p1.y, p2.x, p2.y);
    }

    p1.setLocation(0, 0);
    p2.setLocation(getWidth(), getHeight());
    int groupGridLine = 0;
    for (CategoryView v : groupings) {
        groupGridLine += v.size;
        orientation.opposite().updateCoord(p1, groupGridLine);
        orientation.opposite().updateCoord(p2, groupGridLine);
        g2d.drawLine(p1.x, p1.y, p2.x, p2.y);
        groupGridLine += GRID_SIZE;
    }

    for (int level = 0, levelCount = groupings.length; level < levelCount; level++) {
        for (HeaderCell cell : groupings[level].cells) {
            if (cell.endIndex < startIndex || cell.startIndex >= endIndex)
                continue;
            Rectangle rect = getRect(level, cell.startIndex, cell.endIndex);
            if (clipBounds != null && !clipBounds.intersects(rect))
                continue;
            paintHeaderCell(g2d, rect, cell.levelValue);
        }
    }

    if (cellResizingRange != null) {
        Rectangle rect = new Rectangle(getWidth(), getHeight());
        orientation.updateRange(rect, cellResizingRange);
        rect.grow(orientation.select(GRID_SIZE, 0), orientation.select(0, GRID_SIZE));
        g2d.setColor(new Color(0x9999ff, false));
        g2d.draw(rect);
        g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 0.5f));
        g2d.fill(rect);
    }
}

From source file:MyJava3D.java

public void setComposite(boolean cp) {
    composite = cp ? AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f) : null;
}

From source file:com.josue.tileset.editor.Editor.java

private BufferedImage getTileImage(int x, int y, BufferedImage tileSetImage) {

    BufferedImage tileImage;//from   ww w.j  a  v a  2 s .  c  o m
    Graphics2D tileGraphics;

    float opacity = 1L;
    tileImage = createTileImage();
    tileGraphics = tileImage.createGraphics();
    tileGraphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, opacity));

    tileGraphics.drawImage(tileSetImage, 0, // destiny x1
            0, // destiny y1
            TILE_SIZE, // destiny x2
            TILE_SIZE, // destiny y2
            x * TILE_SIZE, // source x1
            y * TILE_SIZE, // source y1
            x * TILE_SIZE + TILE_SIZE, // source x2
            y * TILE_SIZE + TILE_SIZE, // source y2
            null);

    return tileImage;
}

From source file:net.sf.maltcms.chromaui.charts.FastHeatMapPlot.java

/**
 * Draws the fast scatter plot on a Java 2D graphics device (such as the
 * screen or a printer).//from   w w w.j  a  va 2s  . c  om
 *
 * @param g2 the graphics device.
 * @param area the area within which the plot (including axis labels) should
 * be drawn.
 * @param anchor the anchor point (<code>null</code> permitted).
 * @param parentState the state from the parent plot (ignored).
 * @param info collects chart drawing information (<code>null</code>
 * permitted).
 */
@Override
public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor, PlotState parentState,
        PlotRenderingInfo info) {

    // set up info collection...
    if (info != null) {
        info.setPlotArea(area);
    }

    // adjust the drawing area for plot insets (if any)...
    RectangleInsets insets = getInsets();
    insets.trim(area);

    AxisSpace space = new AxisSpace();
    space = this.domainAxis.reserveSpace(g2, this, area, RectangleEdge.BOTTOM, space);
    space = this.rangeAxis.reserveSpace(g2, this, area, RectangleEdge.LEFT, space);
    Rectangle2D dataArea = space.shrink(area, null);

    if (info != null) {
        info.setDataArea(dataArea);
    }

    // draw the plot background and axes...
    drawBackground(g2, dataArea);

    AxisState domainAxisState = this.domainAxis.draw(g2, dataArea.getMaxY(), area, dataArea,
            RectangleEdge.BOTTOM, info);
    AxisState rangeAxisState = this.rangeAxis.draw(g2, dataArea.getMinX(), area, dataArea, RectangleEdge.LEFT,
            info);
    drawDomainGridlines(g2, dataArea, domainAxisState.getTicks());
    drawRangeGridlines(g2, dataArea, rangeAxisState.getTicks());

    Shape originalClip = g2.getClip();
    Composite originalComposite = g2.getComposite();

    g2.clip(dataArea);
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, getForegroundAlpha()));
    render(g2, dataArea, info, null);

    g2.setClip(originalClip);
    g2.setComposite(originalComposite);
    drawOutline(g2, dataArea);

}

From source file:edu.dlnu.liuwenpeng.render.CandlestickRenderer.java

/**    
* Draws the visual representation of a single data item.    
*    //ww  w  .j a  v a 2  s .c om
* @param g2  the graphics device.    
* @param state  the renderer state.    
* @param dataArea  the area within which the plot is being drawn.    
* @param info  collects info about the drawing.    
* @param plot  the plot (can be used to obtain standard color    
*              information etc).    
* @param domainAxis  the domain axis.    
* @param rangeAxis  the range axis.    
* @param dataset  the dataset.    
* @param series  the series index (zero-based).    
* @param item  the item index (zero-based).    
* @param crosshairState  crosshair information for the plot    
*                        (<code>null</code> permitted).    
* @param pass  the pass index.    
*/
public void drawItem(Graphics2D g2, XYItemRendererState state, Rectangle2D dataArea, PlotRenderingInfo info,
        XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset, int series, int item,
        CrosshairState crosshairState, int pass) {

    boolean horiz;
    PlotOrientation orientation = plot.getOrientation();
    if (orientation == PlotOrientation.HORIZONTAL) {
        horiz = true;
    } else if (orientation == PlotOrientation.VERTICAL) {
        horiz = false;
    } else {
        return;
    }

    // setup for collecting optional entity info...    
    EntityCollection entities = null;
    if (info != null) {
        entities = info.getOwner().getEntityCollection();
    }

    OHLCDataset highLowData = (OHLCDataset) dataset;

    double x = highLowData.getXValue(series, item);
    double yHigh = highLowData.getHighValue(series, item);
    double yLow = highLowData.getLowValue(series, item);
    double yOpen = highLowData.getOpenValue(series, item);
    double yClose = highLowData.getCloseValue(series, item);

    RectangleEdge domainEdge = plot.getDomainAxisEdge();
    double xx = domainAxis.valueToJava2D(x, dataArea, domainEdge);

    RectangleEdge edge = plot.getRangeAxisEdge();
    double yyHigh = rangeAxis.valueToJava2D(yHigh, dataArea, edge);
    double yyLow = rangeAxis.valueToJava2D(yLow, dataArea, edge);
    double yyOpen = rangeAxis.valueToJava2D(yOpen, dataArea, edge);
    double yyClose = rangeAxis.valueToJava2D(yClose, dataArea, edge);

    double volumeWidth;
    double stickWidth;
    if (this.candleWidth > 0) {
        // These are deliberately not bounded to minimums/maxCandleWidth to    
        //  retain old behaviour.    
        volumeWidth = this.candleWidth;
        stickWidth = this.candleWidth;
    } else {
        double xxWidth = 0;
        int itemCount;
        switch (this.autoWidthMethod) {

        case WIDTHMETHOD_AVERAGE:
            itemCount = highLowData.getItemCount(series);
            if (horiz) {
                xxWidth = dataArea.getHeight() / itemCount;
            } else {
                xxWidth = dataArea.getWidth() / itemCount;
            }
            break;

        case WIDTHMETHOD_SMALLEST:
            // Note: It would be nice to pre-calculate this per series    
            itemCount = highLowData.getItemCount(series);
            double lastPos = -1;
            xxWidth = dataArea.getWidth();
            for (int i = 0; i < itemCount; i++) {
                double pos = domainAxis.valueToJava2D(highLowData.getXValue(series, i), dataArea, domainEdge);
                if (lastPos != -1) {
                    xxWidth = Math.min(xxWidth, Math.abs(pos - lastPos));
                }
                lastPos = pos;
            }
            break;

        case WIDTHMETHOD_INTERVALDATA:
            IntervalXYDataset intervalXYData = (IntervalXYDataset) dataset;
            double startPos = domainAxis.valueToJava2D(intervalXYData.getStartXValue(series, item), dataArea,
                    plot.getDomainAxisEdge());
            double endPos = domainAxis.valueToJava2D(intervalXYData.getEndXValue(series, item), dataArea,
                    plot.getDomainAxisEdge());
            xxWidth = Math.abs(endPos - startPos);
            break;

        }
        xxWidth -= 2 * this.autoWidthGap;
        xxWidth *= this.autoWidthFactor;
        xxWidth = Math.min(xxWidth, this.maxCandleWidth);
        volumeWidth = Math.max(Math.min(1, this.maxCandleWidth), xxWidth);
        stickWidth = Math.max(Math.min(3, this.maxCandleWidth), xxWidth);
    }

    Paint p = getItemPaint(series, item);
    Paint outlinePaint = null;
    if (this.useOutlinePaint) {
        outlinePaint = getItemOutlinePaint(series, item);
    }
    Stroke s = getItemStroke(series, item);

    g2.setStroke(s);

    if (this.drawVolume) {
        int volume = (int) highLowData.getVolumeValue(series, item);
        double volumeHeight = volume / this.maxVolume;

        double min, max;
        if (horiz) {
            min = dataArea.getMinX();
            max = dataArea.getMaxX();
        } else {
            min = dataArea.getMinY();
            max = dataArea.getMaxY();
        }

        double zzVolume = volumeHeight * (max - min);

        g2.setPaint(getVolumePaint());
        Composite originalComposite = g2.getComposite();
        g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.3f));

        if (horiz) {
            g2.fill(new Rectangle2D.Double(min, xx - volumeWidth / 2, zzVolume, volumeWidth));
        } else {
            g2.fill(new Rectangle2D.Double(xx - volumeWidth / 2, max - zzVolume, volumeWidth, zzVolume));
        }

        g2.setComposite(originalComposite);
    }

    if (this.useOutlinePaint) {
        g2.setPaint(outlinePaint);
    } else {
        g2.setPaint(p);
    }

    double yyMaxOpenClose = Math.max(yyOpen, yyClose);
    double yyMinOpenClose = Math.min(yyOpen, yyClose);
    double maxOpenClose = Math.max(yOpen, yClose);
    double minOpenClose = Math.min(yOpen, yClose);

    // draw the upper shadow    
    if (yHigh > maxOpenClose) {
        if (yClose > yOpen) {
            g2.setPaint(Color.green);
        } else {
            g2.setPaint(Color.red);

        }
        if (horiz) {
            g2.draw(new Line2D.Double(yyHigh, xx, yyMaxOpenClose, xx));
        } else {
            g2.draw(new Line2D.Double(xx, yyHigh, xx, yyMaxOpenClose));
        }
    }

    // draw the lower shadow    
    if (yLow < minOpenClose) {
        if (yClose > yOpen) {
            g2.setPaint(Color.green);
        } else {
            g2.setPaint(Color.red);

        }
        if (horiz) {
            g2.draw(new Line2D.Double(yyLow, xx, yyMinOpenClose, xx));
        } else {
            g2.draw(new Line2D.Double(xx, yyLow, xx, yyMinOpenClose));
        }
    }

    // draw the body    
    Rectangle2D body = null;
    Rectangle2D hotspot = null;
    double length = Math.abs(yyHigh - yyLow);
    double base = Math.min(yyHigh, yyLow);
    if (horiz) {
        body = new Rectangle2D.Double(yyMinOpenClose, xx - stickWidth / 2, yyMaxOpenClose - yyMinOpenClose,
                stickWidth);

        hotspot = new Rectangle2D.Double(base, xx - stickWidth / 2, length, stickWidth);
    } else {
        body = new Rectangle2D.Double(xx - stickWidth / 2, yyMinOpenClose, stickWidth,
                yyMaxOpenClose - yyMinOpenClose);
        hotspot = new Rectangle2D.Double(xx - stickWidth / 2, base, stickWidth, length);

    }
    if (yClose > yOpen) {
        if (this.upPaint != null) {
            g2.setPaint(this.upPaint);
        } else {
            g2.setPaint(p);
        }
        g2.fill(body);
    } else {
        if (this.downPaint != null) {
            g2.setPaint(this.downPaint);
        } else {
            g2.setPaint(p);
        }
        g2.fill(body);
    }
    if (this.useOutlinePaint) {
        g2.setPaint(outlinePaint);

    } else {
        if (yClose > yOpen) {
            g2.setPaint(Color.green);

        } else {
            g2.setPaint(p);
        }
    }
    g2.draw(body);

    // add an entity for the item...    
    if (entities != null) {
        addEntity(entities, hotspot, dataset, series, item, 0.0, 0.0);
    }

}

From source file:com.joey.software.regionSelectionToolkit.controlers.ImageProfileTool.java

@Override
public void draw(Graphics2D g) {
    if (isBlockUpdate()) {
        return;//from   w  ww. ja  v a2  s .co  m
    }
    updateSelectionData();

    float tra = (transparance.getValue() / (float) (transparance.getMaximum()));

    float lineSize = 1f / (float) panel.getScale();
    float crossSize = (float) (pointSize / panel.getScale());

    RenderingHints oldHinds = g.getRenderingHints();
    Composite oldcomp = g.getComposite();
    Stroke oldStroke = g.getStroke();
    g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, tra));
    g.setStroke(new BasicStroke(lineSize));
    GraphicsToolkit.setRenderingQuality(g, GraphicsToolkit.HIGH_QUALITY);
    Line2D.Double line = new Line2D.Double();

    double x1 = 0;
    double x2 = 0;
    double y1 = 0;
    double y2 = 0;
    for (int i = 0; i < selectionData.length - 1; i++) {
        if (axis == AXIS_X) {
            y1 = view.getImage().getHeight() / (double) (selectionData.length - 1) * i;
            x1 = view.getImage().getWidth() * (1 - getSelectionValue(i));

            y2 = view.getImage().getHeight() / (double) (selectionData.length - 1) * (i + 1);
            x2 = view.getImage().getWidth() * (1 - getSelectionValue(i + 1));
        } else if (axis == AXIS_Y) {
            x1 = view.getImage().getWidth() / (double) (selectionData.length - 1) * i;
            y1 = view.getImage().getHeight() * (1 - getSelectionValue(i));

            x2 = view.getImage().getWidth() / (double) (selectionData.length - 1) * (i + 1);
            y2 = view.getImage().getHeight() * (1 - getSelectionValue(i + 1));
        }

        if (getUseData(i)) {
            g.setColor(getPointColorSelected());
        } else {
            g.setColor(getPointColorNotSelected());
        }
        line.x1 = x1;
        line.x2 = x2;
        line.y1 = y1;
        line.y2 = y2;

        g.draw(line);

        if (showOffset.isSelected()) {
            if (getUseData(i)) {
                g.setColor(getOffsetColor());
                double offset = (Double) this.offset.getValue();

                if (axis == AXIS_X) {
                    line.x1 += offset;
                    line.x2 += offset;

                } else if (axis == AXIS_Y) {
                    line.y1 += offset;
                    line.y2 += offset;
                }
                g.draw(line);
            }
        }
    }

    // Draw each point
    if (drawCrosses) {
        double x = 0;
        double y = 0;
        for (int i = 0; i < value.length; i++) {

            if (axis == AXIS_X) {
                y = view.getImage().getHeight() / (double) (value.length - 1) * i;
                x = view.getImage().getWidth() * (1 - value[i]);
            } else if (axis == AXIS_Y) {
                x = view.getImage().getWidth() / (double) (value.length - 1) * i;
                y = view.getImage().getHeight() * (1 - value[i]);
            }
            DrawTools.drawCross(g, new Point2D.Double(x, y), crossSize, 0, getCrossColor(), lineSize);

        }
    }
    g.setComposite(oldcomp);
    g.setStroke(oldStroke);
    g.setRenderingHints(oldHinds);
}

From source file:org.yccheok.jstock.gui.Utils.java

public static AlphaComposite makeComposite(float alpha) {
    int type = AlphaComposite.SRC_OVER;
    return (AlphaComposite.getInstance(type, alpha));
}

From source file:net.sf.maltcms.chromaui.charts.FastHeatMapPlot.java

private void createImage(Graphics2D g2, Rectangle2D dataArea, PlotRenderingInfo info,
        CrosshairState crosshairState) {
    //System.out.println("Creating image! - new");
    BufferedImage bi = createCompatibleImage(this.width, this.height, BufferedImage.TRANSLUCENT);
    float alpha = getDatasetCount() == 1 ? 1.0f : 1.0f / (float) getDatasetCount();
    for (int i = 0; i < getDatasetCount(); i++) {
        XYBlockRenderer xybr = (XYBlockRenderer) getRenderer(i);
        //            System.out.println("alpha in plot " + ((GradientPaintScale) xybr.getPaintScale()).getAlpha());
        //            System.out.println("beta in plot " + ((GradientPaintScale) xybr.getPaintScale()).getBeta());
        //((GradientPaintScale) xybr.getPaintScale()).setAlphaBeta(0, 1);
        //            System.out.println("ramp in plot " + Arrays.deepToString(((GradientPaintScale) xybr.getPaintScale()).getRamp()));
        XYZDataset xyzd = (XYZDataset) getDataset(i);
        BufferedImage bi2 = prepareData(xyzd, this.width, this.height, xybr, g2, dataArea, info, null);
        Graphics2D gg2 = bi.createGraphics();
        gg2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha));
        gg2.drawImage(bi2, 0, 0, null);/*from www.  j a  v a  2  s.c  om*/
    }
    setDataImage(bi, new Range(0, this.width - 1), new Range(0, this.height - 1));
}

From source file:net.geoprism.dashboard.DashboardMap.java

/**
 * Builds a combined image layer of all the layers in a saved map.
 * //from www. ja  va 2 s  .c  o m
 * @mapWidth
 * @mapHeight
 * @orderedLayers
 * @mapBounds - expects json object {"bottom":"VALUE", "top":"VALUE", "left":"VALUE", "right":"VALUE"}
 */
public BufferedImage getLayersExportCanvas(int mapWidth, int mapHeight, DashboardLayer[] orderedLayers,
        String mapBounds) {
    String bottom;
    String top;
    String right;
    String left;
    String processingFormat = "png"; // needed to allow transparency on each overlay before combining to a single
                                     // map/format
    Graphics mapBaseGraphic = null;
    BufferedImage base = null;

    try {
        base = new BufferedImage(mapWidth, mapHeight, BufferedImage.TYPE_INT_ARGB);
        mapBaseGraphic = base.getGraphics();
        mapBaseGraphic.drawImage(base, 0, 0, null);

        // Get bounds of the map
        try {
            JSONObject mapBoundsObj = new JSONObject(mapBounds);
            bottom = mapBoundsObj.getString("bottom");
            top = mapBoundsObj.getString("top");
            right = mapBoundsObj.getString("right");
            left = mapBoundsObj.getString("left");
        } catch (JSONException e) {
            String error = "Could not parse map bounds.";
            throw new ProgrammingErrorException(error, e);
        }

        // Generates map overlays and combines them into a single map image
        for (DashboardLayer layer : orderedLayers) {
            // if (layer instanceof DashboardThematicLayer)
            // {
            Graphics2D newOverlayBaseGraphic = null;
            Graphics2D mapLayerGraphic2d = null;

            String layersString = GeoserverProperties.getWorkspace() + ":" + layer.getViewName();

            StringBuffer requestURL = new StringBuffer();
            requestURL.append(GeoserverProperties.getLocalPath() + "/wms?");
            requestURL.append("LAYERS=" + layersString);
            requestURL.append("&");
            requestURL.append("STYLES="); // there are no geoserver styles being added. sld's are used instead
            requestURL.append("&");
            requestURL.append("SRS=EPSG%3A4326");
            requestURL.append("&");
            requestURL.append("TRANSPARENT=true");
            requestURL.append("&");
            requestURL.append("ISBASELAYER=false"); // in the browser the baselayer prop is set for the 1st layer in the
                                                    // map.
            requestURL.append("&");
            requestURL.append(
                    "SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&EXCEPTIONS=application%2Fvnd.ogc.se_inimage");
            requestURL.append("&");
            requestURL.append("FORMAT=image%2F" + processingFormat);
            requestURL.append("&");
            requestURL.append("BBOX=" + left + "," + bottom + "," + right + "," + top);
            requestURL.append("&");
            requestURL.append("WIDTH=" + Integer.toString(mapWidth));
            requestURL.append("&");
            requestURL.append("HEIGHT=" + Integer.toString(mapHeight));

            try {
                BufferedImage layerImg = this.getImageFromGeoserver(requestURL.toString());
                BufferedImage newOverlayBase = new BufferedImage(mapWidth, mapHeight,
                        BufferedImage.TYPE_INT_ARGB);

                newOverlayBaseGraphic = newOverlayBase.createGraphics();

                // Add transparency to the layerGraphic
                // This is set in JavaScript in the app so we are replicating browser side transparency settings that are
                // applied to the whole layer
                AlphaComposite thisLayerComposite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
                        this.getLayerOpacity(layer));
                mapLayerGraphic2d = layerImg.createGraphics();
                newOverlayBaseGraphic.setComposite(thisLayerComposite);

                // Add the current layerGraphic to the base image
                newOverlayBaseGraphic.drawImage(layerImg, 0, 0, null);
                mapBaseGraphic.drawImage(newOverlayBase, 0, 0, null);

            } finally {
                if (newOverlayBaseGraphic != null) {
                    newOverlayBaseGraphic.dispose();
                }

                if (mapLayerGraphic2d != null) {
                    mapLayerGraphic2d.dispose();
                }
            }
            // }
        }
    } finally {
        mapBaseGraphic.dispose();
    }

    return base;
}

From source file:genlab.gui.jfreechart.EnhancedSpiderWebPlot.java

/**
 * Draws the plot on a Java 2D graphics device (such as the screen or a
 * printer)./*from  w ww .  j  a  v  a  2  s.c o m*/
 *
 * @param g2  the graphics device.
 * @param area  the area within which the plot should be drawn.
 * @param anchor  the anchor point (<code>null</code> permitted).
 * @param parentState  the state from the parent plot, if there is one.
 * @param info  collects info about the drawing.
 */
public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor, PlotState parentState,
        PlotRenderingInfo info) {

    // adjust for insets...
    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 = 0, catCount = 0;

        if (this.dataExtractOrder == TableOrder.BY_ROW) {
            seriesCount = this.dataset.getRowCount();
            catCount = this.dataset.getColumnCount();
        } else {
            seriesCount = this.dataset.getColumnCount();
            catCount = this.dataset.getRowCount();
        }

        // ensure we have a maximum value to use on the axes
        if (this.maxValue == DEFAULT_MAX_VALUE)
            calculateMaxValue(seriesCount, catCount);

        // Next, setup the plot area

        // adjust the plot area by the interior spacing value

        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;

        // make the chart area a square
        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);

        // draw the axis and category label
        for (int cat = 0; cat < catCount; cat++) {
            double angle = getStartAngle()
                    + (getDirection().getFactor() * cat * 360 / (catCount > 2 ? catCount : 3));

            Point2D endPoint = getWebPoint(radarArea, angle, 1);
            // 1 = end of axis
            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 > 2 ? catCount : 3));
        }

        // Now actually plot each of the series polygons..
        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);
}