Example usage for java.awt Graphics2D setFont

List of usage examples for java.awt Graphics2D setFont

Introduction

In this page you can find the example usage for java.awt Graphics2D setFont.

Prototype

public abstract void setFont(Font font);

Source Link

Document

Sets this graphics context's font to the specified font.

Usage

From source file:net.sf.jasperreports.chartthemes.spring.ScaledDialValueIndicator.java

/**
 * Draws the background to the specified graphics device.  If the dial
 * frame specifies a window, the clipping region will already have been
 * set to this window before this method is called.
 *
 * @param g2  the graphics device (<code>null</code> not permitted).
 * @param plot  the plot (ignored here).
 * @param frame  the dial frame (ignored here).
 * @param view  the view rectangle (<code>null</code> not permitted).
 *//*from   w  ww .j a v a 2 s.  co m*/
@Override
public void draw(Graphics2D g2, DialPlot plot, Rectangle2D frame, Rectangle2D view) {

    // work out the anchor point
    Rectangle2D f = DialPlot.rectangleByRadius(frame, getRadius(), this.getRadius());
    Arc2D arc = new Arc2D.Double(f, this.getAngle(), 0.0, Arc2D.OPEN);
    Point2D pt = arc.getStartPoint();

    // calculate the bounds of the template value
    FontMetrics fm = g2.getFontMetrics(this.getFont());
    String s = this.getNumberFormat().format(this.getTemplateValue());
    Rectangle2D tb = TextUtilities.getTextBounds(s, g2, fm);

    // align this rectangle to the frameAnchor
    Rectangle2D bounds = RectangleAnchor.createRectangle(new Size2D(tb.getWidth(), tb.getHeight()), pt.getX(),
            pt.getY(), this.getFrameAnchor());

    // add the insets
    Rectangle2D fb = this.getInsets().createOutsetRectangle(bounds);

    // draw the background
    g2.setPaint(this.getBackgroundPaint());
    g2.fill(fb);

    // draw the border
    g2.setStroke(this.getOutlineStroke());
    g2.setPaint(this.getOutlinePaint());
    g2.draw(fb);

    // now find the text anchor point
    String valueStr = this.getNumberFormat()
            .format(ChartThemesUtilities.getScaledValue(plot.getValue(this.getDatasetIndex()), scale));
    Point2D pt2 = RectangleAnchor.coordinates(bounds, this.getValueAnchor());
    g2.setPaint(this.getPaint());
    g2.setFont(this.getFont());
    TextUtilities.drawAlignedString(valueStr, g2, (float) pt2.getX(), (float) pt2.getY(), this.getTextAnchor());

}

From source file:org.prom5.analysis.performance.dottedchart.ui.DottedChartPanel.java

/**
 * convenience method for internal use./*from  ww  w . j  av  a  2s .c  o m*/
 * paints the log lane, with time indicators.
 * @param gOrig
 * @param dMin date on the left boundary
 * @param dMax date on the right boundary
 */
protected void paintComponentLane(Graphics2D g, int width, int hight) {
    g.setFont(g.getFont().deriveFont((float) 10.0));
    // set initial colors
    Color fgColor = null;
    Color bgColor = null;
    Color tmpColor = null;
    fgColor = null;
    bgColor = null;
    // calculate common coordinates
    int unitHeight = hight / getHashMapSize();
    int yTop = 0;
    int yBottom = hight;
    int pixStart = 0;
    String dateStr, timeStr, millisStr = null;

    // calculate area to be painted
    clipL = 0;
    clipR = width;

    // initialze start color
    fgColor = colorLogDark;
    bgColor = colorLogBright;

    // calculate current top
    int currentTop = yTop;

    // paint actual log lane (only the part in the clipping range determined)
    Iterator itr = dcModel.getSortedKeySetList().iterator(); //dcModel.getItemMap().keySet().iterator();
    g.setFont(new Font("Dialog", Font.BOLD, 13));
    int index = 0;
    currentTop = yTop;
    while (itr.hasNext()) {
        String dimName = (String) itr.next();
        if (dcModel.getTypeHashMap().equals(ST_INST) && !dcModel.getInstanceTypeToKeep().contains(dimName))
            continue;
        g.setColor(bgColor);
        g.fillRect(pixStart, currentTop, clipR, currentTop + unitHeight);

        g.setColor(fgColor);

        index++;
        currentTop = unit2Cord_buffer(index, hight);

        // swap colors
        tmpColor = fgColor;
        fgColor = bgColor;
        bgColor = tmpColor;
    }

    g.setFont(new Font("Dialog", Font.PLAIN, 12));

    // draw horizontal delimiters
    g.setColor(colorTimeLine);
    g.drawLine(clipL, yTop, clipR, yTop);
    g.drawLine(clipL, yBottom, clipR, yBottom);

    clipLeftTs = coord2timeMillis(clipL);
    clipRightTs = coord2timeMillis(clipR);
}

