< prev index next >

application/org.openjdk.jmc.ui/src/main/java/org/openjdk/jmc/ui/charts/QuantitySpanRenderer.java

Print this page

        

@@ -73,10 +73,14 @@
 
         private static int calcMargin(int height) {
                 return Math.min(5, (height + 10) / 20);
         }
 
+        public String getName() {
+                return text;
+        }
+
         @Override
         public IRenderedRow render(Graphics2D context, SubdividedQuantityRange xRange, int height) {
                 int margin = calcMargin(height);
                 int innerHeight = height - 2 * margin;
                 context.translate(0, margin);

@@ -99,26 +103,29 @@
                 private final XYQuantities<?> points;
                 private final IRenderedRow content;
                 private final Paint paint;
                 private final int margin;
                 private String description;
+                private String text;
 
                 public QuantitySpanRendering(int margin, XYQuantities<?> points, IRenderedRow content, Paint paint, String text,
                                 String description) {
                         super(Arrays.asList(new RenderedRowBase(margin), content, new RenderedRowBase(margin)),
                                         content.getHeight() + 2 * margin, text, description, null);
                         this.margin = margin;
                         this.points = points;
                         this.content = content;
                         this.paint = paint;
                         this.description = description;
+                        this.text = text;
                 }
 
                 @Override
                 public void infoAt(IChartInfoVisitor visitor, int x, int y, Point offset) {
                         offset = new Point(offset.x, offset.y + margin);
                         content.infoAt(visitor, x, y, offset);
+                        visitor.enterScope(text, true);
 
                         // FIXME: Only output this if near the boundaries? At least handle infinite lengths.
                         if (points != null) {
                                 int bucket = points.floorIndexAtX(x);
                                 if (bucket < points.getSize()) {

@@ -172,10 +179,15 @@
                                 IQuantity org = super.getEndX();
                                 return (org == MISSING_END) ? null : org;
                         }
 
                         @Override
+                        public String getName() {
+                                return text;
+                        }
+
+                        @Override
                         public String getDescription() {
                                 return description;
                         }
                 }
 
< prev index next >