Package com.sencha.gxt.chart.client.draw.sprite

Examples of com.sencha.gxt.chart.client.draw.sprite.RectangleSprite


      }
      if (text.isYDirty()) {
        setAttribute(element, "y", text.getY());
      }
    } else if (sprite instanceof RectangleSprite) {
      RectangleSprite rect = (RectangleSprite) sprite;
      if (rect.isXDirty()) {
        setAttribute(element, "x", rect.getX());
      }
      if (rect.isYDirty()) {
        setAttribute(element, "y", rect.getY());
      }
      if (rect.isWidthDirty()) {
        setAttribute(element, "width", rect.getWidth());

      }
      if (rect.isHeightDirty()) {
        setAttribute(element, "height", rect.getHeight());
      }
      if (rect.isRadiusDirty()) {
        setAttribute(element, "rx", rect.getRadius());
        setAttribute(element, "ry", rect.getRadius());

      }
    } else if (sprite instanceof CircleSprite) {
      CircleSprite circle = (CircleSprite) sprite;
      if (circle.isCenterXDirty()) {
View Full Code Here


   */
  public void draw() {
    // setup the background of the surface
    if (component.getBackground() != null) {
      if (backgroundSprite == null) {
        backgroundSprite = new RectangleSprite();
        backgroundSprite.setZIndex(0);
        this.sprites.add(0, backgroundSprite);
        backgroundSprite.setSurface(null);
      }
      backgroundSprite.setX(0);
View Full Code Here

      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

  private SeriesRenderer<M> lineRenderer;
  private SeriesRenderer<M> labelRenderer;
  private int lastLegendItem = -1;

  public Legend() {
    borderConfig = new RectangleSprite();
    borderConfig.setStroke(RGB.BLACK);
    borderConfig.setStrokeWidth(1);
    borderConfig.setFill(Color.NONE);
  }
View Full Code Here

            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();
            sprite.setTranslation(labelPoint.getX(), labelPoint.getY());
            sprite.redraw();
          }
        } else if (labelPosition == LabelPosition.END) {
          rho = Math.sqrt(x * x + y * y) * 2.0;
 
View Full Code Here

      marker = series.getLabelConfig().getSpriteConfig().copy();
      add(marker);
      chart.addSprite(marker);
    } else {
      // All other series types - display as filled box
      marker = new RectangleSprite(12, 12, -6, -6);
      add(marker);
      chart.addSprite(marker);
      if (series instanceof MultipleColorSeries) {
        MultipleColorSeries<M> multi = (MultipleColorSeries<M>) series;
        marker.setFill(multi.getColor(yFieldIndex));
      }
    }

    PreciseRectangle bbox = getBBox();
    mask = new RectangleSprite();
    mask.setX(bbox.getX());
    mask.setY(bbox.getY());
    mask.setWidth(bbox.getWidth());
    mask.setHeight(bbox.getHeight());
    mask.setOpacity(0);
View Full Code Here

      }
      if (chart.hasShadows()) {
        renderShadows(i);
      }

      final RectangleSprite bar;
      RectangleSprite rect = rects.get(i);
      if (i < sprites.size()) {
        bar = (RectangleSprite) sprites.get(i);
        bar.setHidden(false);
      } else {
        // Create a new bar if needed (no height)
        bar = new RectangleSprite();
        if (column) {
          bar.setX(rect.getX());
          bar.setY(rect.getY() + rect.getHeight());
          bar.setWidth(rect.getWidth());
          bar.setHeight(0);
        } else {
          bar.setX(rect.getX());
          bar.setY(rect.getY());
          bar.setWidth(0);
          bar.setHeight(rect.getHeight());
        }
        sprites.add(bar);
        chart.addSprite(bar);
      }
      if (chart.isAnimated() && chart.isResizing()) {
        if (column) {
          bar.setX(rect.getX());
          bar.setY(rect.getY() + rect.getHeight());
          bar.setWidth(rect.getWidth());
          bar.setHeight(0);
        } else {
          bar.setX(rect.getX());
          bar.setY(rect.getY());
          bar.setWidth(0);
          bar.setHeight(rect.getHeight());
        }
      }
      bar.setFill(rect.getFill());
      if (stroke != null) {
        bar.setStroke(stroke);
      }
      if (!Double.isNaN(strokeWidth)) {
        bar.setStrokeWidth(strokeWidth);
      }
      if (chart.isAnimated() && !Double.isNaN(bar.getX())) {
        DrawFx.createRectangleAnimator(bar, rect.toRectangle()).run(chart.getAnimationDuration(),
            chart.getAnimationEasing());
      } else {
        bar.setX(rect.getX());
        bar.setY(rect.getY());
        bar.setWidth(rect.getWidth());
        bar.setHeight(rect.getHeight());
        bar.redraw();
      }
      if (renderer != null) {
        renderer.spriteRenderer(bar, i, store);
      }
View Full Code Here

    chart.getAxis(yAxisPosition);
  }

  @Override
  public void highlight(int yFieldIndex) {
    RectangleSprite bar = (RectangleSprite) sprites.get(yFieldIndex);
    highlighter.highlight(bar);
  }
View Full Code Here

    }
  }

  @Override
  public void unHighlight(int yFieldIndex) {
    RectangleSprite bar = (RectangleSprite) sprites.get(yFieldIndex);
    highlighter.unHighlight(bar);
  }
View Full Code Here

        if (Math.abs(minY) <= Math.abs(maxY)) {
          height = (value - minY) * scale;
        } else {
          height = (value - maxY) * scale;
        }
        RectangleSprite rect;
        if (rects.get((i * fieldsLength) + j) != null) {
          rect = rects.get((i * fieldsLength) + j);
        } else {
          // Create a new sprite if needed (no height)
          rect = new RectangleSprite();
          rects.put((i * fieldsLength) + j, rect);
        }
        if (colors.size() > 0) {
          rect.setFill(colors.get((yFields.size() > 1 ? j : 0) % colors.size()));
        }
        if (column) {
          rect.setWidth(Math.max(groupBarWidth, 0));
          rect.setX(bbox.getX() + xPadding + i * getBarGirth() * (1 + gutter) + counter * groupBarWidth
              * (1 + groupGutter) * (!stacked ? 1 : 0));
          if (height < 0) {
            rect.setY(top);
            rect.setHeight(-height);
          } else {
            rect.setY(Math.round(bottom - height));
            rect.setHeight(Math.round(height) + (zero != bottom ? 1 : 0));
            if (j == 0 || !stacked) {
              double diff = (rect.getY() + rect.getHeight()) - (bbox.getY() + bbox.getHeight() - 1);
              if (diff != 0) {
                rect.setHeight(Math.max(rect.getHeight() - diff, 0));
              }
            }
          }
        } else {
          // draw in reverse order
          rect.setHeight(Math.max(groupBarWidth, 0));
          if (height < 0) {
            rect.setX(top + height);
            rect.setWidth(-height);
          } else {
            rect.setX(Math.round(bottom) + (zero != bottom ? 1 : 0));
            rect.setWidth(Math.round(height + 1));
          }
          rect.setY(bbox.getY() + yPadding + (store.size() - 1 - i) * getBarGirth() * (1 + gutter) + counter
              * groupBarWidth * (1 + groupGutter) * (!stacked ? 1 : 0) + 1);
        }
        if (stacked) {
          if (height < 0) {
            top += height * (column ? -1 : 1);
View Full Code Here

TOP

Related Classes of com.sencha.gxt.chart.client.draw.sprite.RectangleSprite

Copyright © 2018 www.massapicom. 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.