From source file:KIDLYRenderer.java

/**
 * Draws an item label.  This method is overridden so that the bar can be
 * used to calculate the label anchor point.
 *
 * @param g2  the graphics device.//  w ww .j  a  v  a2s  .  c  o m
 * @param data  the dataset.
 * @param row  the row.
 * @param column  the column.
 * @param plot  the plot.
 * @param generator  the label generator.
 * @param bar  the bar.
 * @param negative  a flag indicating a negative value.
 */
protected void drawItemLabel(Graphics2D g2, CategoryDataset data, int row, int column, CategoryPlot plot,
        CategoryItemLabelGenerator generator, Rectangle2D bar, boolean negative) {

    String label = generator.generateLabel(data, row, column);
    if (label == null) {
        return; // nothing to do
    }

    Font labelFont = getItemLabelFont(row, column);
    g2.setFont(labelFont);
    Paint paint = getItemLabelPaint(row, column);
    g2.setPaint(paint);

    // find out where to place the label...
    ItemLabelPosition position = null;
    if (!negative) {
        position = getPositiveItemLabelPosition(row, column);
    } else {
        position = getNegativeItemLabelPosition(row, column);
    }

    // work out the label anchor point...
    Point2D anchorPoint = calculateLabelAnchorPoint(position.getItemLabelAnchor(), bar, plot.getOrientation());

    if (isInternalAnchor(position.getItemLabelAnchor())) {
        Shape bounds = TextUtilities.calculateRotatedStringBounds(label, g2, (float) anchorPoint.getX(),
                (float) anchorPoint.getY(), position.getTextAnchor(), position.getAngle(),
                position.getRotationAnchor());

        if (bounds != null) {
            if (!bar.contains(bounds.getBounds2D())) {
                if (!negative) {
                    position = getPositiveItemLabelPositionFallback();
                } else {
                    position = getNegativeItemLabelPositionFallback();
                }
                if (position != null) {
                    anchorPoint = calculateLabelAnchorPoint(position.getItemLabelAnchor(), bar,
                            plot.getOrientation());
                }
            }
        }

    }

    if (position != null) {
        TextUtilities.drawRotatedString(label, g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(),
                position.getTextAnchor(), position.getAngle(), position.getRotationAnchor());
    }
}

From source file:com.fluidops.iwb.deepzoom.ImageLoader.java

private void generateIDCard(URI uri, Map<URI, Set<Value>> facets, String url, File file) {
    int width = 200;
    int height = 200;

    BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);

    Graphics2D ig2 = bi.createGraphics();
    ig2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    ig2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);

    /* Special ID card handling for certain entity types */

    /*  TODO: special images based on type
    if(facets.containsKey(RDF.TYPE)) {//from  w ww  .j  a  v a 2 s .  c  o m
    Set<Value> facet = facets.get(RDF.TYPE);
            
    for(Value v : facet)
    {
        if(v.equals(Vocabulary.DCAT_DATASET))
        {
            
            Image img = null;
            try
            {
                img = ImageIO.read( new File( "webapps/ROOT/images/rdf.jpg" ) );
            }
            catch (MalformedURLException e)
            {
                logger.error(e.getMessage(), e);
            }
            catch (IOException e)
            {
                logger.error("Could not get image");
            }
            
            ig2.drawImage( img, 0, 0, null );        
            break;
        }
    }
    } */

    String label = EndpointImpl.api().getDataManager().getLabel(uri);
    Font font = new Font(Font.SANS_SERIF, Font.BOLD, 20);
    ig2.setFont(font);

    FontMetrics fontMetrics = ig2.getFontMetrics();
    int labelwidth = fontMetrics.stringWidth(label);
    if (labelwidth >= width) {
        int fontsize = 20 * width / labelwidth;
        font = new Font(Font.SANS_SERIF, Font.BOLD, fontsize);
        ig2.setFont(font);
        fontMetrics = ig2.getFontMetrics();
    }

    int x = (width - fontMetrics.stringWidth(label)) / 2;
    int y = (fontMetrics.getAscent() + (height - (fontMetrics.getAscent() + fontMetrics.getDescent())) / 2);

    ig2.setPaint(Color.black);

    ig2.drawString(label, x, y);

    BufferedOutputStream out;
    try {
        out = new BufferedOutputStream(new FileOutputStream(file));
        ImageIO.write(bi, "PNG", out);
        out.flush();
        out.close();

    } catch (IOException e) {
        logger.error(e.getMessage(), e);
    }
}

