/*******************************************************************************
 * Copyright (c) 2014 EclipseSource and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    EclipseSource - initial API and implementation
 ******************************************************************************/

package org.eclipse.rap.chartjs;

import org.eclipse.rap.json.JsonObject;

public class ChartOptions {

  private boolean animation = true;
  private boolean showToolTips = true;
  private boolean scaleBeginAtZero = true;
  private boolean bezierCurve = true;
  private boolean showFill = true;
  private boolean scaleShowLabels = true;
  private int pointDotRadius = 3;
  private int strokeWidth = 2;

  public ChartOptions setAnimation( boolean animation ) {
    this.animation = animation;
    return this;
  }

  public boolean getAnimation() {
    return this.animation;
  }

  public ChartOptions setShowToolTips( boolean showToolTips ) {
    this.showToolTips = showToolTips;
    return this;
  }

  public boolean getShowToolTips() {
    return this.showToolTips;
  }

  public boolean getScaleBeginAtZero() {
    return scaleBeginAtZero;
  }

  public ChartOptions setScaleBeginAtZero( boolean scaleBeginAtZero ) {
    this.scaleBeginAtZero = scaleBeginAtZero;
    return this;
  }

  public boolean getBezierCurve() {
    return bezierCurve;
  }

  public ChartOptions setBezierCurve( boolean bezierCurve ) {
    this.bezierCurve = bezierCurve;
    return this;
  }

  public boolean getShowFill() {
    return showFill;
  }

  public ChartOptions setShowFill( boolean showFill ) {
    this.showFill = showFill;
    return this;
  }

  public int getPointDotRadius() {
    return pointDotRadius;
  }

  public ChartOptions setPointDotRadius( int pointDotRadius ) {
    this.pointDotRadius = pointDotRadius;
    return this;
  }

  public int getStrokeWidth() {
    return strokeWidth;
  }

  public ChartOptions setStrokeWidth( int strokeWidth ) {
    this.strokeWidth = strokeWidth;
    return this;
  }

  public boolean getScaleShowLabels() {
    return scaleShowLabels;
  }

  public ChartOptions setScaleShowLabels( boolean scaleShowLabels ) {
    this.scaleShowLabels = scaleShowLabels;
    return this;
  }

  JsonObject toJson() {
    JsonObject result = new JsonObject();
    result.add( "animation", animation );
    result.add( "showTooltips", showToolTips );
    result.add( "scaleBeginAtZero", scaleBeginAtZero );
    result.add( "bezierCurve", bezierCurve );
    result.add( "datasetFill", showFill );
    result.add( "pointDot", pointDotRadius > 0 ? true : false );
    result.add( "pointDotRadius", pointDotRadius );
    result.add( "showStroke", strokeWidth > 0 ? true : false );
    result.add( "strokeWidth", strokeWidth );
    result.add( "scaleShowLabels", scaleShowLabels );
    return result;
  }

}


@@ -926,16 +926,136 @@
 h = 2;%0A%0A
+  /**%0A   * Sets whether to play an %22appear%22 animation for a new chart drawing.%0A   * @param animation%0A   * @return%0A   */%0A
   public
@@ -1220,24 +1220,144 @@
 ation;%0A  %7D%0A%0A
+  /**%0A   * Sets whether to show tooltips on data segments/points/bars.%0A   *%0A   * @param showToolTips%0A   * @return%0A   */%0A
   public Cha
@@ -1611,24 +1611,190 @@
 tZero;%0A  %7D%0A%0A
+  /**%0A   * Sets whether the scale should start at zero, or an order of magnitude down from the lowest%0A   * value%0A   *%0A   * @param scaleBeginAtZero%0A   * @return%0A   */%0A
   public Cha
@@ -1982,24 +1982,147 @@
 Curve;%0A  %7D%0A%0A
+  /**%0A   * Sets whether the line between points in a line chart is curved.%0A   *%0A   * @param bezierCurve%0A   * @return%0A   */%0A
   public Cha
@@ -2284,24 +2284,142 @@
 wFill;%0A  %7D%0A%0A
+  /**%0A   * Sets whether the area below a line is filled in a line chart.%0A   *%0A   * @param showFill%0A   * @return%0A   */%0A
   public Cha
@@ -2573,32 +2573,171 @@
 DotRadius;%0A  %7D%0A%0A
+  /**%0A   * Sets the radius of a dot in a line or radar chart. Set to 0 to draw no dots.%0A   *%0A   * @param pointDotRadius%0A   * @return%0A   */%0A
   public ChartOp
@@ -2905,24 +2905,135 @@
 Width;%0A  %7D%0A%0A
+  /**%0A   * Sets the width of the outline of a data segment.%0A   *%0A   * @param pointDotRadius%0A   * @return%0A   */%0A
   public Cha
@@ -3201,32 +3201,157 @@
 howLabels;%0A  %7D%0A%0A
+  /**%0A   * Sets whether or not to show labels on the scale of the chart.%0A   *%0A   * @param scaleShowLabels%0A   * @return%0A   */%0A
   public ChartOp

Add minimal javadoc to ChartOptions.java