예제 #1
0
 protected internal override void drawPrimaryLineAsPath(XYItemRendererState state, Graphics2D g2, XYPlot plot, XYDataset dataset, int pass, int series, int item, ValueAxis domainAxis, ValueAxis rangeAxis, Rectangle2D dataArea)
 {
   RectangleEdge domainAxisEdge = plot.getDomainAxisEdge();
   RectangleEdge rangeAxisEdge = plot.getRangeAxisEdge();
   double xvalue = dataset.getXValue(series, item);
   double yvalue = dataset.getYValue(series, item);
   double num1 = domainAxis.valueToJava2D(xvalue, dataArea, domainAxisEdge);
   double num2 = rangeAxis.valueToJava2D(yvalue, dataArea, rangeAxisEdge);
   if (!Double.isNaN(num1) && !Double.isNaN(num2))
   {
     XYSplineRenderer.ControlPoint controlPoint = new XYSplineRenderer.ControlPoint(this, plot.getOrientation() != PlotOrientation.__\u003C\u003EHORIZONTAL ? (float) num1 : (float) num2, plot.getOrientation() != PlotOrientation.__\u003C\u003EHORIZONTAL ? (float) num2 : (float) num1);
     if (!this.points.contains((object) controlPoint))
       this.points.add((object) controlPoint);
   }
   if (item != dataset.getItemCount(series) - 1)
     return;
   XYLineAndShapeRenderer.State state1 = (XYLineAndShapeRenderer.State) state;
   if (this.points.size() > 1)
   {
     XYSplineRenderer.ControlPoint controlPoint1 = (XYSplineRenderer.ControlPoint) this.points.get(0);
     ((Path2D.Float) state1.seriesPath).moveTo(controlPoint1.x, controlPoint1.y);
     if (this.points.size() == 2)
     {
       XYSplineRenderer.ControlPoint controlPoint2 = (XYSplineRenderer.ControlPoint) this.points.get(1);
       ((Path2D.Float) state1.seriesPath).lineTo(controlPoint2.x, controlPoint2.y);
     }
     else
     {
       int length = this.points.size();
       float[] numArray1 = new float[length];
       float[] numArray2 = new float[length];
       float[] numArray3 = new float[length];
       float[] numArray4 = new float[length];
       for (int index = 0; index < length; ++index)
       {
         XYSplineRenderer.ControlPoint controlPoint2 = (XYSplineRenderer.ControlPoint) this.points.get(index);
         numArray2[index] = controlPoint2.x;
         numArray1[index] = controlPoint2.y;
       }
       for (int index = 1; index <= length - 1; ++index)
         numArray4[index] = numArray2[index] - numArray2[index - 1];
       float[] numArray5 = new float[length - 1];
       float[] numArray6 = new float[length - 1];
       float[] numArray7 = new float[length - 1];
       for (int index = 1; index <= length - 2; ++index)
       {
         numArray6[index] = (numArray4[index] + numArray4[index + 1]) / 3f;
         numArray7[index] = numArray4[index + 1] / 6f;
         numArray5[index] = numArray4[index] / 6f;
         numArray3[index] = (numArray1[index + 1] - numArray1[index]) / numArray4[index + 1] - (numArray1[index] - numArray1[index - 1]) / numArray4[index];
       }
       this.solveTridiag(numArray5, numArray6, numArray7, numArray3, length - 2);
       float num3 = numArray2[0];
       float num4 = numArray1[0];
       ((Path2D.Float) state1.seriesPath).moveTo(num3, num4);
       for (int index1 = 1; index1 <= length - 1; ++index1)
       {
         for (int index2 = 1; index2 <= this.precision; ++index2)
         {
           float num5 = numArray4[index1] * (float) index2 / (float) this.precision;
           float num6 = numArray4[index1] - num5;
           float num7 = (((float) (-(double) numArray3[index1 - 1] / 6.0) * (num6 + numArray4[index1]) * num5 + numArray1[index1 - 1]) * num6 + ((float) (-(double) numArray3[index1] / 6.0) * (num5 + numArray4[index1]) * num6 + numArray1[index1]) * num5) / numArray4[index1];
           float num8 = numArray2[index1 - 1] + num5;
           ((Path2D.Float) state1.seriesPath).lineTo(num8, num7);
         }
       }
     }
     this.drawFirstPassShape(g2, pass, series, item, (Shape) state1.seriesPath);
   }
   this.points = new Vector();
 }
 public override void drawItem(Graphics2D g2, XYItemRendererState state, Rectangle2D dataArea, PlotRenderingInfo info, XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset, int series, int item, CrosshairState crosshairState, int pass)
 {
   if (!(dataset is IntervalXYDataset) || !(dataset is TableXYDataset))
   {
     string str1 = new StringBuffer().append("dataset (type ").append(Object.instancehelper_getClass((object) dataset).getName()).append(") has wrong type:").toString();
     int num = 0;
     if (!(StackedXYBarRenderer.class\u0024org\u0024jfree\u0024data\u0024xy\u0024IntervalXYDataset != null ? StackedXYBarRenderer.class\u0024org\u0024jfree\u0024data\u0024xy\u0024IntervalXYDataset : (StackedXYBarRenderer.class\u0024org\u0024jfree\u0024data\u0024xy\u0024IntervalXYDataset = StackedXYBarRenderer.class\u0024("org.jfree.data.xy.IntervalXYDataset"))).isAssignableFrom(Object.instancehelper_getClass((object) dataset)))
     {
       str1 = new StringBuffer().append(str1).append(" it is no IntervalXYDataset").toString();
       num = 1;
     }
     if (!(StackedXYBarRenderer.class\u0024org\u0024jfree\u0024data\u0024xy\u0024TableXYDataset != null ? StackedXYBarRenderer.class\u0024org\u0024jfree\u0024data\u0024xy\u0024TableXYDataset : (StackedXYBarRenderer.class\u0024org\u0024jfree\u0024data\u0024xy\u0024TableXYDataset = StackedXYBarRenderer.class\u0024("org.jfree.data.xy.TableXYDataset"))).isAssignableFrom(Object.instancehelper_getClass((object) dataset)))
     {
       if (num != 0)
         str1 = new StringBuffer().append(str1).append(" and").toString();
       str1 = new StringBuffer().append(str1).append(" it is no TableXYDataset").toString();
     }
     string str2 = str1;
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new IllegalArgumentException(str2);
   }
   else
   {
     IntervalXYDataset ntervalXyDataset = (IntervalXYDataset) dataset;
     double yvalue1 = ntervalXyDataset.getYValue(series, item);
     if (Double.isNaN(yvalue1))
       return;
     double num1 = 0.0;
     if (this.renderAsPercentages)
     {
       num1 = DatasetUtilities.calculateStackTotal((TableXYDataset) dataset, item);
       yvalue1 /= num1;
     }
     double d1 = 0.0;
     double d2 = 0.0;
     for (int i1 = 0; i1 < series; ++i1)
     {
       double yvalue2 = dataset.getYValue(i1, item);
       if (!Double.isNaN(yvalue2))
       {
         if (this.renderAsPercentages)
           yvalue2 /= num1;
         if (yvalue2 > 0.0)
           d1 += yvalue2;
         else
           d2 += yvalue2;
       }
     }
     RectangleEdge rangeAxisEdge = plot.getRangeAxisEdge();
     double num2;
     double num3;
     if (yvalue1 > 0.0)
     {
       num2 = rangeAxis.valueToJava2D(d1, dataArea, rangeAxisEdge);
       num3 = rangeAxis.valueToJava2D(d1 + yvalue1, dataArea, rangeAxisEdge);
     }
     else
     {
       num2 = rangeAxis.valueToJava2D(d2, dataArea, rangeAxisEdge);
       num3 = rangeAxis.valueToJava2D(d2 + yvalue1, dataArea, rangeAxisEdge);
     }
     RectangleEdge domainAxisEdge = plot.getDomainAxisEdge();
     double startXvalue = ntervalXyDataset.getStartXValue(series, item);
     if (Double.isNaN(startXvalue))
       return;
     double num4 = domainAxis.valueToJava2D(startXvalue, dataArea, domainAxisEdge);
     double endXvalue = ntervalXyDataset.getEndXValue(series, item);
     if (Double.isNaN(endXvalue))
       return;
     double num5 = domainAxis.valueToJava2D(endXvalue, dataArea, domainAxisEdge);
     double num6 = Math.max(1.0, Math.abs(num5 - num4));
     double num7 = Math.abs(num3 - num2);
     if (this.getMargin() > 0.0)
     {
       double num8 = num6 * this.getMargin();
       num6 -= num8;
       num4 += num8 / 2.0;
     }
     Rectangle2D.Double @double = (Rectangle2D.Double) null;
     PlotOrientation orientation = plot.getOrientation();
     if (orientation == PlotOrientation.__\u003C\u003EHORIZONTAL)
       @double = new Rectangle2D.Double(Math.min(num2, num3), num5, num7, num6);
     else if (orientation == PlotOrientation.__\u003C\u003EVERTICAL)
       @double = new Rectangle2D.Double(num4, Math.min(num2, num3), num6, num7);
     int num9 = yvalue1 > 0.0 ? 1 : 0;
     int num10 = rangeAxis.isInverted() ? 1 : 0;
     RectangleEdge re = orientation != PlotOrientation.__\u003C\u003EHORIZONTAL ? (num9 != 0 && num10 == 0 || num9 == 0 && num10 != 0 ? RectangleEdge.__\u003C\u003EBOTTOM : RectangleEdge.__\u003C\u003ETOP) : (num9 != 0 && num10 != 0 || num9 == 0 && num10 == 0 ? RectangleEdge.__\u003C\u003ERIGHT : RectangleEdge.__\u003C\u003ELEFT);
     if (pass == 0)
     {
       if (!this.getShadowsVisible())
         return;
       this.getBarPainter().paintBarShadow(g2, (XYBarRenderer) this, series, item, (RectangularShape) @double, re, false);
     }
     else if (pass == 1)
     {
       this.getBarPainter().paintBar(g2, (XYBarRenderer) this, series, item, (RectangularShape) @double, re);
       if (info == null)
         return;
       EntityCollection entityCollection = info.getOwner().getEntityCollection();
       if (entityCollection == null)
         return;
       this.addEntity(entityCollection, (Shape) @double, dataset, series, item, ((RectangularShape) @double).getCenterX(), ((RectangularShape) @double).getCenterY());
     }
     else
     {
       if (pass != 2 || !this.isItemLabelVisible(series, item))
         return;
       XYItemLabelGenerator itemLabelGenerator = this.getItemLabelGenerator(series, item);
       this.drawItemLabel(g2, dataset, series, item, plot, itemLabelGenerator, (Rectangle2D) @double, yvalue1 < 0.0);
     }
   }
 }