From source file:org.processmining.analysis.performance.dottedchart.ui.DottedChartPanel.java

/**
 * convenience method for internal use. paints the log lane, with time
 * indicators./*from  w w  w  .  j a  v a  2 s  .  c o  m*/
 * 
 * @param gOrig
 * @param dMin
 *            date on the left boundary
 * @param dMax
 *            date on the right boundary
 */
protected void paintComponentLane(Graphics2D g, int width, int hight) {
    g.setFont(g.getFont().deriveFont((float) 10.0));
    // set initial colors
    Color fgColor = null;
    Color bgColor = null;
    Color tmpColor = null;
    fgColor = null;
    bgColor = null;
    // calculate common coordinates
    int unitHeight = hight / getHashMapSize();
    int yTop = 0;
    int yBottom = hight;
    int pixStart = 0;
    String dateStr, timeStr, millisStr = null;

    // calculate area to be painted
    clipL = 0;
    clipR = width;

    // initialze start color
    fgColor = colorLogDark;
    bgColor = colorLogBright;

    // calculate current top
    int currentTop = yTop;

    // paint actual log lane (only the part in the clipping range
    // determined)
    Iterator itr = dcModel.getSortedKeySetList().iterator(); // dcModel.getItemMap().keySet().iterator();
    g.setFont(new Font("Dialog", Font.BOLD, 13));
    int index = 0;
    currentTop = yTop;
    while (itr.hasNext()) {
        String dimName = (String) itr.next();
        if (dcModel.getTypeHashMap().equals(ST_INST) && !dcModel.getInstanceTypeToKeep().contains(dimName))
            continue;
        g.setColor(bgColor);
        g.fillRect(pixStart, currentTop, clipR, currentTop + unitHeight);

        g.setColor(fgColor);

        index++;
        currentTop = unit2Cord_buffer(index, hight);

        // swap colors
        tmpColor = fgColor;
        fgColor = bgColor;
        bgColor = tmpColor;
    }

    g.setFont(new Font("Dialog", Font.PLAIN, 12));

    // draw horizontal delimiters
    g.setColor(colorTimeLine);
    g.drawLine(clipL, yTop, clipR, yTop);
    g.drawLine(clipL, yBottom, clipR, yBottom);

    clipLeftTs = coord2timeMillis(clipL);
    clipRightTs = coord2timeMillis(clipR);
}

From source file:org.sakaiproject.sitestats.impl.chart.ChartServiceImpl.java

private byte[] generateNoDataChart(int width, int height) {
    BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
    Graphics2D g2d = img.createGraphics();

    g2d.setBackground(parseColor(M_sm.getChartBackgroundColor()));
    g2d.clearRect(0, 0, width - 1, height - 1);
    g2d.setColor(parseColor("#cccccc"));
    g2d.drawRect(0, 0, width - 1, height - 1);
    Font f = new Font("SansSerif", Font.PLAIN, 12);
    g2d.setFont(f);
    FontMetrics fm = g2d.getFontMetrics(f);
    String noData = msgs.getString("no_data");
    int noDataWidth = fm.stringWidth(noData);
    int noDataHeight = fm.getHeight();
    g2d.setColor(parseColor("#555555"));
    g2d.drawString(noData, width / 2 - noDataWidth / 2, height / 2 - noDataHeight / 2 + 2);
    final ByteArrayOutputStream out = new ByteArrayOutputStream();
    try {/*from   w w w .j a va2  s  .  c  o  m*/
        ImageIO.write(img, "png", out);
    } catch (IOException e) {
        LOG.warn("Error occurred while generating SiteStats chart image data", e);
    }
    return out.toByteArray();
}

From source file:savant.view.swing.GraphPane.java

