Examples of Tuple2D


Examples of org.timepedia.chronoscope.client.data.tuple.Tuple2D

    // Find index of data point closest to the right of dataX at the current MIP level
    int closestPtToRight = Util.binarySearch(currMipMap.getDomain(), dataX);

    double sx = domainToScreenX(dataX, datasetIndex);
    double sy = rangeToScreenY(dataY, datasetIndex);
    Tuple2D tupleRight = currMipMap.getTuple(closestPtToRight);
    double rx = domainToScreenX(tupleRight.getDomain(), datasetIndex);
    double ry = rangeToScreenY(tupleRight, datasetIndex, 0);

    int nearestHoverPt;
    if (closestPtToRight == 0) {
      nearestHoverPt = closestPtToRight;
      np.dist = df.dist(sx, sy, rx, ry);
      np.dim = 0;
      for (int d = 1; d < currMipMap.getRangeTupleSize(); d++) {
        double dist2 = df.dist(sx, sy, rx,
            rangeToScreenY(tupleRight, datasetIndex, d));
        if (dist2 < np.dist) {
          np.dist = dist2;
          np.dim = d;
        }
      }
    } else {
      int closestPtToLeft = closestPtToRight - 1;
      Tuple2D tupleLeft = currMipMap.getTuple(closestPtToLeft);
      double lx = domainToScreenX(tupleLeft.getDomain(), datasetIndex);
      double ly = rangeToScreenY(tupleLeft, datasetIndex, 0);
      double lDist = df.dist(sx, sy, lx, ly);
      double rDist = df.dist(sx, sy, rx, ry);
      np.dim = 0;
      if (lDist <= rDist) {
View Full Code Here

Examples of org.timepedia.chronoscope.client.data.tuple.Tuple2D

      ds = datasets.get(focusDatasetIdx);
    }

    MipMap currMipMap = plotRenderer
        .getDrawableDataset(focusDatasetIdx).currMipMap;
    Tuple2D dataPt = currMipMap.getTuple(focusPointIdx);
    double dataX = dataPt.getDomain();
    double dataY = dataPt.getRange0();
    ensureVisible(dataX, dataY, null);
    setFocusAndNotifyView(focusDatasetIdx, focusPointIdx, focusDim);
    redraw();
  }
View Full Code Here

Examples of org.timepedia.chronoscope.client.data.tuple.Tuple2D

      int domainEndIdx, DatasetRenderer<T> renderer) {
    double rangeMin = Double.MAX_VALUE;
    double rangeMax = Double.MIN_VALUE;
    Iterator<Tuple2D> tupleItr = mipMap.getTupleIterator(domainStartIdx);
    for (int i = domainStartIdx; i <= domainEndIdx; i++) {
      Tuple2D pt = tupleItr.next();
      double y = renderer.getRange(pt);
      rangeMin = Math.min(rangeMin, y);
      rangeMin = Math.min(rangeMin, pt.getRange0());
      rangeMax = Math.max(rangeMax, y);
      rangeMax = Math.max(rangeMax, pt.getRange0());
    }

    return new Interval(rangeMin, rangeMax);
  }
View Full Code Here

Examples of org.timepedia.chronoscope.client.data.tuple.Tuple2D

      renderer.beginCurve(layer, renderState);
      int methodCallCount = 0;
      for (int i = domainStartIdx; i <= domainEndIdx; i++) {
         if (tupleItr.hasNext()){
            Tuple2D dataPt = tupleItr.next();
            renderState.setFocused(focusSeries == datasetIndex && focusDomainX == dataPt.getDomain());

            if (calcRangeAsPercent) {
              LocalTuple tmpTuple = new LocalTuple();
              Interval rangeExtrema = dds.currMipMap.getRangeExtrema(pass);
              double pctY = rangeExtrema.getPercentChange(refY, dataPt.getRange0());
              tmpTuple.setXY(dataPt.getDomain(), pctY);
              dataPt = tmpTuple;
            }
            // FIXME: refactor to remove cast
            renderer.drawCurvePart(datasetIndex, i, layer, (T) dataPt, methodCallCount++, renderState);
         } else {
             break;
         }
      }
      renderer.endCurve(layer, renderState);

      if (!overviewMode) {
        // Render the focus points on the curve
        renderer.beginPoints(layer, renderState);
        //startIdx = Math.max(0, domainStartIdx - 2);
        tupleItr = currMipMap.getTupleIterator(domainStartIdx);
        for (int i = domainStartIdx; i <= domainEndIdx; i++) {
          Tuple2D dataPt = tupleItr.next();
          renderState.setFocused(focusSeries == datasetIndex && focusPoint == i && focusDomainX == dataPt.getDomain() && renderState.getPassNumber() == pass);

          if (calcRangeAsPercent) {
            LocalTuple tmpTuple = new LocalTuple();
            Interval rangeExtrema = dds.currMipMap.getRangeExtrema(pass);
            double pctY = rangeExtrema.getPercentChange(refY, dataPt.getRange0());
            tmpTuple.setXY(dataPt.getDomain(), pctY);
            dataPt = tmpTuple;
          }
          // FIXME: refactor to remove cast
          renderer.drawPoint(datasetIndex, i, layer, (T) dataPt, renderState);
        }
View Full Code Here

Examples of org.timepedia.chronoscope.client.data.tuple.Tuple2D

      }
    }
    if (datasetIndex != -1) {
      XYPlot plot = cp.getChart().getPlot();
      double x = plot.getDatasets().get(datasetIndex).getX(pointIndex);
      Tuple2D tuple = plot.getDatasets().get(datasetIndex)
          .getFlyweightTuple(pointIndex);
      double y = tuple.getRange0();
      currentInfoWindow = plot.openInfoWindow(html, x, y, datasetIndex);
      currentInfoWindow
          .addInfoWindowClosedHandler(new InfoWindowClosedHandler() {
            public void onInfoWindowClosed(InfoWindowEvent event) {
              currentInfoWindow = null;
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.