Examples of IAxis


Examples of org.jamesii.gui.visualization.chart.axes.IAxis

    // special cases
    for (int i = 0; i < 100; i++) {
      double min = Math.random() * 100000 - 50000;
      double max = Math.random() * 100000 + min;

      IAxis referenceAxis = new MidLogarithmicAxis();
      axis.setMinimumMaximum(min, max);
      axis.setLogStartPointValue((max - min) / 2 + min);

      referenceAxis.setMinimum(min);
      referenceAxis.setMaximum(max);

      for (int j = 0; j < 1000; j++) {
        double v = Math.random() * (max - min) + min;
        assertEquals(referenceAxis.transform(v), axis.transform(v), 0.00000001);
      }
    }

    for (int i = 0; i < 100; i++) {
      double min = Math.random() * 100000 - 50000;
      double max = Math.random() * 100000 + min;

      IAxis referenceAxis = new SimpleLogarithmicAxis();
      axis.setMinimumMaximum(min, max);
      axis.setLogStartPointValue(min);

      referenceAxis.setMinimum(min);
      referenceAxis.setMaximum(max);

      for (int j = 0; j < 1000; j++) {
        double v = Math.random() * (max - min) + min;
        assertEquals(referenceAxis.transform(v), axis.transform(v), 0.00000001);
      }
    }

    // small test for symmetry around the basePointValue

View Full Code Here

Examples of org.jamesii.gui.visualization.chart.axes.IAxis

    // mapping
    for (int i = 0; i < model.getSeriesCount(); i++) {
      for (int j = 0; j < model.getDimensions(); j++) {
        int group = model.getGroup(model.getSeries(i), j);
        if (!axisToGroup.containsValue(group)) {
          IAxis axis = new LinearAxis();
          axis.setMinimum(model.getMinValue(group).doubleValue());
          axis.setMaximum(model.getMaxValue(group).doubleValue());
          axes.add(axis);
          axisToGroup.put(axes.size() - 1, group);
          groupToAxis.put(group, axes.size() - 1);
          setAxisForDimension(axes.size() - 1, j);
        } else {
          IAxis axis = axes.get(axisToGroup.get(group));
          axis.setMinimum(model.getMinValue(group).doubleValue());
          axis.setMaximum(model.getMaxValue(group).doubleValue());
        }
      }
    }
  }
View Full Code Here

