#381 Wafer Map Cell Text/Tooltip

open
David Gilbert
General (246)
5
2011-08-16
2011-08-15
james
No

Hi,

Can we add a feature to insert text values to wafer map cells? This will serve useful to easier correlate legends and cell values.

Thanks!

Discussion

  • james
    james
    2011-08-16

    • assigned_to: nobody --> mungady
     
  • james
    james
    2011-08-16

    Can we also integrate tooltips to wafermap cells?

     
  • james
    james
    2011-08-16

    • summary: Wafer Map Cell Text --> Wafer Map Cell Text/Tooltip
     
  • james
    james
    2011-09-01

    Hi,

    I have modified the org.jfree.chart.plot.WaferMapPlot.java to enable the option to allow wafer map cell values to be displayed on the wafer map chart. (Right now the cell values are always being displayed, a flag that will handle the display behavior needs to be incorporated)

    Drilling down... the change was made on drawChipGrid() method. (I included comments to show where the modifications took place)

    Please let me know if you have any suggestions or any thoughts about the change. Thanks!

    ...

    /**
    * Calculates and draws the chip locations on the wafer.
    *
    * @param g2 the graphics device.
    * @param plotArea the plot area.
    */
    protected void drawChipGrid(Graphics2D g2, Rectangle2D plotArea) {

    Shape savedClip = g2.getClip();
    g2.setClip(getWaferEdge(plotArea));
    Rectangle2D chip = new Rectangle2D.Double();
    int xchips = 35;
    int ychips = 20;
    double space = 1d;
    if (this.dataset != null) {
    xchips = this.dataset.getMaxChipX() + 2;
    ychips = this.dataset.getMaxChipY() + 2;
    space = this.dataset.getChipSpace();
    }
    double startX = plotArea.getX();
    double startY = plotArea.getY();
    double chipWidth = 1d;
    double chipHeight = 1d;
    if (plotArea.getWidth() != plotArea.getHeight()) {
    double major = 0d;
    double minor = 0d;
    if (plotArea.getWidth() > plotArea.getHeight()) {
    major = plotArea.getWidth();
    minor = plotArea.getHeight();
    } else {
    major = plotArea.getHeight();
    minor = plotArea.getWidth();
    }
    //set upperLeft point
    if (plotArea.getWidth() == minor) { // x is minor
    startY += (major - minor) / 2;
    chipWidth = (plotArea.getWidth() - (space * xchips - 1))
    / xchips;
    chipHeight = (plotArea.getWidth() - (space * ychips - 1))
    / ychips;
    } else { // y is minor
    startX += (major - minor) / 2;
    chipWidth = (plotArea.getHeight() - (space * xchips - 1))
    / xchips;
    chipHeight = (plotArea.getHeight() - (space * ychips - 1))
    / ychips;
    }
    }

    for (int x = 1; x <= xchips; x++) {
    double upperLeftX = (startX - chipWidth) + (chipWidth * x)
    + (space * (x - 1));
    for (int y = 1; y <= ychips; y++) {
    double upperLeftY = (startY - chipHeight) + (chipHeight * y)
    + (space * (y - 1));
    chip.setFrame(upperLeftX, upperLeftY, chipWidth, chipHeight);
    g2.setColor(Color.white);
    // Start of modification //
    String chipValueString = new String(" ");

    Number chipValue = this.dataset.getChipValue(x - 1, ychips - y - 1);
    if (chipValue != null) {
    g2.setPaint(this.renderer.getChipColor(chipValue));
    chipValueString = String.valueOf(chipValue.intValue());
    }

    g2.fill(chip);
    g2.setColor(Color.lightGray);
    g2.draw(chip);

    g2.setColor(Color.black);
    Rectangle2D bounds = chip.getBounds2D();
    //int fontSize = (int) (Math.floor(bounds.getMaxX()) - Math.floor(bounds.getMinX()));
    //fontSize = fontSize / chipValueString.length();
    int fontSize = (int) (Math.floor(bounds.getHeight() / 2));

    Font font = new Font("SanSerif", Font.PLAIN, fontSize);
    FontRenderContext frc = g2.getFontRenderContext();
    TextLayout layout = new TextLayout(chipValueString, font, frc);

    Float xCoordinate = new Float(bounds.getMinX());
    Float yCoordinate = new Float(bounds.getMaxY());

    layout.draw(g2, xCoordinate, yCoordinate);
    // End of modification //
    }
    }
    g2.setClip(savedClip);
    }