Example usage for org.jfree.chart.entity CategoryLabelEntity getKey

List of usage examples for org.jfree.chart.entity CategoryLabelEntity getKey

Introduction

In this page you can find the example usage for org.jfree.chart.entity CategoryLabelEntity getKey.

Prototype

public Comparable getKey() 

Source Link

Document

Returns the category key.

Usage

From source file:net.sf.jsfcomp.chartcreator.renderkit.ChartRenderer.java

private void renderImageMapSupport(FacesContext context, UIChart uichart,
        ChartRenderingInfo chartRenderingInfo) {
    ResponseWriter writer = context.getResponseWriter();

    try {//from  w  ww.j  a v  a  2s  .c  om
        Iterator entities = chartRenderingInfo.getEntityCollection().iterator();
        while (entities.hasNext()) {
            ChartEntity entity = (ChartEntity) entities.next();
            if (entity instanceof CategoryLabelEntity) {
                CategoryLabelEntity categoryEntity = (CategoryLabelEntity) entity;
                if (categoryEntity.getKey() != null) {
                    categoryEntity.setToolTipText(categoryEntity.getKey().toString());
                    categoryEntity.setURLText("?category=" + categoryEntity.getKey().toString());
                }
            }
        }

        writer.write("<script>");
        writer.write("function chart" + uichart.getId() + "Click(data) {");

        if (uichart.getOngeneratedimagemapclick() != null)
            writer.write("  " + uichart.getOngeneratedimagemapclick() + "(data);");

        writer.write("}");
        writer.write("</script>");
    } catch (IOException error) {
        error.printStackTrace();
    }
}

From source file:com.intel.stl.ui.common.view.JumpChartPanel.java

@Override
public void chartMouseMoved(ChartMouseEvent cme) {
    JPopupMenu popup = getPopupMenu();
    if (popup != null && popup.isShowing()) {
        return;/* w w w  .  java  2  s .  c o  m*/
    }

    ChartEntity xyItem = cme.getEntity();
    if (xyItem instanceof CategoryLabelEntity) {
        CategoryLabelEntity newCatEntity = (CategoryLabelEntity) xyItem;
        if (highlightedEntity != null && newCatEntity.getKey().equals(highlightedEntity.getKey())) {
            return;
        }

        if (highlightedEntity != null) {
            highlightEntity(highlightedEntity, false);
        }

        highlightedEntity = (CategoryLabelEntity) xyItem;
        if (categoryAxis == null) {
            CategoryPlot plot = getChart().getCategoryPlot();
            categoryAxis = plot.getDomainAxis();
        }
        highlightEntity(highlightedEntity, true);
        setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    } else {
        if (highlightedEntity != null) {
            highlightEntity(highlightedEntity, false);
            highlightedEntity = null;
        }
        setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    }
}

From source file:com.intel.stl.ui.common.view.JumpChartPanel.java

protected void highlightEntity(CategoryLabelEntity entity, boolean highlight) {
    if (categoryAxis == null) {
        return;/*  w w w  .  j av a2s  .c om*/
    }

    if (highlight) {
        categoryAxis.setTickLabelPaint(entity.getKey(), UIConstants.INTEL_BLUE);
        categoryAxis.setTickLabelFont(entity.getKey(), UIConstants.H5_FONT.deriveFont(Font.BOLD));
    } else {
        categoryAxis.setTickLabelPaint(entity.getKey(), categoryAxis.getTickLabelPaint());
        categoryAxis.setTickLabelFont(entity.getKey(), categoryAxis.getTickLabelFont());
    }
}