@Override
  protected void clearValues(double chartWidth, double chartHeight) {
    final Map<String, List<Rectangle>> seriesValues = getBarChart().getSeriesValues();
    final double yClearPos = chartHeight;
    final double xClearPos =
        ChartDirection.POSITIVE.equals(getBarChart().getDirection()) ? 0 : chartWidth;

    // Apply animation to values.
    if (seriesValues != null) {
      for (Map.Entry<String, List<Rectangle>> entry : seriesValues.entrySet()) {
        for (Rectangle rectangle : entry.getValue()) {
          if (isVertical()) add(rectangle, buildAnimationProperties(null, yClearPos, null, 0d));
          else add(rectangle, buildAnimationProperties(null, null, xClearPos, null));
        }
      }
    }
  }
  @Override
  protected void clearValues(double chartWidth, double chartHeight) {
    final Map<String, List<Line>> seriesValues = getLineChart().getSeriesValues();
    final Map<String, List<Circle>> seriesPoints = getLineChart().getSeriesPoints();

    final double yClearPos = chartHeight;
    final double xClearPos =
        ChartDirection.POSITIVE.equals(getLineChart().getDirection()) ? 0 : chartWidth;

    // Apply animation to lines.
    if (seriesValues != null) {
      for (Map.Entry<String, List<Line>> entry : seriesValues.entrySet()) {
        for (Line line : entry.getValue()) {
          final Point2D p1 = line.getPoint2DArray().get(0);
          final Point2D p2 = line.getPoint2DArray().get(1);
          PointsAnimationProperty points = null;
          if (isVertical())
            points =
                new PointsAnimationProperty(
                    new Point2D(p1.getX(), yClearPos),
                    new Point2D(p2.getX(), yClearPos),
                    Attribute.POINTS);
          else
            points =
                new PointsAnimationProperty(
                    new Point2D(xClearPos, p1.getY()),
                    new Point2D(xClearPos, p2.getY()),
                    Attribute.POINTS);

          final AnimationProperties animationProperties = new AnimationProperties();
          animationProperties.push(points);
          add(line, animationProperties);
        }
      }
    }

    // Apply animation to points.
    if (seriesPoints != null) {
      for (Map.Entry<String, List<Circle>> entry : seriesPoints.entrySet()) {
        for (Circle circle : entry.getValue()) {
          if (isVertical()) add(circle, buildAnimationProperties(null, yClearPos, null, 0d));
          else add(circle, buildAnimationProperties(xClearPos, null));
        }
      }
    }
  }
  protected void init(final double chartWidth, final double chartHeight) {
    // Title & Legend & tooltip.
    final Text chartTitle = getXYChart().getChartTitle();
    final ChartLegend legend = getXYChart().getChartLegend();
    final XYChartTooltip tooltip = getXYChart().getChartTooltip();
    if (legend != null) legend.removeFromParent();
    if (tooltip != null) tooltip.removeFromParent();

    // Bar children.
    final List<Text> categoriesAxisTitles = getXYChart().getCategoriesAxisTitle();
    final List<Text> valuesAxisTitles = getXYChart().getValuesAxisTitle();
    final List<XYChartLabel> seriesLabels = getXYChart().getSeriesLabels();
    final List<Line> valuesAxisIntervals = getXYChart().getValuesAxisIntervals();
    final List<XYChartLabel> valuesLabels = getXYChart().getValuesLabels();

    // Title.
    if (chartTitle != null) {
      destroyTitle(chartTitle);
    }
    // Categories axis title.
    if (categoriesAxisTitles != null && !categoriesAxisTitles.isEmpty()) {
      for (Text t : categoriesAxisTitles) {
        destroyTitle(t);
      }
    }
    // Values axis title.
    if (valuesAxisTitles != null && !valuesAxisTitles.isEmpty()) {
      for (Text t : valuesAxisTitles) {
        destroyTitle(t);
      }
    }
    // Categories labels.
    if (seriesLabels != null) {
      for (XYChartLabel label : seriesLabels) {
        destroyCategoriesAxisLabel(label);
      }
    }
    // Values labels.
    if (valuesLabels != null) {
      for (XYChartLabel label : valuesLabels) {
        destroyValuesAxisLabel(label);
      }
    }
    // Create the nodes' animations.
    final double yClearPos = chartHeight;
    final double xClearPos =
        ChartDirection.POSITIVE.equals(getXYChart().getDirection()) ? 0 : chartWidth;
    // Apply animation values axis intervals.
    if (valuesAxisIntervals != null) {
      for (final Line line : valuesAxisIntervals) {
        if (line != null) {
          final double clearDiff =
              isVertical()
                  ? (yClearPos - line.getPoints().get(1).getY())
                  : (xClearPos - line.getPoints().get(1).getX());
          if (isVertical()) add(line, buildAnimationProperties(null, clearDiff));
          else add(line, buildAnimationProperties(clearDiff, null));
        }
      }
    }
    AnimationProperties animationProperties2 = new AnimationProperties();
    animationProperties2.push(AnimationProperty.Properties.Y(yClearPos));
    animationProperties2.push(AnimationProperty.Properties.HEIGHT(0d));

    // Apply animation to values.
    clearValues(chartWidth, chartHeight);

    // Create axis titles' animations.
    if (!getXYChart().getCategoriesAxisTitle().isEmpty())
      add(
          (Node<?>) getXYChart().getCategoriesAxisTitle().get(0),
          buildAnimationProperties(null, null, 0d, 0d));
    if (!getXYChart().getValuesAxisTitle().isEmpty())
      add(
          (Node<?>) getXYChart().getValuesAxisTitle().get(0),
          buildAnimationProperties(null, null, 0d, 0d));
  }