本文整理汇总了Java中org.jfree.chart.plot.Pannable.panDomainAxes方法的典型用法代码示例。如果您正苦于以下问题:Java Pannable.panDomainAxes方法的具体用法?Java Pannable.panDomainAxes怎么用?Java Pannable.panDomainAxes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.plot.Pannable
的用法示例。
在下文中一共展示了Pannable.panDomainAxes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleMouseDragged
import org.jfree.chart.plot.Pannable; //导入方法依赖的package包/类
/**
* Handles a mouse dragged event by calculating the distance panned and
* updating the axes accordingly.
*
* @param canvas the JavaFX canvas ({@code null} not permitted).
* @param e the mouse event ({@code null} not permitted).
*/
@Override
public void handleMouseDragged(ChartCanvas canvas, MouseEvent e) {
if (this.panLast == null) {
//handle panning if we have a start point else unregister
canvas.clearLiveHandler();
return;
}
JFreeChart chart = canvas.getChart();
double dx = e.getX() - this.panLast.getX();
double dy = e.getY() - this.panLast.getY();
if (dx == 0.0 && dy == 0.0) {
return;
}
double wPercent = -dx / this.panW;
double hPercent = dy / this.panH;
boolean old = chart.getPlot().isNotify();
chart.getPlot().setNotify(false);
Pannable p = (Pannable) chart.getPlot();
PlotRenderingInfo info = canvas.getRenderingInfo().getPlotInfo();
if (p.getOrientation().isVertical()) {
p.panDomainAxes(wPercent, info, this.panLast);
p.panRangeAxes(hPercent, info, this.panLast);
}
else {
p.panDomainAxes(hPercent, info, this.panLast);
p.panRangeAxes(wPercent, info, this.panLast);
}
this.panLast = new Point2D.Double(e.getX(), e.getY());
chart.getPlot().setNotify(old);
}
示例2: handleMouseDragged
import org.jfree.chart.plot.Pannable; //导入方法依赖的package包/类
/**
* Handles a mouse dragged event by calculating the distance panned and
* updating the axes accordingly.
*
* @param canvas the JavaFX canvas (<code>null</code> not permitted).
* @param e the mouse event (<code>null</code> not permitted).
*/
public void handleMouseDragged(ChartCanvas canvas, MouseEvent e) {
if (this.panLast == null) {
//handle panning if we have a start point else unregister
canvas.clearLiveHandler();
return;
}
JFreeChart chart = canvas.getChart();
double dx = e.getX() - this.panLast.getX();
double dy = e.getY() - this.panLast.getY();
if (dx == 0.0 && dy == 0.0) {
return;
}
double wPercent = -dx / this.panW;
double hPercent = dy / this.panH;
boolean old = chart.getPlot().isNotify();
chart.getPlot().setNotify(false);
Pannable p = (Pannable) chart.getPlot();
PlotRenderingInfo info = canvas.getRenderingInfo().getPlotInfo();
if (p.getOrientation().isVertical()) {
p.panDomainAxes(wPercent, info, this.panLast);
p.panRangeAxes(hPercent, info, this.panLast);
}
else {
p.panDomainAxes(hPercent, info, this.panLast);
p.panRangeAxes(wPercent, info, this.panLast);
}
this.panLast = new Point2D.Double(e.getX(), e.getY());
chart.getPlot().setNotify(old);
}
示例3: mouseDragged
import org.jfree.chart.plot.Pannable; //导入方法依赖的package包/类
/**
* Handles a mouse dragged event. This is where the panning occurs.
*
* @param e the event.
*/
public void mouseDragged(MouseEvent e) {
// handle panning if we have a start point
if (this.panLast == null) {
return;
}
ChartPanel panel = (ChartPanel) e.getSource();
JFreeChart chart = panel.getChart();
double dx = e.getX() - this.panLast.getX();
double dy = e.getY() - this.panLast.getY();
if (dx == 0.0 && dy == 0.0) {
return;
}
double wPercent = -dx / this.panW;
double hPercent = dy / this.panH;
boolean old = chart.getPlot().isNotify();
chart.getPlot().setNotify(false);
Pannable p = (Pannable) chart.getPlot();
PlotRenderingInfo info = panel.getChartRenderingInfo().getPlotInfo();
if (p.getOrientation() == PlotOrientation.VERTICAL) {
p.panDomainAxes(wPercent, info, this.panLast);
p.panRangeAxes(hPercent, info, this.panLast);
}
else {
p.panDomainAxes(hPercent, info, this.panLast);
p.panRangeAxes(wPercent, info, this.panLast);
}
this.panLast = e.getPoint();
chart.getPlot().setNotify(old);
return;
}