Examples of PathSprite


Examples of com.sencha.gxt.chart.client.draw.path.PathSprite

   * Creates a pie series.
   */
  public PieSeries() {
    // setup shadow attributes
    shadowAttributes = new ArrayList<Sprite>();
    PathSprite config = new PathSprite();
    config.setStrokeWidth(6);
    config.setStrokeOpacity(1);
    config.setStroke(new RGB(200, 200, 200));
    config.setTranslation(1.2, 2);
    config.setStrokeLineJoin(LineJoin.ROUND);
    shadowAttributes.add(config);
    config = new PathSprite();
    config.setStrokeWidth(4);
    config.setStrokeOpacity(1);
    config.setStroke(new RGB(150, 150, 150));
    config.setTranslation(0.9, 1.5);
    config.setStrokeLineJoin(LineJoin.ROUND);
    shadowAttributes.add(config);
    config = new PathSprite();
    config.setStrokeWidth(2);
    config.setStrokeOpacity(1);
    config.setStroke(new RGB(100, 100, 100));
    config.setTranslation(0.6, 1);
    config.setStrokeLineJoin(LineJoin.ROUND);
    shadowAttributes.add(config);

    // initialize the shadow groups
    if (shadowGroups.size() == 0) {
      for (int i = 0; i < shadowAttributes.size(); i++) {
View Full Code Here

Examples of com.sencha.gxt.chart.client.draw.path.PathSprite

    PreciseRectangle bbox = null;

    if (sprite instanceof TextSprite) {
      bbox = getBBoxText((TextSprite) sprite);
    } else {
      PathSprite realPath = sprite.getPathSprite();
      bbox = realPath.dimensions();
    }

    if (sprite.getRotation() != null || sprite.getScaling() != null || sprite.getTranslation() != null) {
      PathSprite transPath = new PathSprite(new RectangleSprite(bbox));
      transPath = transPath.map(sprite.transformMatrix());
      bbox = transPath.dimensions();
    }

    return bbox;
  }
View Full Code Here

Examples of com.sencha.gxt.chart.client.draw.path.PathSprite

          slice.setEndRho(rhoAcum + deltaRho);
          // create shadows
          for (int shindex = 0; shindex < shadowGroups.size(); shindex++) {
            Sprite shadowAttr = shadowAttributes.get(shindex);
            SpriteList<Sprite> shadows = shadowGroups.get(shindex);
            final PathSprite shadow;

            commands = calculateSegment(slice);
            if (i < shadows.size()) {
              shadow = (PathSprite) shadows.get(i);
              shadow.setHidden(false);
            } else {
              shadow = (PathSprite) shadowAttr.copy();
              shadow.setFill(Color.NONE);
              chart.addSprite(shadow);
              shadows.add(shadow);
            }

            if (chart.isAnimated() && oldSlices.get(i) != null) {
              createSegmentAnimator(shadow, oldSlices.get(i), slice).run(chart.getAnimationDuration(),
                  chart.getAnimationEasing());
            } else {
              shadow.setCommands(commands);
              shadow.redraw();
            }
            if (shadowRenderer != null) {
              shadowRenderer.spriteRenderer(shadow, i, chart.getCurrentStore());
            }
          }
        }
      }
      shadowed = true;
    } else {
      hideShadows();
    }

    // do pie slices after
    for (int i = 0; i < store.size(); i++) {
      if (exclude.contains(i)) {
        continue;
      }
      slice = slices.get(i);
      rhoAcum = 0;
      for (int j = 0; j < layers; j++) {
        double deltaRho = 0;
        if (lengthField.size() > 0) {
          deltaRho = lengthField.get(j).getValue(store.get(i)).doubleValue() / layerTotals.get(i) * slice.getRho();
        } else {
          deltaRho = slice.getRho();
        }
        final PathSprite sprite;
        int index = i * layers + j;
        if (sprites.get(index) != null) {
          sprite = (PathSprite) sprites.get(index);
          sprite.setHidden(false);
        } else {
          // Create a new sprite if needed (no height)
          sprite = new PathSprite();
          sprite.setFill(getColor(i));
          sprite.setZIndex(10);
          sprites.add(sprite);
          chart.addSprite(sprite);
        }
        if (stroke != null) {
          sprite.setStroke(stroke);
        }
        if (!Double.isNaN(strokeWidth)) {
          sprite.setStrokeWidth(strokeWidth);
        }

        slice.setMargin(margin);
        slice.setStartRho(rhoAcum + (deltaRho * donut / 100));
        slice.setEndRho(rhoAcum + deltaRho);

        if (labelConfig != null) {
          calculateMiddle(slice, i);
        }

        if (chart.isAnimated() && oldSlices.get(i) != null) {
          createSegmentAnimator(sprite, oldSlices.get(i), slice).run(chart.getAnimationDuration(),
              chart.getAnimationEasing());
        } else {
          sprite.setCommands(calculateSegment(slice));
          sprite.redraw();
        }
        if (renderer != null) {
          renderer.spriteRenderer(sprite, i, store);
        }
        rhoAcum += deltaRho;
View Full Code Here

Examples of com.sencha.gxt.chart.client.draw.path.PathSprite

        ((PathSprite) sprites.get(spriteIndex)).setCommands(commands);
        sprites.get(spriteIndex).redraw();
        for (int i = 0; i < shadowGroups.size(); i++) {
          SpriteList<Sprite> shadows = shadowGroups.get(i);
          if (shadows.get(yFieldIndex) != null) {
            PathSprite shadow = (PathSprite) shadows.get(yFieldIndex);
            shadow.setCommands(commands);
            shadow.redraw();
          }
        }
      }
    }
    if (highlighter != null) {
View Full Code Here

Examples of com.sencha.gxt.chart.client.draw.path.PathSprite

        ((PathSprite) sprites.get(spriteIndex)).setCommands(commands);
        sprites.get(spriteIndex).redraw();
        for (int i = 0; i < shadowGroups.size(); i++) {
          SpriteList<Sprite> shadows = shadowGroups.get(i);
          if (shadows.get(yFieldIndex) != null) {
            PathSprite shadow = (PathSprite) shadows.get(yFieldIndex);
            shadow.setCommands(commands);
            shadow.redraw();
          }
        }
      }
    }
    if (highlighter != null) {
View Full Code Here

Examples of com.sencha.gxt.chart.client.draw.path.PathSprite

          PrecisePoint calloutPoint = new PrecisePoint(rho * Math.cos(theta) + center.getX(), rho * Math.sin(theta)
              + center.getY());
          x = rhoCenter * Math.cos(theta);
          y = rhoCenter * Math.sin(theta);

          final PathSprite line;
          if (calloutLines.get(i) != null) {
            line = calloutLines.get(i);
            line.setHidden(false);
          } else {
            line = new PathSprite();
            line.setStrokeWidth(1);
            line.setStroke(RGB.BLACK);
            line.setFill(Color.NONE);
            calloutLines.put(i, line);
            chart.addSprite(line);
          }

          final RectangleSprite box;
          if (calloutBoxes.get(i) != null) {
            box = calloutBoxes.get(i);
            box.setHidden(false);
          } else {
            box = new RectangleSprite();
            box.setStroke(RGB.BLACK);
            box.setStrokeWidth(1);
            box.setFill(Color.NONE);
            calloutBoxes.put(i, box);
            chart.addSprite(box);
          }

          sprite.redraw();
          PreciseRectangle bbox = sprite.getBBox();

          List<PathCommand> commands = new ArrayList<PathCommand>();
          commands.add(new MoveTo(x + center.getX(), y + center.getY()));
          commands.add(new LineTo(calloutPoint.getX(), calloutPoint.getY()));
          commands.add(new LineTo(x > 0 ? 10 : -10, 0, true));

          PreciseRectangle rect = new PreciseRectangle(calloutPoint.getX() + (x > 0 ? 10 : -(bbox.getWidth() + 30)),
              calloutPoint.getY() + (y > 0 ? (-(bbox.getHeight() - 5)) : (-(bbox.getHeight() - 5))),
              bbox.getWidth() + 20, bbox.getHeight() + 20);

          PrecisePoint labelPoint = new PrecisePoint(calloutPoint.getX() + (x > 0 ? 20 : -(20 + bbox.getWidth())),
              calloutPoint.getY() + (y > 0 ? -bbox.getHeight() / 4.0 : -bbox.getHeight() / 4.0));

          if (chart.isAnimated() && line.size() > 0 && !Double.isNaN(box.getX()) && sprite.getTranslation() != null) {
            DrawFx.createCommandsAnimator(line, commands).run(chart.getAnimationDuration(), chart.getAnimationEasing());
            DrawFx.createRectangleAnimator(box, rect).run(chart.getAnimationDuration(), chart.getAnimationEasing());
            DrawFx.createTranslationAnimator(sprite, labelPoint.getX(), labelPoint.getY()).run(
                chart.getAnimationDuration(), chart.getAnimationEasing());
          } else {
            line.setCommands(commands);
            line.redraw();
            box.setX(rect.getX());
            box.setY(rect.getY());
            box.setWidth(rect.getWidth());
            box.setHeight(rect.getHeight());
            box.redraw();
View Full Code Here

Examples of com.sencha.gxt.chart.client.draw.path.PathSprite

    for (int j = (int) length; j < lines.size(); j++) {
      lines.get(j).setHidden(true);
    }
    for (double i = 0; i < length; i++) {
      final PathSprite line;
      if (i < lines.size()) {
        line = lines.get((int) i);
        line.setHidden(false);
      } else {
        line = axisConfig.copy();
        chart.addSprite(line);
        lines.add(line);
      }
      line.clearCommands();
      line.addCommand(new MoveTo(centerX, centerY));
      line.addCommand(new LineTo(centerX + rho * Math.cos(i / length * pi2), centerY + rho * Math.sin(i / length * pi2)));
      line.addCommand(new ClosePath());
      line.redraw();
    }
    drawLabels();
  }
View Full Code Here

Examples of com.sencha.gxt.chart.client.draw.path.PathSprite

    return centerY;
  }

  @Override
  public PathSprite getPathSprite() {
    return new PathSprite(this);
  }
View Full Code Here

Examples of com.sencha.gxt.chart.client.draw.path.PathSprite

    return height;
  }

  @Override
  public PathSprite getPathSprite() {
    return new PathSprite(new RectangleSprite(width, height, x, y));
  }
View Full Code Here

Examples of com.sencha.gxt.chart.client.draw.path.PathSprite

   */
  private void applyAttributes(Sprite sprite) {
    XElement element = getElement(sprite);

    if (sprite instanceof PathSprite) {
      PathSprite path = (PathSprite) sprite;
      if (path.size() > 0) {
        element.setAttribute("d", path.toString());
      }
      if (path.isStrokeLineCapDirty()) {
        setAttribute(element, "stroke-linecap", path.getStrokeLineCap());
      }
      if (path.isStrokeLineJoinDirty()) {
        setAttribute(element, "stroke-linejoin", path.getStrokeLineJoin());
      }
      if (path.isMiterLimitDirty()) {
        setAttribute(element, "stroke-miterlimit", path.getMiterLimit());
      }
    } else if (sprite instanceof TextSprite) {
      TextSprite text = (TextSprite) sprite;
      if (text.isTextDirty() || text.isXDirty()) {
        tuneText(text);
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.