Wafermap chart zoom in - out not working

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
pratiksheth1991
Posts: 5
Joined: Mon Oct 03, 2016 5:33 am
antibot: No, of course not.

Wafermap chart zoom in - out not working

Post by pratiksheth1991 » Thu Oct 06, 2016 10:04 am

Hi Dave, as per our twitter conversation , Please help what's wrong my code is doing. Zoom is not reflecting in UI on mouse wheel event.

public static void main(String[] args) {
launch(args);
}

@Override public void start(Stage stage) {


stage.setTitle("RAMP - JVShell Test Visualizer");
scene.setFill(Color.GHOSTWHITE);

MenuBar RAMPMenuBar = MenuScreen.createMenus(menuBar1,stage,waferMap);
final Accordion RAMPAccordian = PaneScreen.createPanes(accordion1, stage);

chartSwingNode = new SwingNode();
VBox vb = new VBox(0);
vb.getChildren().addAll(RAMPMenuBar,RAMPToolBar);
borderPane.setTop(vb);
borderPane.setLeft(RAMPAccordian);
RAMPStatusBar = StatusBar.createStatusBar();
borderPane.setBottom(RAMPStatusBar);

// code fetches dataset from file
final WaferMapDataset dataset = RAMPDatasetFactory.createWaferMapDatasetUsingStepperJob(8,7,8,NotchOrientation);
currentStepperJob = new StepperJob();
currentStepperJob.loadStepperJobFile("E:\\RAMP-data\\8ab07a.txt");

// creates wafer map chart
updateWaferMapDisplay(stage,dataset);

}



static public void updateWaferMapDisplay (Stage stage, WaferMapDataset dataset)
{

// creates wafer map
waferMap = RAMPChartFactory.createWaferMapChart(
"", // title
dataset, // wafermapdataset
NotchOrientation, // Default is Notch down
true, // legend
true, // tooltips
true //URLs
);

defaultDataset = dataset;

chartPanel = new ChartPanel(waferMap, true, true, true, true, true);

chartPanel.addMouseWheelListener(new MouseWheelListener() {

@Override
public void mouseWheelMoved(MouseWheelEvent evt) {
// TODO Auto-generated method stub
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++");
int x = evt.getX();
int y = evt.getY();
System.out.println("+++++++" + x + "+++" + y);
Rectangle2D sda = chartPanel.getScreenDataArea(x, y);

if(evt.getWheelRotation() < 0)
{
double zrw = sda.getWidth() / ZOOM_FRACTION;
double zrh = sda.getHeight() / ZOOM_FRACTION;
//double zrw = 50 / ZOOM_FRACTION;
// double zrh = 50 / ZOOM_FRACTION;
Rectangle2D zoomArea = new Rectangle2D.Double(
x - zrw / 2,
y - zrh / 2,
zrw,
zrh);
System.out.println("---" + x + "---" + y);
chartPanel.zoom(zoomArea);
}
else
{
double zrw = sda.getWidth() * ZOOM_FRACTION;
double zrh = sda.getHeight() * ZOOM_FRACTION;
Rectangle2D zoomArea = new Rectangle2D.Double(
x - zrw / 2,
y - zrh / 2,
zrw,
zrh);
System.out.println("***" + x + "***" + y);
chartPanel.zoom(zoomArea);
}

}});

chartSwingNode.setContent(chartPanel);

borderPane.setRight(chartSwingNode);

stage.setScene(scene);
stage.show();

}

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: Wafermap chart zoom in - out not working

Post by david.gilbert » Thu Oct 06, 2016 8:43 pm

The ChartPanel zooming mechanism relies on the plot implementing the Zoomable interface, which WaferMapPlot doesn't. The Zoomable interface is oriented towards plots with x and y axes, which doesn't exactly match the WaferMapPlot but you could probably assume some virtual axes and adjust the plot drawing accordingly. In any case, implementing the methods in Zoomable is the key to getting something working for this plot.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

pratiksheth1991
Posts: 5
Joined: Mon Oct 03, 2016 5:33 am
antibot: No, of course not.

Re: Wafermap chart zoom in - out not working

Post by pratiksheth1991 » Fri Oct 07, 2016 7:32 am

"The ChartPanel zooming mechanism relies on the plot implementing the Zoomable interface, which WaferMapPlot doesn't. The Zoomable interface is oriented towards plots with x and y axes, which doesn't exactly match the WaferMapPlot but you could probably assume some virtual axes and adjust the plot drawing accordingly. In any case, implementing the methods in Zoomable is the key to getting something working for this plot."

How can I assume virtual axis? I didnt got your point.

paradoxoff
Posts: 1634
Joined: Sat Feb 17, 2007 1:51 pm

Re: Wafermap chart zoom in - out not working

Post by paradoxoff » Fri Oct 07, 2016 4:01 pm

I think that the main point is to implement all methods in the Zoomable interface. The method names imply that a Zoomable plot has domain and range axes, but this is of course not a requirement.

Locked