• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ChartCanvas类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jfree.chart.fx.ChartCanvas的典型用法代码示例。如果您正苦于以下问题:Java ChartCanvas类的具体用法?Java ChartCanvas怎么用?Java ChartCanvas使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ChartCanvas类属于org.jfree.chart.fx包,在下文中一共展示了ChartCanvas类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: handleMousePressed

import org.jfree.chart.fx.ChartCanvas; //导入依赖的package包/类
/**
 * Handles a mouse pressed event by recording the initial mouse pointer
 * location.
 * 
 * @param canvas  the JavaFX canvas ({@code null} not permitted).
 * @param e  the mouse event ({@code null} not permitted).
 */
@Override
public void handleMousePressed(ChartCanvas canvas, MouseEvent e) {
    Plot plot = canvas.getChart().getPlot();
    if (!(plot instanceof Pannable)) {
        canvas.clearLiveHandler();
        return;
    }
    Pannable pannable = (Pannable) plot;
    if (pannable.isDomainPannable() || pannable.isRangePannable()) {
        Point2D point = new Point2D.Double(e.getX(), e.getY());
        Rectangle2D dataArea = canvas.findDataArea(point);
        if (dataArea != null && dataArea.contains(point)) {
            this.panW = dataArea.getWidth();
            this.panH = dataArea.getHeight();
            this.panLast = point;
            canvas.setCursor(javafx.scene.Cursor.MOVE);
        }
    }
    // the actual panning occurs later in the mouseDragged() method
}
 
开发者ID:jfree,项目名称:jfreechart-fx,代码行数:28,代码来源:PanHandlerFX.java


示例2: getTooltipText

import org.jfree.chart.fx.ChartCanvas; //导入依赖的package包/类
/**
 * Returns the tooltip text.
 * 
 * @param canvas  the canvas that is displaying the chart.
 * @param x  the x-coordinate of the mouse pointer.
 * @param y  the y-coordinate of the mouse pointer.
 * 
 * @return String The tooltip text (possibly {@code null}).
  */
private String getTooltipText(ChartCanvas canvas, double x, double y) {
    ChartRenderingInfo info = canvas.getRenderingInfo();
    if (info == null) {
        return null;
    }
    EntityCollection entities = info.getEntityCollection();
    if (entities == null) {
        return null;
    }
    ChartEntity entity = entities.getEntity(x, y);
    if (entity == null) {
        return null;
    }
    return entity.getToolTipText();
}
 
开发者ID:jfree,项目名称:jfreechart-fx,代码行数:25,代码来源:TooltipHandlerFX.java


示例3: handleZoomable

import org.jfree.chart.fx.ChartCanvas; //导入依赖的package包/类
/**
 * Handle the case where a plot implements the {@link Zoomable} interface.
 *
 * @param zoomable  the zoomable plot.
 * @param e  the mouse wheel event.
 */
private void handleZoomable(ChartCanvas canvas, Zoomable zoomable, 
        ScrollEvent e) {
    // don't zoom unless the mouse pointer is in the plot's data area
    ChartRenderingInfo info = canvas.getRenderingInfo();
    PlotRenderingInfo pinfo = info.getPlotInfo();
    Point2D p = new Point2D.Double(e.getX(), e.getY());
    if (pinfo.getDataArea().contains(p)) {
        Plot plot = (Plot) zoomable;
        // do not notify while zooming each axis
        boolean notifyState = plot.isNotify();
        plot.setNotify(false);
        int clicks = (int) e.getDeltaY();
        double zf = 1.0 + this.zoomFactor;
        if (clicks < 0) {
            zf = 1.0 / zf;
        }
        if (canvas.isDomainZoomable()) {
            zoomable.zoomDomainAxes(zf, pinfo, p, true);
        }
        if (canvas.isRangeZoomable()) {
            zoomable.zoomRangeAxes(zf, pinfo, p, true);
        }
        plot.setNotify(notifyState);  // this generates the change event too
    } 
}
 
开发者ID:jfree,项目名称:jfreechart-fx,代码行数:32,代码来源:ScrollHandlerFX.java


示例4: handleMousePressed

import org.jfree.chart.fx.ChartCanvas; //导入依赖的package包/类
/**
 * Handles a mouse pressed event by recording the initial mouse pointer
 * location.
 * 
 * @param canvas  the JavaFX canvas (<code>null</code> not permitted).
 * @param e  the mouse event (<code>null</code> not permitted).
 */