@Override
protected void paintComponent(Graphics g) {
    if (tracks != null && tracks.length > 0) {
        LOG.trace("GraphPane.paintComponent(" + tracks[0].getName() + ")");
    }//from ww w.  j  av  a2  s  . c  om
    super.paintComponent(g);

    Graphics2D g2 = (Graphics2D) g;
    boolean trueRender = render(g2);

    GraphPaneController gpc = GraphPaneController.getInstance();
    int h = getHeight();

    // Aiming adjustments.
    if (gpc.isAiming() && mouseInside) {
        g2.setColor(Color.BLACK);
        Font thickfont = g2.getFont().deriveFont(Font.BOLD, 15.0F);
        g2.setFont(thickfont);
        int genomeX = gpc.getMouseXPosition();
        double genomeY = gpc.getMouseYPosition();
        String target = "";
        target += "X: " + MiscUtils.numToString(genomeX);
        if (!Double.isNaN(genomeY)) {
            target += " Y: " + MiscUtils.numToString(genomeY);
        }

        g2.drawLine(mouseX, 0, mouseX, h);
        if (genomeY != -1) {
            g.drawLine(0, mouseY, this.getWidth(), mouseY);
        }
        g2.drawString(target, mouseX + 5, mouseY - 5);
    }

    double x1 = transformXPos(gpc.getMouseClickPosition());
    double x2 = transformXPos(gpc.getMouseReleasePosition());

    double width = x1 - x2;

    selectionRect = new Rectangle2D.Double(width < 0 ? x1 : x2, 0.0, Math.max(2.0, Math.abs(width)), h);

    if (gpc.isPanning()) {
        // Panning adjustments (none).
    } else if (gpc.isZooming() || gpc.isSelecting()) {
        // Zooming adjustments.
        Rectangle2D rectangle = new Rectangle2D.Double(selectionRect.getX(), selectionRect.getY() - 10.0,
                selectionRect.getWidth(), selectionRect.getHeight() + 10.0);
        g2.setColor(Color.gray);
        g2.setStroke(
                new BasicStroke(1f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 3f, new float[] { 4f }, 4f));
        g2.draw(rectangle);

        if (gpc.isZooming()) {
            g.setColor(ColourSettings.getColor(ColourKey.GRAPH_PANE_ZOOM_FILL));
        } else if (gpc.isSelecting()) {
            g.setColor(ColourSettings.getColor(ColourKey.GRAPH_PANE_SELECTION_FILL));
        }
        g2.fill(selectionRect);
    }

    // Plumbing adjustments.
    Range xRange = getXRange();
    if (gpc.isPlumbing()) {
        g2.setColor(Color.BLACK);
        double spos = transformXPos(gpc.getMouseXPosition());
        g2.draw(new Line2D.Double(spos, 0, spos, h));
        double rpos = transformXPos(gpc.getMouseXPosition() + 1);
        g2.draw(new Line2D.Double(rpos, 0, rpos, h));
    }

    // Spotlight
    if (gpc.isSpotlight() && !gpc.isZooming()) {

        int center = gpc.getMouseXPosition();
        int left = center - gpc.getSpotlightSize() / 2;
        int right = left + gpc.getSpotlightSize();

        g2.setColor(new Color(0, 0, 0, 200));

        // draw left of spotlight
        if (left >= xRange.getFrom()) {
            g2.fill(new Rectangle2D.Double(0.0, 0.0, transformXPos(left), h));
        }
        // draw right of spotlight
        if (right <= xRange.getTo()) {
            double pix = transformXPos(right);
            g2.fill(new Rectangle2D.Double(pix, 0, getWidth() - pix, h));
        }
    }

    if (isLocked()) {
        drawMessage((Graphics2D) g, "Locked");
    }
    if (trueRender) {
        gpc.delistRenderingGraphpane(this);
    }
}

From source file:org.sakaiproject.sitestats.impl.ServerWideReportManagerImpl.java

private byte[] generateNoDataChart(int width, int height) {
    BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
    Graphics2D g2d = img.createGraphics();

    g2d.setBackground(parseColor(statsManager.getChartBackgroundColor()));
    g2d.clearRect(0, 0, width - 1, height - 1);
    g2d.setColor(parseColor("#cccccc"));
    g2d.drawRect(0, 0, width - 1, height - 1);
    Font f = new Font("SansSerif", Font.PLAIN, 12);
    g2d.setFont(f);
    FontMetrics fm = g2d.getFontMetrics(f);
    String noData = msgs.getString("no_data");
    int noDataWidth = fm.stringWidth(noData);
    int noDataHeight = fm.getHeight();
    g2d.setColor(parseColor("#555555"));
    g2d.drawString(noData, width / 2 - noDataWidth / 2, height / 2 - noDataHeight / 2 + 2);
    final ByteArrayOutputStream out = new ByteArrayOutputStream();
    try {/*from ww  w  .ja v  a2 s  .c o  m*/
        ImageIO.write(img, "png", out);
    } catch (IOException e) {
        log.warn("Error occurred while generating SiteStats chart image data", e);
    }
    return out.toByteArray();
}

From source file:com.moviejukebox.plugin.DefaultImagePlugin.java

private BufferedImage drawText(BufferedImage bi, String outputText, boolean verticalAlign) {
    Graphics2D g2d = bi.createGraphics();
    g2d.setFont(new Font(textFont, Font.BOLD, textFontSize));
    FontMetrics fm = g2d.getFontMetrics();
    int textWidth = fm.stringWidth(outputText);
    int imageWidth = bi.getWidth();
    int imageHeight = bi.getHeight();
    int leftAlignment;
    int topAlignment;

    if (textAlignment.equalsIgnoreCase(LEFT)) {
        leftAlignment = textOffset;//from  w  w w . j a  v a 2s  . c  o  m
    } else if (textAlignment.equalsIgnoreCase(RIGHT)) {
        leftAlignment = imageWidth - textWidth - textOffset;
    } else {
        leftAlignment = (imageWidth / 2) - (textWidth / 2);
    }

    if (verticalAlign) {
        // Align the text to the top
        topAlignment = fm.getHeight() - 10;
    } else {
        // Align the text to the bottom
        topAlignment = imageHeight - 10;
    }

    // Create the drop shadow
    if (StringUtils.isNotBlank(textFontShadow)) {
        g2d.setColor(getColor(textFontShadow, Color.DARK_GRAY));
        g2d.drawString(outputText, leftAlignment + 2, topAlignment + 2);
    }

    // Create the text itself
    g2d.setColor(getColor(textFontColor, Color.LIGHT_GRAY));
    g2d.drawString(outputText, leftAlignment, topAlignment);

    g2d.dispose();
    return bi;
}

From source file:org.earthtime.UPb_Redux.dateInterpretation.WeightedMeanGraphPanel.java

