Hello !
So I've manage to render a BufferedImage instead of render dot by dot BUT the zoom wheel and the rectangle zoom don't work properly :
The domain and range axis zoom and unzoom properly but on the chart itself nothing happened. I'm sure it's because of the way I draw the BufferedImage but I don't know how to correlate the range and domain axis to the BufferedImage ...
Here what I've done for now :
Code: Select all
public void drawImage(Graphics2D g2, XYItemRendererState state,PlotRenderingInfo info, JFCXYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis,XYDataset dataset, int series, CrosshairState crosshairState) {
//initialization of private variable
pPlot= plot;
graphic2 = g2;
double zVal;
//this is a PaintScale that I've made
CustomPaintScale tmp_paintScale = (CustomPaintScale)getPaintScale();
XYZDataset tmp_dataset = (XYZDataset) dataset;
m_img2D = new BufferedImage(pPlot.getImgWidth(),pPlot.getImgHeight(), BufferedImage.TYPE_INT_ARGB);
for(int i = 0; i < pPlot.getImgWidth(); i++) {
for(int j = 0; j < pPlot.getImgHeight(); j++) {
zVal = tmp_dataset.getZValue(series, (i * pPlot.getImgHeight() + j));
m_img2D.setRGB(i, j, tmp_paintScale.getColor(zVal).getRGB());
}
}
graphic2.translate(pPlot.getDataArea().getWidth()/2,pPlot.getDataArea().getHeight()/2);
graphic2.translate(-((pPlot.getImgWidth()*zoom)/2),-((pPlot.getImgHeight()*zoom)/2));
graphic2.translate(x, y);
graphic2.scale(zoom, zoom);
graphic2.drawImage(m_img2D,0,0, null);
}
If more info are needed I will post more code
Thanks a lot !
MrJack
EDIT :
Changed the name of the topic which was maybe not accurate enough