Ejemplo n.º 1
0
 public override AxisSpace reserveSpace(Graphics2D g2, Plot plot, Rectangle2D plotArea, RectangleEdge edge, AxisSpace space)
 {
   this.internalMarkerCycleBoundTick = (Tick) null;
   AxisSpace axisSpace = base.reserveSpace(g2, plot, plotArea, edge, space);
   if (this.internalMarkerCycleBoundTick == null)
     return axisSpace;
   FontMetrics fontMetrics = ((Graphics) g2).getFontMetrics(this.getTickLabelFont());
   Rectangle2D textBounds = TextUtilities.getTextBounds(this.internalMarkerCycleBoundTick.getText(), g2, fontMetrics);
   if (RectangleEdge.isTopOrBottom(edge))
   {
     if (this.isVerticalTickLabels())
       space.add(((RectangularShape) textBounds).getHeight() / 2.0, RectangleEdge.__\u003C\u003ERIGHT);
     else
       space.add(((RectangularShape) textBounds).getWidth() / 2.0, RectangleEdge.__\u003C\u003ERIGHT);
   }
   else if (RectangleEdge.isLeftOrRight(edge))
   {
     if (this.isVerticalTickLabels())
       space.add(((RectangularShape) textBounds).getWidth() / 2.0, RectangleEdge.__\u003C\u003ETOP);
     else
       space.add(((RectangularShape) textBounds).getHeight() / 2.0, RectangleEdge.__\u003C\u003ETOP);
   }
   return axisSpace;
 }