예제 #3
0
 public override void drawItem(Graphics2D g2, XYItemRendererState state, Rectangle2D dataArea, PlotRenderingInfo info, XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset, int series, int item, CrosshairState crosshairState, int pass)
 {
   if (!this.getItemVisible(series, item))
     return;
   if (pass == 0)
   {
     IntervalXYDataset ntervalXyDataset = (IntervalXYDataset) dataset;
     DeviationRenderer.State state1 = (DeviationRenderer.State) state;
     double xvalue = ntervalXyDataset.getXValue(series, item);
     double startYvalue = ntervalXyDataset.getStartYValue(series, item);
     double endYvalue = ntervalXyDataset.getEndYValue(series, item);
     RectangleEdge domainAxisEdge = plot.getDomainAxisEdge();
     RectangleEdge rangeAxisEdge = plot.getRangeAxisEdge();
     double num1 = domainAxis.valueToJava2D(xvalue, dataArea, domainAxisEdge);
     double num2 = rangeAxis.valueToJava2D(startYvalue, dataArea, rangeAxisEdge);
     double num3 = rangeAxis.valueToJava2D(endYvalue, dataArea, rangeAxisEdge);
     PlotOrientation orientation = plot.getOrientation();
     if (orientation == PlotOrientation.__\u003C\u003EHORIZONTAL)
     {
       List list1 = state1.lowerCoordinates;
       double[] numArray1 = new double[2];
       int index1 = 0;
       double num4 = num2;
       numArray1[index1] = num4;
       int index2 = 1;
       double num5 = num1;
       numArray1[index2] = num5;
       list1.add((object) numArray1);
       List list2 = state1.upperCoordinates;
       double[] numArray2 = new double[2];
       int index3 = 0;
       double num6 = num3;
       numArray2[index3] = num6;
       int index4 = 1;
       double num7 = num1;
       numArray2[index4] = num7;
       list2.add((object) numArray2);
     }
     else if (orientation == PlotOrientation.__\u003C\u003EVERTICAL)
     {
       List list1 = state1.lowerCoordinates;
       double[] numArray1 = new double[2];
       int index1 = 0;
       double num4 = num1;
       numArray1[index1] = num4;
       int index2 = 1;
       double num5 = num2;
       numArray1[index2] = num5;
       list1.add((object) numArray1);
       List list2 = state1.upperCoordinates;
       double[] numArray2 = new double[2];
       int index3 = 0;
       double num6 = num1;
       numArray2[index3] = num6;
       int index4 = 1;
       double num7 = num3;
       numArray2[index4] = num7;
       list2.add((object) numArray2);
     }
     if (item == dataset.getItemCount(series) - 1)
     {
       Composite composite = g2.getComposite();
       g2.setComposite((Composite) AlphaComposite.getInstance(3, this.alpha));
       g2.setPaint(this.getItemFillPaint(series, item));
       GeneralPath generalPath = new GeneralPath();
       double[] numArray1 = (double[]) state1.lowerCoordinates.get(0);
       ((Path2D.Float) generalPath).moveTo((float) numArray1[0], (float) numArray1[1]);
       for (int index = 1; index < state1.lowerCoordinates.size(); ++index)
       {
         double[] numArray2 = (double[]) state1.lowerCoordinates.get(index);
         ((Path2D.Float) generalPath).lineTo((float) numArray2[0], (float) numArray2[1]);
       }
       int num4 = state1.upperCoordinates.size();
       double[] numArray3 = (double[]) state1.upperCoordinates.get(num4 - 1);
       ((Path2D.Float) generalPath).lineTo((float) numArray3[0], (float) numArray3[1]);
       int num5 = num4 - 2;
       while (num5 >= 0)
       {
         double[] numArray2 = (double[]) state1.upperCoordinates.get(num5);
         ((Path2D.Float) generalPath).lineTo((float) numArray2[0], (float) numArray2[1]);
         num5 += -1;
       }
       ((Path2D) generalPath).closePath();
       g2.fill((Shape) generalPath);
       g2.setComposite(composite);
       state1.lowerCoordinates.clear();
       state1.upperCoordinates.clear();
     }
   }
   if (this.isLinePass(pass))
   {
     if (item == 0)
     {
       DeviationRenderer.State state1 = (DeviationRenderer.State) state;
       ((Path2D) state1.seriesPath).reset();
       state1.setLastPointGood(false);
     }
     if (!this.getItemLineVisible(series, item))
       return;
     this.drawPrimaryLineAsPath(state, g2, plot, dataset, pass, series, item, domainAxis, rangeAxis, dataArea);
   }
   else
   {
     if (!this.isItemPass(pass))
       return;
     EntityCollection entities = (EntityCollection) null;
     if (info != null)
       entities = info.getOwner().getEntityCollection();
     this.drawSecondaryPass(g2, plot, dataset, pass, series, item, domainAxis, dataArea, rangeAxis, crosshairState, entities);
   }
 }