Examples of org.jamesii.gui.visualization.chart.axes.IAxis

    int nVerticalAxes = 0;

    List<Double> hTicks = null;
    List<Double> vTicks = null;

    IAxis hAxis = null;
    IAxis vAxis = null;

    for (int axis = 0; axis < getAxesCount(); axis++) {
      if (getDimensionForAxis(axis) == 0) {
        nHorizontalAxes++;
      }
      if (getDimensionForAxis(axis) == 1) {
        nVerticalAxes++;
      }
    }

    for (int axis = 0; axis < getAxesCount(); axis++) {
      if (getDimensionForAxis(axis) == 0) {
        // X-AXIS
        // get the extension of left axes
        int startX = x + getWidthLeftAxes(g);

        // get the extension of right axes
        int endX = x + width - getWidthRightAxes(g);

        // draw axis from startX to endX horizontal
        int y1 = y + height - getHeightLowerAxes(g, axis);
        drawHorizontalAxis(g, axis, startX, endX, y1,
            getHeightLowerAxes(g, axis));

        if (nHorizontalAxes == 1) {
          hTicks =
              renderer.getTicksForAxis(g, getAxis(axis), startX, y, endX
                  - startX, getHeightLowerAxes(g, axis), true, false);
          hAxis = getAxis(axis);
        }
      }

      if (getDimensionForAxis(axis) == 1) {
        // Y-AXIS
        // left if axis % 2 == 0 right otherwise
        boolean leftAxis = axis % 2 != 0;
        int startY = 10; // margin
        int endY = y + height - getHeightLowerAxes(g, axis);
        if (leftAxis) {
          int w = getWidthLeftAxis(g, axis);
          leftAxisPos += w;
          int startX = x + widthLeftAxes - leftAxisPos;
          leftAxisPos += marginX;

          drawLeftAxis(g, axis, startX, w + startX, startY, endY);

          if (nVerticalAxes == 1) {
            vTicks =
                renderer.getTicksForAxis(g, getAxis(axis), startX, startY, w,
                    endY - startY, false, true);
            vAxis = getAxis(axis);
          }
        } else {
          int w = getWidthRightAxis(g, axis);
          int startX = x + width - widthRightAxes + rightAxisPos;
          rightAxisPos += w + marginX;

          drawRightAxis(g, axis, startX, w + startX, startY, endY);
        }

      }
    }

    // GradientPaint paint =
    // new GradientPaint(new Point(x, y + height), Color.LIGHT_GRAY,
    // new Point(x, y), Color.white);
    // g.setPaint(paint);

    g.setColor(Color.WHITE);
    Point plotOrigin = getPlotOrigin(g, x, y, width, height);
    Dimension plotDimension = getPlotDimension(g, x, y, width, height);
    g.fillRect(plotOrigin.x, plotOrigin.y, plotDimension.width,
        plotDimension.height);
    // g.setPaint(null);

    // draw grid
    if (hTicks != null && hAxis != null) {
      g.setColor(Color.LIGHT_GRAY);
      g.setStroke(new BasicStroke(1f, BasicStroke.CAP_BUTT,
          BasicStroke.JOIN_BEVEL, 0, new float[] { 3, 3 }, 0));
      for (Double d : hTicks) {
        double v = hAxis.transform(d) * plotDimension.getWidth();
        g.drawLine((int) (plotOrigin.x + v), plotOrigin.y,
            (int) (plotOrigin.x + v), plotDimension.height + plotOrigin.y);
      }
    }

    if (vTicks != null && vAxis != null) {
      g.setColor(Color.LIGHT_GRAY);
      g.setStroke(new BasicStroke(1f, BasicStroke.CAP_BUTT,
          BasicStroke.JOIN_BEVEL, 0, new float[] { 3, 3 }, 0));
      for (Double d : vTicks) {
        double v = vAxis.transform(d) * plotDimension.getHeight();
        g.drawLine(plotOrigin.x,
            (int) (plotOrigin.y + plotDimension.height - v), plotOrigin.x
                + plotDimension.width, (int) (plotOrigin.y
                + plotDimension.height - v));
      }
View Full Code Here

Examples of org.jamesii.gui.visualization.chart.axes.IAxis

   * @param axisIndex
   *          the axis index
   * @return the width left axis
   */
  private int getWidthLeftAxis(Graphics2D g, int axisIndex) {
    IAxis axis = getAxis(axisIndex);
    return renderer.getWidth(g, axis, true);
  }
View Full Code Here

Examples of org.jamesii.gui.visualization.chart.axes.IAxis

   * @param axisIndex
   *          the axis' index the height is requested for
   * @return the height lower axes
   */
  private int getHeightLowerAxes(Graphics2D g, int axisIndex) {
    IAxis axis = getAxis(axisIndex);
    return renderer.getHeight(g, axis, false);
  }
View Full Code Here

Examples of org.jamesii.gui.visualization.chart.axes.IAxis

   * @param axisIndex
   *          the axis index
   * @return the width right axis
   */
  private int getWidthRightAxis(Graphics2D g, int axisIndex) {
    IAxis axis = getAxis(axisIndex);
    return renderer.getWidth(g, axis, false);
  }
View Full Code Here

Examples of org.jamesii.gui.visualization.chart.axes.IAxis

  public Point2D modelToView(ISeries series, int valueIndex) {
    // get x axis for series and get y axis for series
    int xGroup = getModel().getGroup(series, 0);
    int yGroup = getModel().getGroup(series, 1);

    IAxis xAxis = getAxis(this.getAxisForGroup(xGroup));
    IAxis yAxis = getAxis(this.getAxisForGroup(yGroup));

    double x = getModel().getValue(series, 0, valueIndex).doubleValue();
    double y = getModel().getValue(series, 1, valueIndex).doubleValue();

    return new Point2D.Double(xAxis.transform(x), yAxis.transform(y));
  }
View Full Code Here

Examples of org.swtchart.IAxis

    ISeries series = seriesSet.createSeries(SeriesType.LINE, "Particle Size Curve");
    series.setXSeries(xSeries);
    series.setYSeries(ySeries);
   
    IAxisSet axisSet = chart.getAxisSet();
    IAxis xAxis = axisSet.getXAxis(0);
//    xAxis.adjustRange();
    xAxis.setRange(new Range(0.001, 10));
    xAxis.getTitle().setText("Grain Size ( mm )");
    xAxis.enableLogScale(true);
    IAxis yAxis = axisSet.getYAxis(0);
    yAxis.getTitle().setText("Percent Finer");
//    yAxis.setPosition(Position.Secondary);
    yAxis.setRange(new Range(0, 100));
//    axisSet.adjustRange();
   
    chart.update();
  }