@Override
public void handleMousePressed(ChartCanvas canvas, MouseEvent e) {
    Plot plot = canvas.getChart().getPlot();
    if (!(plot instanceof Pannable)) {
        canvas.clearLiveHandler();
        return;
    }
    Pannable pannable = (Pannable) plot;
    if (pannable.isDomainPannable() || pannable.isRangePannable()) {
        Point2D point = new Point2D.Double(e.getX(), e.getY());
        Rectangle2D dataArea = canvas.findDataArea(point);
        if (dataArea != null && dataArea.contains(point)) {
            this.panW = dataArea.getWidth();
            this.panH = dataArea.getHeight();
            this.panLast = point;
            canvas.setCursor(javafx.scene.Cursor.MOVE);
        }
    }
    // the actual panning occurs later in the mouseDragged() method
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:28,代码来源:PanHandlerFX.java


示例5: getTooltipText

import org.jfree.chart.fx.ChartCanvas; //导入依赖的package包/类
/**
 * Returns the tooltip text.
 * 
 * @param canvas  the canvas that is displaying the chart.
 * @param x  the x-coordinate of the mouse pointer.
 * @param y  the y-coordinate of the mouse pointer.
 * 
 * @return String The tooltip text (possibly <code>null</code>).
  */
private String getTooltipText(ChartCanvas canvas, double x, double y) {
    ChartRenderingInfo info = canvas.getRenderingInfo();
    if (info == null) {
        return null;
    }
    EntityCollection entities = info.getEntityCollection();
    if (entities == null) {
        return null;
    }
    ChartEntity entity = entities.getEntity(x, y);
    if (entity == null) {
        return null;
    }
    return entity.getToolTipText();
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:25,代码来源:TooltipHandlerFX.java


示例6: handleZoomable

import org.jfree.chart.fx.ChartCanvas; //导入依赖的package包/类
/**
 * Handle the case where a plot implements the {@link Zoomable} interface.
 *
 * @param zoomable  the zoomable plot.
 * @param e  the mouse wheel event.
 */
private void handleZoomable(ChartCanvas canvas, Zoomable zoomable, 
        ScrollEvent e) {
    // don't zoom unless the mouse pointer is in the plot's data area
    ChartRenderingInfo info = canvas.getRenderingInfo();
    PlotRenderingInfo pinfo = info.getPlotInfo();
    Point2D p = new Point2D.Double(e.getX(), e.getY());
    if (pinfo.getDataArea().contains(p)) {
        Plot plot = (Plot) zoomable;
        // do not notify while zooming each axis
        boolean notifyState = plot.isNotify();
        plot.setNotify(false);
        int clicks = (int) e.getDeltaY();
        double zf = 1.0 + this.zoomFactor;
        if (clicks < 0) {
            zf = 1.0 / zf;
        }
        if (true) { //this.chartPanel.isDomainZoomable()) {
            zoomable.zoomDomainAxes(zf, pinfo, p, true);
        }
        if (true) { //this.chartPanel.isRangeZoomable()) {
            zoomable.zoomRangeAxes(zf, pinfo, p, true);
        }
        plot.setNotify(notifyState);  // this generates the change event too
    } 
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:32,代码来源:ScrollHandlerFX.java


示例7: handleMouseDragged

import org.jfree.chart.fx.ChartCanvas; //导入依赖的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);
}
 
开发者ID:jfree,项目名称:jfreechart-fx,代码行数:39,代码来源:PanHandlerFX.java


示例8: handleMouseReleased

import org.jfree.chart.fx.ChartCanvas; //导入依赖的package包/类
@Override
public void handleMouseReleased(ChartCanvas canvas, MouseEvent e) {  
    //if we have been panning reset the cursor
    //unregister in any case
    if (this.panLast != null) {
        canvas.setCursor(javafx.scene.Cursor.DEFAULT);
    }
    this.panLast = null;
    canvas.clearLiveHandler();
}
 
开发者ID:jfree,项目名称:jfreechart-fx,代码行数:11,代码来源:PanHandlerFX.java


示例9: handleMouseClicked

import org.jfree.chart.fx.ChartCanvas; //导入依赖的package包/类
/**
 * Handles a mouse clicked event by setting the anchor point for the
 * canvas and redrawing the chart (the anchor point is a reference point
 * used by the chart to determine crosshair lines).
 * 
 * @param canvas  the chart canvas ({@code null} not permitted).
 * @param e  the mouse event ({@code null} not permitted).
 */
@Override
public void handleMouseClicked(ChartCanvas canvas, MouseEvent e) {
    if (this.mousePressedPoint == null) {
        return;
    }
    Point2D currPt = new Point2D.Double(e.getX(), e.getY());
    if (this.mousePressedPoint.distance(currPt) < 2) {
        canvas.setAnchor(currPt);
    }
    this.mousePressedPoint = null;
}
 
开发者ID:jfree,项目名称:jfreechart-fx,代码行数:20,代码来源:AnchorHandlerFX.java


示例10: handleMouseMoved

import org.jfree.chart.fx.ChartCanvas; //导入依赖的package包/类
/**
 * Handles a mouse moved event by updating the tooltip.
 * 
 * @param canvas  the chart canvas ({@code null} not permitted).
 * @param e  the mouse event.
 */
@Override
public void handleMouseMoved(ChartCanvas canvas, MouseEvent e) {
    if (!canvas.isTooltipEnabled()) {
        return;
    }
    String text = getTooltipText(canvas, e.getX(), e.getY());
    canvas.setTooltip(text, e.getScreenX(), e.getScreenY());
}
 
开发者ID:jfree,项目名称:jfreechart-fx,代码行数:15,代码来源:TooltipHandlerFX.java


示例11: handleScroll

import org.jfree.chart.fx.ChartCanvas; //导入依赖的package包/类
@Override
public void handleScroll(ChartCanvas canvas, ScrollEvent e) {
    JFreeChart chart = canvas.getChart();
    Plot plot = chart.getPlot();
    if (plot instanceof Zoomable) {
        Zoomable zoomable = (Zoomable) plot;
        handleZoomable(canvas, zoomable, e);
    }
    else if (plot instanceof PiePlot) {
        PiePlot pp = (PiePlot) plot;
        pp.handleMouseWheelRotation((int) e.getDeltaY());
    }
}
 
开发者ID:jfree,项目名称:jfreechart-fx,代码行数:14,代码来源:ScrollHandlerFX.java


示例12: handleMousePressed

import org.jfree.chart.fx.ChartCanvas; //导入依赖的package包/类
/**
 * Handles a mouse pressed event by recording the initial mouse pointer
 * location.
 * 
 * @param canvas  the JavaFX canvas ({@code null} not permitted).
 * @param e  the mouse event ({@code null} not permitted).
 */
@Override
public void handleMousePressed(ChartCanvas canvas, MouseEvent e) {
    Point2D pt = new Point2D.Double(e.getX(), e.getY());
    Rectangle2D dataArea = canvas.findDataArea(pt);
    if (dataArea != null) {
        this.startPoint = ShapeUtils.getPointInRectangle(e.getX(),
                e.getY(), dataArea);
    } else {
        this.startPoint = null;
        canvas.clearLiveHandler();
    }
}
 
开发者ID:jfree,项目名称:jfreechart-fx,代码行数:20,代码来源:ZoomHandlerFX.java


示例13: handleMouseMoved

import org.jfree.chart.fx.ChartCanvas; //导入依赖的package包/类
@Override
public void handleMouseMoved(ChartCanvas canvas, MouseEvent e) {
    double x = e.getX();
    double y = e.getY();
    ChartEntity entity = canvas.getRenderingInfo().getEntityCollection().getEntity(x, y);
    ChartMouseEventFX event = new ChartMouseEventFX(canvas.getChart(), e, entity);
    for (ChartMouseListenerFX listener : canvas.getChartMouseListeners()) {
        listener.chartMouseMoved(event);
    }
 }
 
开发者ID:jfree,项目名称:jfreechart-fx,代码行数:11,代码来源:DispatchHandlerFX.java


示例14: handleMouseClicked

import org.jfree.chart.fx.ChartCanvas; //导入依赖的package包/类
/**
 * Handles a mouse clicked event by setting the anchor point for the
 * canvas and redrawing the chart (the anchor point is a reference point
 * used by the chart to determine crosshair lines).
 * 
 * @param canvas  the chart canvas ({@code null} not permitted).
 * @param e  the mouse event ({@code null} not permitted).
 */
@Override
public void handleMouseClicked(ChartCanvas canvas, MouseEvent e) {
    if (this.mousePressedPoint == null) {
        return;
    }
    double x = e.getX();
    double y = e.getY();
    ChartEntity entity = canvas.getRenderingInfo().getEntityCollection().getEntity(x, y);
    ChartMouseEventFX event = new ChartMouseEventFX(canvas.getChart(), e, entity);
    for (ChartMouseListenerFX listener : canvas.getChartMouseListeners()) {
        listener.chartMouseClicked(event);
    }
}
 
开发者ID:jfree,项目名称:jfreechart-fx,代码行数:22,代码来源:DispatchHandlerFX.java


示例15: handleMouseDragged

import org.jfree.chart.fx.ChartCanvas; //导入依赖的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);
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:38,代码来源:PanHandlerFX.java


示例16: handleMouseReleased

import org.jfree.chart.fx.ChartCanvas; //导入依赖的package包/类
public void handleMouseReleased(ChartCanvas canvas, MouseEvent e) {  
    //if we have been panning reset the cursor
    //unregister in any case
    if (this.panLast != null) {
        canvas.setCursor(javafx.scene.Cursor.DEFAULT);
    }
    this.panLast = null;
    canvas.clearLiveHandler();
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:10,代码来源:PanHandlerFX.java


示例17: handleMouseClicked

import org.jfree.chart.fx.ChartCanvas; //导入依赖的package包/类
/**
 * Handles a mouse clicked event by setting the anchor point for the
 * canvas and redrawing the chart (the anchor point is a reference point
 * used by the chart to determine crosshair lines).
 * 
 * @param canvas  the chart canvas (<code>null</code> not permitted).
 * @param e  the mouse event (<code>null</code> not permitted).
 */
@Override
public void handleMouseClicked(ChartCanvas canvas, MouseEvent e) {
    if (this.mousePressedPoint == null) {
        return;
    }
    Point2D currPt = new Point2D.Double(e.getX(), e.getY());
    if (this.mousePressedPoint.distance(currPt) < 2) {
        canvas.setAnchor(currPt);
    }
    this.mousePressedPoint = null;
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:20,代码来源:AnchorHandlerFX.java


示例18: handleMouseMoved

import org.jfree.chart.fx.ChartCanvas; //导入依赖的package包/类
/**
 * Handles a mouse moved event by updating the tooltip.
 * 
 * @param canvas  the chart canvas (<code>null</code> not permitted).
 * @param e  the mouse event.
 */
@Override
public void handleMouseMoved(ChartCanvas canvas, MouseEvent e) {
    if (!canvas.isTooltipEnabled()) {
        return;
    }
    String text = getTooltipText(canvas, e.getX(), e.getY());
    canvas.setTooltip(text, e.getScreenX(), e.getScreenY());
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:15,代码来源:TooltipHandlerFX.java


示例19: handleMousePressed

import org.jfree.chart.fx.ChartCanvas; //导入依赖的package包/类
/**
 * Handles a mouse pressed event by recording the initial mouse pointer
 * location.
 * 
 * @param canvas  the JavaFX canvas (<code>null</code> not permitted).
 * @param e  the mouse event (<code>null</code> not permitted).
 */
@Override
public void handleMousePressed(ChartCanvas canvas, MouseEvent e) {
    Point2D pt = new Point2D.Double(e.getX(), e.getY());
    Rectangle2D dataArea = canvas.findDataArea(pt);
    if (dataArea != null) {
        this.startPoint = ShapeUtilities.getPointInRectangle(e.getX(),
                e.getY(), dataArea);
    } else {
        this.startPoint = null;
        canvas.clearLiveHandler();
    }
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:20,代码来源:ZoomHandlerFX.java


示例20: handleMouseClicked

import org.jfree.chart.fx.ChartCanvas; //导入依赖的package包/类
/**
 * Handles a mouse clicked event by setting the anchor point for the
 * canvas and redrawing the chart (the anchor point is a reference point
 * used by the chart to determine crosshair lines).
 * 
 * @param canvas  the chart canvas (<code>null</code> not permitted).
 * @param e  the mouse event (<code>null</code> not permitted).
 */
@Override
public void handleMouseClicked(ChartCanvas canvas, MouseEvent e) {
    if (this.mousePressedPoint == null) {
        return;
    }
    Point2D currPt = new Point2D.Double(e.getX(), e.getY());
    if (this.mousePressedPoint.distance(currPt) < 2) {
        canvas.dispatchMouseClickedEvent(currPt, e);
    }
    this.mousePressedPoint = null;
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:20,代码来源:DispatchHandlerFX.java



注:本文中的org.jfree.chart.fx.ChartCanvas类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AjaxTabbedPanel类代码示例发布时间:2022-05-23
下一篇:
Java OAuthEncoder类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap