jfree/jfreechart-fse

XYDotRenderer does not register items with EntityCollection

macyran opened this issue · 0 comments

Adding the snippet below fixes the issue.

XYDotRenderer.java

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) {
.....

        int domainAxisIndex = plot.getDomainAxisIndex(domainAxis);
        int rangeAxisIndex = plot.getRangeAxisIndex(rangeAxis);
        updateCrosshairValues(crosshairState, x, y, domainAxisIndex,
                rangeAxisIndex, transX, transY, orientation);

        EntityCollection entities = null;
        if(info != null) {
            ChartRenderingInfo chartInfo = info.getOwner();
            if(chartInfo != null) {
                entities = chartInfo.getEntityCollection();
            }
        }

        Rectangle entityArea = new Rectangle(xx,yy,this.dotWidth,this.dotHeight);

        if (entities != null && isPointInRect(dataArea, xx, yy)) {
            addEntity(entities, entityArea, dataset, series, item, xx, yy);
        }
    }

}