private void drawAxesAndTicks(Graphics2D g2d, double rangeX, double rangeY) {

    // oct 2014 new tic logic
    // reset the clip bounds to paint axis and numbers
    g2d.setClip(0, 0, getWidth(), getHeight());

    g2d.setFont(new Font("Monospaced", Font.BOLD, 14));
    g2d.setPaint(Color.BLACK);/* www  . j  a  va2s .  c om*/
    g2d.setStroke(new BasicStroke(2.0f));

    // determine the axis ticks
    BigDecimal[] tics = TicGeneratorForAxes.generateTics(getMinY_Display(), getMaxY_Display(), 12);
    // trap for bad plot
    if (tics.length <= 1) {
        tics = new BigDecimal[0];
    }
    double minXDisplay = 0.0;
    int yAxisTicWidth = 8;
    int yTicLabelFrequency = 2;
    int labeledTicCountYAxis = 0;

    g2d.setPaint(Color.black);
    for (int i = 0; i < tics.length; i++) {

        double y = tics[i].doubleValue();

        if ((y > getMinY_Display()) // dont print across mappedX axis
                && (y < getMaxY_Display())) // dont print across top border
        {
            try {
                Shape ticMark = new Line2D.Double( //
                        mapX(getMinX_Display(), getMinX_Display(), rangeX, graphWidth),
                        mapY(y, getMaxY_Display(), rangeY, graphHeight),
                        mapX(getMinX_Display(), getMinX_Display(), rangeX, graphWidth) + 7,
                        mapY(y, getMaxY_Display(), rangeY, graphHeight));
                g2d.draw(ticMark);

                String intString = "00000" + tics[i].toPlainString().replace(".", "");
                int lastPlace = Integer.parseInt(intString.substring(intString.length() - 4));

                if (lastPlace % yTicLabelFrequency == 0) {
                    if (labeledTicCountYAxis % yTicLabelFrequency == 0) {

                        TextLayout mLayout = //
                                new TextLayout(tics[i].toPlainString(), g2d.getFont(),
                                        g2d.getFontRenderContext());

                        Rectangle2D bounds = mLayout.getBounds();

                        //if (isyAxisHorizontalTicLabels()) {
                        //                            g2d.drawString(tics[i].toPlainString(),//
                        //                                    (float) mapX(getMinX_Display(), getMinX_Display(), rangeX, graphWidth) - 4f,
                        //                                    (float) mapY(y, getMaxY_Display(), rangeY, graphHeight) + 30f);
                        //                            } else {
                        float yLabelCenterOffset = (float) mLayout.getBounds().getWidth() / 2f;

                        g2d.rotate(-Math.PI / 2.0,
                                (float) mapX(getMinX_Display(), getMinX_Display(), rangeX, graphWidth) - 4f,
                                (float) mapY(y, getMaxY_Display(), rangeY, graphHeight) + yLabelCenterOffset);
                        g2d.drawString(tics[i].toPlainString(),
                                (float) mapX(getMinX_Display(), getMinX_Display(), rangeX, graphWidth) - 4f,
                                (float) mapY(y, getMaxY_Display(), rangeY, graphHeight) + yLabelCenterOffset);
                        g2d.rotate(Math.PI / 2.0,
                                (float) mapX(getMinX_Display(), getMinX_Display(), rangeX, graphWidth) - 4f,
                                (float) mapY(y, getMaxY_Display(), rangeY, graphHeight) + yLabelCenterOffset);
                    }

                    labeledTicCountYAxis++;
                } else {

                    if (labeledTicCountYAxis > 0) {
                        labeledTicCountYAxis++;
                    }
                }
            } catch (Exception e) {
            }
        }
    }

    ////        // reset the clip bounds to paint axis and numbers
    ////        g2d.setClip(0, 0, getWidth(), getHeight());
    ////
    ////        g2d.setFont(new Font("Monospaced", Font.BOLD, 14));
    ////        g2d.setPaint(Color.BLACK);
    ////        g2d.setStroke(new BasicStroke(2.0f));
    ////
    ////        // determine the axis ticks
    ////        double minYtick = Math.ceil(getMinY_Display() * 100) / 100;
    ////        double maxYtick = Math.floor(getMaxY_Display() * 100) / 100;
    ////
    ////        int count = 0;
    ////        double deltay = Math.rint((maxYtick - minYtick) * 10 + 0.5);
    ////        double stepYtick = deltay / 100;
    ////
    ////        for (double y = minYtick; y
    ////                < maxYtick; y
    ////                += stepYtick) {
    ////            Line2D line = new Line2D.Double(
    ////                    mapX(getMinX_Display(), getMinX_Display(), rangeX, graphWidth),
    ////                    mapY(y, getMaxY_Display(), rangeY, graphHeight),
    ////                    mapX(getMinX_Display(), getMinX_Display(), rangeX, graphWidth) + 7,
    ////                    mapY(y, getMaxY_Display(), rangeY, graphHeight));
    ////            g2d.draw(line);
    ////
    ////            if ((count % 2) == 1) {
    ////                NumberFormat yFormat = null;
    ////                String temp = null;
    ////
    ////                yFormat
    ////                        = new DecimalFormat("0.00");
    ////                temp
    ////                        = yFormat.format(y);
    ////
    ////                g2d.setPaint(Color.black);
    ////                g2d.rotate(
    ////                        -Math.PI / 2.0,
    ////                        (float) mapX(getMinX_Display(), getMinX_Display(), rangeX, graphWidth) - 4f,
    ////                        (float) mapY(y, getMaxY_Display(), rangeY, graphHeight) + 30f);
    ////                g2d.drawString(
    ////                        temp,
    ////                        (float) mapX(getMinX_Display(), getMinX_Display(), rangeX, graphWidth) - 4f,
    ////                        (float) mapY(y, getMaxY_Display(), rangeY, graphHeight) + 30f);
    ////                g2d.rotate(
    ////                        Math.PI / 2.0,
    ////                        (float) mapX(getMinX_Display(), getMinX_Display(), rangeX, graphWidth) - 4f,
    ////                        (float) mapY(y, getMaxY_Display(), rangeY, graphHeight) + 30f);
    ////
    ////            }
    ////
    ////            count++;
    ////
    ////        }
    // draw and label axes
    g2d.setFont(new Font("Monospaced", Font.BOLD, 20));
    g2d.drawRect(getLeftMargin(), getTopMargin(), getGraphWidth() - 1, getGraphHeight() - 1);

}