@Override public void onNodeDragEnd(NodeDragEndEvent nodeDragEndEvent) { double x = nodeDragEndEvent.getX(); double y = nodeDragEndEvent.getY(); if (x < chartArea.getX() || x > (chartArea.getX() + getChartWidth()) || y < chartArea.getY() || y > (chartArea.getY() + getChartHeight())) { // Remove the series from data. XYChartData data = getData(); data.removeSerie(serie); // Force firing attributes changed event in order to capture it and redraw the chart. setData(data); } } });
@Override public void onNodeDragEnd(NodeDragEndEvent nodeDragEndEvent) { double x = nodeDragEndEvent.getX(); double y = nodeDragEndEvent.getY(); if (x < chartArea.getX() || x > (chartArea.getX() + getChartWidth()) || y < chartArea.getY() || y > (chartArea.getY() + getChartHeight())) { // Remove the series from data. XYChartData data = getData(); data.removeSerie(serie); // Force firing attributes changed event in order to capture it and redraw the chart. setData(data); } } });
@Override public void onNodeDragEnd(NodeDragEndEvent event) { int currentX = event.getX(); int currentY = event.getY(); int incrementX = currentX - initialXPosition; int incrementY = currentY - initialYPosition; initialXPosition = currentX; initialYPosition = currentY; double finalWidth = ChartResizer.this.width + incrementX; double finalHeight = ChartResizer.this.height + incrementY; showSizeText(sizeText, finalWidth, finalHeight); // Animate the resize rectangle to its final position. AnimationProperties rectangleAnimationProperties = new AnimationProperties(); rectangleAnimationProperties.push(AnimationProperty.Properties.X(finalWidth - RECTANGLE_SIZE)); rectangleAnimationProperties.push(AnimationProperty.Properties.Y(finalHeight - RECTANGLE_SIZE)); //IAnimationHandle rectangleAnimationHandle = resizeRectangleButton.animate(AnimationTweener.LINEAR, rectangleAnimationProperties, ANIMATION_DURATION); // Fire the resize event with apply flag set (final size). ChartResizer.this.fireEvent(new ChartResizeEvent(finalWidth, finalHeight, true)); ChartResizer.this.width = finalWidth; ChartResizer.this.height = finalHeight; } });
@Override public void onNodeDragEnd(NodeDragEndEvent event) { int currentX = event.getX(); int currentY = event.getY(); int incrementX = currentX - initialXPosition; int incrementY = currentY - initialYPosition; initialXPosition = currentX; initialYPosition = currentY; double finalWidth = ChartResizer.this.width + incrementX; double finalHeight = ChartResizer.this.height + incrementY; // Animate the resize rectangle to its final position. AnimationProperties rectangleAnimationProperties = new AnimationProperties(); rectangleAnimationProperties.push(AnimationProperty.Properties.X(finalWidth - RECTANGLE_SIZE)); rectangleAnimationProperties.push(AnimationProperty.Properties.Y(finalHeight - RECTANGLE_SIZE)); IAnimationHandle rectangleAnimationHandle = resizeRectangleButton.animate(AnimationTweener.LINEAR, rectangleAnimationProperties, ANIMATION_DURATION); // Fire the resize event with apply flag set (final size). ChartResizer.this.fireEvent(new ChartResizeEvent(finalWidth, finalHeight, true)); ChartResizer.this.width = finalWidth; ChartResizer.this.height = finalHeight; } });