View Full Code Here

Examples of org.swtchart.IAxis

    // Layout der Achsen
    Color gray = getColor(new RGB(234,234,234));
   
    // X-Achse
    {
      IAxis axis = this.chart.getAxisSet().getXAxis(0);
      axis.getTitle().setFont(Font.SMALL.getSWTFont());
      axis.getTitle().setForeground(GUI.getDisplay().getSystemColor(SWT.COLOR_WHITE)); // wenn wir den auch ausblenden, geht die initiale Skalierung kaputt. Scheint ein Bug zu sein

      IGrid grid = axis.getGrid();
      grid.setStyle(LineStyle.DOT);
      grid.setForeground(gray);

      IAxisTick tick = axis.getTick();
      tick.setFormat(HBCI.DATEFORMAT);
      tick.setForeground(GUI.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
    }
   
    // Y-Achse
    {
      IAxis axis = this.chart.getAxisSet().getYAxis(0);
      axis.getTitle().setVisible(false);

      IGrid grid = axis.getGrid();
      grid.setStyle(LineStyle.DOT);
      grid.setForeground(gray);
     
      IAxisTick tick = axis.getTick();
      tick.setFormat(HBCI.DECIMALFORMAT);
      tick.setForeground(GUI.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
    }
    //
    ////////////////////////////////////////////////////////////////////////////
View Full Code Here

Examples of org.swtchart.IAxis

        for (ISeries series : getSeries()) {
            int xAxisId = series.getXAxisId();
            int yAxisId = series.getYAxisId();

            IAxis xAxis = chart.getAxisSet().getXAxis(xAxisId);
            IAxis yAxis = chart.getAxisSet().getYAxis(yAxisId);
            if (xAxis == null || yAxis == null) {
                continue;
            }
            Range xRange = xAxis.getRange();
            Range yRange = yAxis.getRange();

            if (xRange == null || yRange == null) {
                continue;
            }

            double xMin = xRange.lower;
            double xMax = xRange.upper;
            double yMin = yRange.lower;
            double yMax = yRange.upper;

            config.setXLogScale(xAxis.isLogScaleEnabled());
            config.setYLogScale(yAxis.isLogScaleEnabled());

            double lower = xMin - (xMax - xMin) * 0.015;
            double upper = xMax + (xMax - xMin) * 0.015;
            if (xAxis.isLogScaleEnabled()) {
                lower = ((Series) series).getXRange().lower;
            }
            config.setXRange(lower, upper);
            lower = yMin - (yMax - yMin) * 0.015;
            upper = yMax + (yMax - yMin) * 0.015;
            if (yAxis.isLogScaleEnabled()) {
                lower = ((Series) series).getYRange().lower;
            }
            config.setYRange(lower, upper);

            ICompress compressor = ((Series) series).getCompressor();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.