<tfoot id='uIgmX'></tfoot>
      <i id='uIgmX'><tr id='uIgmX'><dt id='uIgmX'><q id='uIgmX'><span id='uIgmX'><b id='uIgmX'><form id='uIgmX'><ins id='uIgmX'></ins><ul id='uIgmX'></ul><sub id='uIgmX'></sub></form><legend id='uIgmX'></legend><bdo id='uIgmX'><pre id='uIgmX'><center id='uIgmX'></center></pre></bdo></b><th id='uIgmX'></th></span></q></dt></tr></i><div id='uIgmX'><tfoot id='uIgmX'></tfoot><dl id='uIgmX'><fieldset id='uIgmX'></fieldset></dl></div>

        <legend id='uIgmX'><style id='uIgmX'><dir id='uIgmX'><q id='uIgmX'></q></dir></style></legend>
          <bdo id='uIgmX'></bdo><ul id='uIgmX'></ul>

        <small id='uIgmX'></small><noframes id='uIgmX'>

        形状标注上方的JFreechart系列工具提示

        时间:2023-07-26
        <i id='TsW1X'><tr id='TsW1X'><dt id='TsW1X'><q id='TsW1X'><span id='TsW1X'><b id='TsW1X'><form id='TsW1X'><ins id='TsW1X'></ins><ul id='TsW1X'></ul><sub id='TsW1X'></sub></form><legend id='TsW1X'></legend><bdo id='TsW1X'><pre id='TsW1X'><center id='TsW1X'></center></pre></bdo></b><th id='TsW1X'></th></span></q></dt></tr></i><div id='TsW1X'><tfoot id='TsW1X'></tfoot><dl id='TsW1X'><fieldset id='TsW1X'></fieldset></dl></div>

          <small id='TsW1X'></small><noframes id='TsW1X'>

            <tbody id='TsW1X'></tbody>
        • <tfoot id='TsW1X'></tfoot>

              1. <legend id='TsW1X'><style id='TsW1X'><dir id='TsW1X'><q id='TsW1X'></q></dir></style></legend>

                  <bdo id='TsW1X'></bdo><ul id='TsW1X'></ul>
                  本文介绍了形状标注上方的JFreechart系列工具提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我有一个 XYPlot,上面是系列和几个动态添加的形状注释,没有填充(因此每个系列点都是可见的).是否可以在注释上显示系列工具提示(显示鼠标指针当前指向的系列点的坐标)?或者如何重新排列元素以使工具提示可见.

                  I have an XYPlot on which are series and a couple of dynamically added shape annotations with no fill (hence each of the series points are visible). Is it possible to display the series tool tips(that show the coordinate of the series point over which the mouse pointer is currently pointing to) over the annotations? Or how can I re-arrange the elements in order to make the tooltip visible.

                  推荐答案

                  我怀疑您正在将形状注释添加到绘图中,它们是最后绘制的.相反,将它们添加到 Layer.BACKGROUND 中的渲染器.如下图所示,圆圈不会遮挡 (20, 20) 处的工具提示.还要注意 (10, 10) 是如何 不受线注释影响,而 (30, 30) 会被弧线遮挡.

                  I suspect you are adding the shape annotations to the plot, where they are drawn last. Instead, add them to the renderer in Layer.BACKGROUND. As shown below, the circle does not obscure the tool tip at (20, 20). Note also how (10, 10) is not affected by the line annotation, while (30, 30) is obscured by the arc.

                  import java.awt.BasicStroke;
                  import java.awt.Color;
                  import java.awt.geom.Arc2D;
                  import java.awt.geom.Ellipse2D;
                  import java.util.Random;
                  import org.jfree.chart.ChartFactory;
                  import org.jfree.chart.ChartFrame;
                  import org.jfree.chart.JFreeChart;
                  import org.jfree.chart.annotations.XYLineAnnotation;
                  import org.jfree.chart.annotations.XYShapeAnnotation;
                  import org.jfree.chart.plot.PlotOrientation;
                  import org.jfree.chart.plot.XYPlot;
                  import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
                  import org.jfree.data.xy.XYDataset;
                  import org.jfree.data.xy.XYSeries;
                  import org.jfree.data.xy.XYSeriesCollection;
                  import org.jfree.ui.Layer;
                  
                  /**
                   * @see http://stackoverflow.com/questions/6797012
                   * @see http://stackoverflow.com/questions/6604211
                   */
                  public class ArcTest {
                  
                      private static final Random r = new Random();
                      private static final Color blue = Color.blue;
                      private static final BasicStroke stroke = new BasicStroke(2.0f);
                      private static final double PI = 180d;
                      private static final int X = 8;
                      private static final int Y = 0;
                      private static final int W = 6 * X;
                      private static final int H = 3 * X;
                  
                      public static void main(String[] args) {
                          JFreeChart chart = ChartFactory.createXYLineChart(
                              "ArcTest", "X", "Y", createDataset(),
                              PlotOrientation.VERTICAL, true, true, false);
                          XYPlot plot = chart.getXYPlot();
                  
                          XYLineAndShapeRenderer renderer =
                              (XYLineAndShapeRenderer) plot.getRenderer();
                          renderer.setBaseShapesVisible(true);
                          Ellipse2D.Double circle = new Ellipse2D.Double(X, X, 20, 20);
                          renderer.addAnnotation(new XYShapeAnnotation(
                              circle, stroke, blue), Layer.BACKGROUND);
                  
                          XYLineAnnotation line = new XYLineAnnotation(X, Y, X, H, stroke, blue);
                          plot.addAnnotation(line);
                          Arc2D.Double arc = new Arc2D.Double(X, Y, W, 2 * H, PI, PI, Arc2D.OPEN);
                          plot.addAnnotation(new XYShapeAnnotation(arc, stroke, blue));
                  
                          ChartFrame frame = new ChartFrame("Test", chart);
                          frame.pack();
                          frame.setVisible(true);
                      }
                  
                      private static XYDataset createDataset() {
                          XYSeriesCollection result = new XYSeriesCollection();
                          XYSeries series = new XYSeries("ArcTest");
                          series.add(0, 0);
                          series.add(10, 10);
                          series.add(20, 20);
                          series.add(30, 30);
                          series.add(W, W);
                          result.addSeries(series);
                          return result;
                      }
                  }
                  

                  这篇关于形状标注上方的JFreechart系列工具提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:不同的保留政策如何影响我的注释? 下一篇:为什么 Eclipse 在接口方法上抱怨 @Override?

                  相关文章

                  最新文章

                  <tfoot id='2ZRPq'></tfoot>

                  <small id='2ZRPq'></small><noframes id='2ZRPq'>

                  <legend id='2ZRPq'><style id='2ZRPq'><dir id='2ZRPq'><q id='2ZRPq'></q></dir></style></legend>

                        <bdo id='2ZRPq'></bdo><ul id='2ZRPq'></ul>

                      <i id='2ZRPq'><tr id='2ZRPq'><dt id='2ZRPq'><q id='2ZRPq'><span id='2ZRPq'><b id='2ZRPq'><form id='2ZRPq'><ins id='2ZRPq'></ins><ul id='2ZRPq'></ul><sub id='2ZRPq'></sub></form><legend id='2ZRPq'></legend><bdo id='2ZRPq'><pre id='2ZRPq'><center id='2ZRPq'></center></pre></bdo></b><th id='2ZRPq'></th></span></q></dt></tr></i><div id='2ZRPq'><tfoot id='2ZRPq'></tfoot><dl id='2ZRPq'><fieldset id='2ZRPq'></fieldset></dl></div>