2 * Copyright (C) 2009 - 2012 SC 4ViewSoft SRL
\r
4 * Licensed under the Apache License, Version 2.0 (the "License");
\r
5 * you may not use this file except in compliance with the License.
\r
6 * You may obtain a copy of the License at
\r
8 * http://www.apache.org/licenses/LICENSE-2.0
\r
10 * Unless required by applicable law or agreed to in writing, software
\r
11 * distributed under the License is distributed on an "AS IS" BASIS,
\r
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 * See the License for the specific language governing permissions and
\r
14 * limitations under the License.
\r
16 package org.achartengine.renderer;
\r
18 import java.io.Serializable;
\r
20 import android.graphics.Color;
\r
21 import android.graphics.Paint.Align;
\r
24 * A simple series renderer.
\r
26 public class SimpleSeriesRenderer implements Serializable {
\r
27 /** The series color. */
\r
28 private int mColor = Color.BLUE;
\r
29 /** If the values should be displayed above the chart points. */
\r
30 private boolean mDisplayChartValues;
\r
31 /** The chart values text size. */
\r
32 private float mChartValuesTextSize = 10;
\r
33 /** The chart values text alignment. */
\r
34 private Align mChartValuesTextAlign = Align.CENTER;
\r
35 /** The chart values spacing from the data point. */
\r
36 private float mChartValuesSpacing = 5f;
\r
37 /** The stroke style. */
\r
38 private BasicStroke mStroke;
\r
39 /** If gradient is enabled. */
\r
40 private boolean mGradientEnabled = false;
\r
41 /** The gradient start value. */
\r
42 private double mGradientStartValue;
\r
43 /** The gradient start color. */
\r
44 private int mGradientStartColor;
\r
45 /** The gradient stop value. */
\r
46 private double mGradientStopValue;
\r
47 /** The gradient stop color. */
\r
48 private int mGradientStopColor;
\r
51 * Returns the series color.
\r
53 * @return the series color
\r
55 public int getColor() {
\r
60 * Sets the series color.
\r
62 * @param color the series color
\r
64 public void setColor(int color) {
\r
69 * Returns if the chart point values should be displayed as text.
\r
71 * @return if the chart point values should be displayed as text
\r
73 public boolean isDisplayChartValues() {
\r
74 return mDisplayChartValues;
\r
78 * Sets if the chart point values should be displayed as text.
\r
80 * @param display if the chart point values should be displayed as text
\r
82 public void setDisplayChartValues(boolean display) {
\r
83 mDisplayChartValues = display;
\r
87 * Returns the chart values text size.
\r
89 * @return the chart values text size
\r
91 public float getChartValuesTextSize() {
\r
92 return mChartValuesTextSize;
\r
96 * Sets the chart values text size.
\r
98 * @param textSize the chart values text size
\r
100 public void setChartValuesTextSize(float textSize) {
\r
101 mChartValuesTextSize = textSize;
\r
105 * Returns the chart values text align.
\r
107 * @return the chart values text align
\r
109 public Align getChartValuesTextAlign() {
\r
110 return mChartValuesTextAlign;
\r
114 * Sets the chart values text align.
\r
116 * @param align the chart values text align
\r
118 public void setChartValuesTextAlign(Align align) {
\r
119 mChartValuesTextAlign = align;
\r
123 * Returns the chart values spacing from the data point.
\r
125 * @return the chart values spacing
\r
127 public float getChartValuesSpacing() {
\r
128 return mChartValuesSpacing;
\r
132 * Sets the chart values spacing from the data point.
\r
134 * @param spacing the chart values spacing (in pixels) from the chart data
\r
137 public void setChartValuesSpacing(float spacing) {
\r
138 mChartValuesSpacing = spacing;
\r
142 * Returns the stroke style.
\r
144 * @return the stroke style
\r
146 public BasicStroke getStroke() {
\r
151 * Sets the stroke style.
\r
153 * @param stroke the stroke style
\r
155 public void setStroke(BasicStroke stroke) {
\r
160 * Returns the gradient is enabled value.
\r
162 * @return the gradient enabled
\r
164 public boolean isGradientEnabled() {
\r
165 return mGradientEnabled;
\r
169 * Sets the gradient enabled value.
\r
171 * @param enabled the gradient enabled
\r
173 public void setGradientEnabled(boolean enabled) {
\r
174 mGradientEnabled = enabled;
\r
178 * Returns the gradient start value.
\r
180 * @return the gradient start value
\r
182 public double getGradientStartValue() {
\r
183 return mGradientStartValue;
\r
187 * Returns the gradient start color.
\r
189 * @return the gradient start color
\r
191 public int getGradientStartColor() {
\r
192 return mGradientStartColor;
\r
196 * Sets the gradient start value and color.
\r
198 * @param start the gradient start value
\r
199 * @param color the gradient start color
\r
201 public void setGradientStart(double start, int color) {
\r
202 mGradientStartValue = start;
\r
203 mGradientStartColor = color;
\r
207 * Returns the gradient stop value.
\r
209 * @return the gradient stop value
\r
211 public double getGradientStopValue() {
\r
212 return mGradientStopValue;
\r
216 * Returns the gradient stop color.
\r
218 * @return the gradient stop color
\r
220 public int getGradientStopColor() {
\r
221 return mGradientStopColor;
\r
225 * Sets the gradient stop value and color.
\r
227 * @param start the gradient stop value
\r
228 * @param color the gradient stop color
\r
230 public void setGradientStop(double start, int color) {
\r
231 mGradientStopValue = start;
\r
232 mGradientStopColor = color;
\r