Jfree图表查找子图

编程入门 行业动态 更新时间:2024-10-20 16:00:54
本文介绍了Jfree图表查找子图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

这可能是一个非常基本的问题,但是我被困在JFreechart的使用中.

This may sound very basic as a question, but i am stuck in JFreechart use.

让我列出我的问题:

  • 我有一个CombinedDomainXYPlot,可以在需要时在其中添加子图.
  • 我使用了自定义的JPopup菜单,并包含了一个菜单项,旨在为用户提供删除特定子图的功能
  • 我假设可以使用主图的findSubplot方法找到一个子图.我可以获取鼠标位置,但无法使用PlotRenderingInfo做为输入所需的任何操作.
  • 不胜感激.

    推荐答案

    您可以使用 getSubplots() .要了解单击了哪个子图,请检查 ChartMouseEvent 从ChartPanel发送,如此处所示.

    You can get a List of subplots using getSubplots(). To learn which subplot was clicked, examine the ChartMouseEvent that was sent from the ChartPanel, as suggested here.

    附录:这是ChartMouseListener的简单实现,将在单击每个ChartEntity时显示它们.

    Addendum: Here's a simple implementation of ChartMouseListener that will show each ChartEntity as it is clicked.

    ChartPanel panel = ... panel.addChartMouseListener(new ChartMouseListener() { @Override public void chartMouseClicked(ChartMouseEvent e) { System.out.println(e.getEntity().getClass()); } @Override public void chartMouseMoved(ChartMouseEvent event) {} });

    更多推荐

    Jfree图表查找子图

    本文发布于:2023-06-07 22:00:49,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/568538.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:图表   Jfree

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!