Ejemplo n.º 2
0
 protected internal virtual List refreshVerticalTicks(Graphics2D g2, Rectangle2D dataArea, RectangleEdge edge)
 {
   ArrayList arrayList = new ArrayList();
   ((List) arrayList).clear();
   Font tickLabelFont = this.getTickLabelFont();
   ((Graphics) g2).setFont(tickLabelFont);
   if (this.isAutoTickUnitSelection())
     this.selectAutoTickUnit(g2, dataArea, edge);
   double size = this.getTickUnit().getSize();
   double cycleBound = this.getCycleBound();
   double num1 = Math.ceil(cycleBound / size) * size;
   double num2 = this.getRange().getUpperBound();
   int num3 = 0;
   int num4 = this.boundMappedToLastCycle ? 1 : 0;
   this.boundMappedToLastCycle = true;
   CyclicNumberAxis.CycleBoundTick cycleBoundTick1 = (CyclicNumberAxis.CycleBoundTick) null;
   float num5 = 0.0f;
   if (num2 == cycleBound)
   {
     num1 = this.calculateLowestVisibleTickValue();
     num3 = 1;
     this.boundMappedToLastCycle = true;
   }
   while (num1 <= num2)
   {
     int num6 = 0;
     if (num1 + size > num2 && num3 == 0)
       num6 = 1;
     double num7 = this.valueToJava2D(num1, dataArea, edge);
     NumberFormat numberFormatOverride = this.getNumberFormatOverride();
     string label = numberFormatOverride == null ? this.getTickUnit().valueToString(num1) : numberFormatOverride.format(num1);
     float num8 = (float) num7;
     double angle = 0.0;
     TextAnchor textAnchor1;
     TextAnchor rotationAnchor;
     if (this.isVerticalTickLabels())
     {
       if (edge == RectangleEdge.__\u003C\u003ELEFT)
       {
         textAnchor1 = TextAnchor.__\u003C\u003EBOTTOM_CENTER;
         if (cycleBoundTick1 != null && (double) num5 == (double) num8 && num1 != cycleBound)
         {
           TextAnchor textAnchor2 = !this.isInverted() ? TextAnchor.__\u003C\u003EBOTTOM_RIGHT : TextAnchor.__\u003C\u003EBOTTOM_LEFT;
           ((List) arrayList).remove(((List) arrayList).size() - 1);
           ((List) arrayList).add((object) new CyclicNumberAxis.CycleBoundTick(this.boundMappedToLastCycle, cycleBoundTick1.getNumber(), cycleBoundTick1.getText(), textAnchor2, textAnchor2, cycleBoundTick1.getAngle()));
           this.internalMarkerWhenTicksOverlap = true;
           textAnchor1 = !this.isInverted() ? TextAnchor.__\u003C\u003EBOTTOM_LEFT : TextAnchor.__\u003C\u003EBOTTOM_RIGHT;
         }
         rotationAnchor = textAnchor1;
         angle = -1.0 * Math.PI / 2.0;
       }
       else
       {
         textAnchor1 = TextAnchor.__\u003C\u003EBOTTOM_CENTER;
         if (cycleBoundTick1 != null && (double) num5 == (double) num8 && num1 != cycleBound)
         {
           TextAnchor textAnchor2 = !this.isInverted() ? TextAnchor.__\u003C\u003EBOTTOM_LEFT : TextAnchor.__\u003C\u003EBOTTOM_RIGHT;
           ((List) arrayList).remove(((List) arrayList).size() - 1);
           ((List) arrayList).add((object) new CyclicNumberAxis.CycleBoundTick(this.boundMappedToLastCycle, cycleBoundTick1.getNumber(), cycleBoundTick1.getText(), textAnchor2, textAnchor2, cycleBoundTick1.getAngle()));
           this.internalMarkerWhenTicksOverlap = true;
           textAnchor1 = !this.isInverted() ? TextAnchor.__\u003C\u003EBOTTOM_RIGHT : TextAnchor.__\u003C\u003EBOTTOM_LEFT;
         }
         rotationAnchor = textAnchor1;
         angle = Math.PI / 2.0;
       }
     }
     else if (edge == RectangleEdge.__\u003C\u003ELEFT)
     {
       textAnchor1 = TextAnchor.__\u003C\u003ECENTER_RIGHT;
       if (cycleBoundTick1 != null && (double) num5 == (double) num8 && num1 != cycleBound)
       {
         TextAnchor textAnchor2 = !this.isInverted() ? TextAnchor.__\u003C\u003ETOP_RIGHT : TextAnchor.__\u003C\u003EBOTTOM_RIGHT;
         ((List) arrayList).remove(((List) arrayList).size() - 1);
         ((List) arrayList).add((object) new CyclicNumberAxis.CycleBoundTick(this.boundMappedToLastCycle, cycleBoundTick1.getNumber(), cycleBoundTick1.getText(), textAnchor2, textAnchor2, cycleBoundTick1.getAngle()));
         this.internalMarkerWhenTicksOverlap = true;
         textAnchor1 = !this.isInverted() ? TextAnchor.__\u003C\u003EBOTTOM_RIGHT : TextAnchor.__\u003C\u003ETOP_RIGHT;
       }
       rotationAnchor = textAnchor1;
     }
     else
     {
       textAnchor1 = TextAnchor.__\u003C\u003ECENTER_LEFT;
       if (cycleBoundTick1 != null && (double) num5 == (double) num8 && num1 != cycleBound)
       {
         TextAnchor textAnchor2 = !this.isInverted() ? TextAnchor.__\u003C\u003ETOP_LEFT : TextAnchor.__\u003C\u003EBOTTOM_LEFT;
         ((List) arrayList).remove(((List) arrayList).size() - 1);
         ((List) arrayList).add((object) new CyclicNumberAxis.CycleBoundTick(this.boundMappedToLastCycle, cycleBoundTick1.getNumber(), cycleBoundTick1.getText(), textAnchor2, textAnchor2, cycleBoundTick1.getAngle()));
         this.internalMarkerWhenTicksOverlap = true;
         textAnchor1 = !this.isInverted() ? TextAnchor.__\u003C\u003EBOTTOM_LEFT : TextAnchor.__\u003C\u003ETOP_LEFT;
       }
       rotationAnchor = textAnchor1;
     }
     CyclicNumberAxis.CycleBoundTick cycleBoundTick2 = new CyclicNumberAxis.CycleBoundTick(this.boundMappedToLastCycle, (Number) new Double(num1), label, textAnchor1, rotationAnchor, angle);
     if (num1 == cycleBound)
       this.internalMarkerCycleBoundTick = (Tick) cycleBoundTick2;
     ((List) arrayList).add((object) cycleBoundTick2);
     cycleBoundTick1 = cycleBoundTick2;
     num5 = num8;
     if (num1 == cycleBound)
       this.internalMarkerCycleBoundTick = (Tick) cycleBoundTick2;
     num1 += size;
     if (num6 != 0)
     {
       num1 = this.calculateLowestVisibleTickValue();
       num2 = cycleBound;
       num3 = 1;
       this.boundMappedToLastCycle = false;
     }
   }
   this.boundMappedToLastCycle = num4 != 0;
   return (List) arrayList;
 }