예제 #4
0
 public override void drawItem(Graphics2D g2, XYItemRendererState state, Rectangle2D dataArea, PlotRenderingInfo info, XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset, int series, int item, CrosshairState crosshairState, int pass)
 {
   if (pass == 0 && dataset is IntervalXYDataset && this.getItemVisible(series, item))
   {
     IntervalXYDataset ntervalXyDataset = (IntervalXYDataset) dataset;
     PlotOrientation orientation = plot.getOrientation();
     if (this.drawXError)
     {
       double startXvalue = ntervalXyDataset.getStartXValue(series, item);
       double endXvalue = ntervalXyDataset.getEndXValue(series, item);
       double yvalue = ntervalXyDataset.getYValue(series, item);
       RectangleEdge domainAxisEdge = plot.getDomainAxisEdge();
       double num1 = domainAxis.valueToJava2D(startXvalue, dataArea, domainAxisEdge);
       double num2 = domainAxis.valueToJava2D(endXvalue, dataArea, domainAxisEdge);
       double num3 = rangeAxis.valueToJava2D(yvalue, dataArea, plot.getRangeAxisEdge());
       double num4 = this.capLength / 2.0;
       Line2D.Double double1;
       Line2D.Double double2;
       Line2D.Double double3;
       if (orientation == PlotOrientation.__\u003C\u003EVERTICAL)
       {
         double1 = new Line2D.Double(num1, num3, num2, num3);
         double2 = new Line2D.Double(num1, num3 - num4, num1, num3 + num4);
         double3 = new Line2D.Double(num2, num3 - num4, num2, num3 + num4);
       }
       else
       {
         double1 = new Line2D.Double(num3, num1, num3, num2);
         double2 = new Line2D.Double(num3 - num4, num1, num3 + num4, num1);
         double3 = new Line2D.Double(num3 - num4, num2, num3 + num4, num2);
       }
       if (this.errorPaint != null)
         g2.setPaint(this.errorPaint);
       else
         g2.setPaint(this.getItemPaint(series, item));
       if (this.errorStroke != null)
         g2.setStroke(this.errorStroke);
       else
         g2.setStroke(this.getItemStroke(series, item));
       g2.draw((Shape) double1);
       g2.draw((Shape) double2);
       g2.draw((Shape) double3);
     }
     if (this.drawYError)
     {
       double startYvalue = ntervalXyDataset.getStartYValue(series, item);
       double endYvalue = ntervalXyDataset.getEndYValue(series, item);
       double xvalue = ntervalXyDataset.getXValue(series, item);
       RectangleEdge rangeAxisEdge = plot.getRangeAxisEdge();
       double num1 = rangeAxis.valueToJava2D(startYvalue, dataArea, rangeAxisEdge);
       double num2 = rangeAxis.valueToJava2D(endYvalue, dataArea, rangeAxisEdge);
       double num3 = domainAxis.valueToJava2D(xvalue, dataArea, plot.getDomainAxisEdge());
       double num4 = this.capLength / 2.0;
       Line2D.Double double1;
       Line2D.Double double2;
       Line2D.Double double3;
       if (orientation == PlotOrientation.__\u003C\u003EVERTICAL)
       {
         double1 = new Line2D.Double(num3, num1, num3, num2);
         double2 = new Line2D.Double(num3 - num4, num1, num3 + num4, num1);
         double3 = new Line2D.Double(num3 - num4, num2, num3 + num4, num2);
       }
       else
       {
         double1 = new Line2D.Double(num1, num3, num2, num3);
         double2 = new Line2D.Double(num1, num3 - num4, num1, num3 + num4);
         double3 = new Line2D.Double(num2, num3 - num4, num2, num3 + num4);
       }
       if (this.errorPaint != null)
         g2.setPaint(this.errorPaint);
       else
         g2.setPaint(this.getItemPaint(series, item));
       if (this.errorStroke != null)
         g2.setStroke(this.errorStroke);
       else
         g2.setStroke(this.getItemStroke(series, item));
       g2.draw((Shape) double1);
       g2.draw((Shape) double2);
       g2.draw((Shape) double3);
     }
   }
   base.drawItem(g2, state, dataArea, info, plot, domainAxis, rangeAxis, dataset, series, item, crosshairState, pass);
 }