--- /dev/null
+/**\r
+ * Copyright (C) 2009 - 2012 SC 4ViewSoft SRL\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+package org.achartengine.renderer;\r
+\r
+import java.util.HashMap;\r
+import java.util.LinkedHashMap;\r
+import java.util.Map;\r
+\r
+import org.achartengine.util.MathHelper;\r
+\r
+import android.graphics.Color;\r
+import android.graphics.Paint.Align;\r
+\r
+/**\r
+ * Multiple XY series renderer.\r
+ */\r
+public class XYMultipleSeriesRenderer extends DefaultRenderer {\r
+ /** The X axis title. */\r
+ private String mXTitle = "";\r
+ /** The Y axis title. */\r
+ private String[] mYTitle;\r
+ /** The axis title text size. */\r
+ private float mAxisTitleTextSize = 12;\r
+ /** The start value in the X axis range. */\r
+ private double[] mMinX;\r
+ /** The end value in the X axis range. */\r
+ private double[] mMaxX;\r
+ /** The start value in the Y axis range. */\r
+ private double[] mMinY;\r
+ /** The end value in the Y axis range. */\r
+ private double[] mMaxY;\r
+ /** The approximative number of labels on the x axis. */\r
+ private int mXLabels = 5;\r
+ /** The approximative number of labels on the y axis. */\r
+ private int mYLabels = 5;\r
+ /** The current orientation of the chart. */\r
+ private Orientation mOrientation = Orientation.HORIZONTAL;\r
+ /** The X axis text labels. */\r
+ private Map<Double, String> mXTextLabels = new HashMap<Double, String>();\r
+ /** The Y axis text labels. */\r
+ private Map<Integer, Map<Double, String>> mYTextLabels = new LinkedHashMap<Integer, Map<Double, String>>();\r
+ /** A flag for enabling or not the pan on the X axis. */\r
+ private boolean mPanXEnabled = true;\r
+ /** A flag for enabling or not the pan on the Y axis. */\r
+ private boolean mPanYEnabled = true;\r
+ /** A flag for enabling or not the zoom on the X axis. */\r
+ private boolean mZoomXEnabled = true;\r
+ /** A flag for enabling or not the zoom on the Y axis . */\r
+ private boolean mZoomYEnabled = true;\r
+ /** The spacing between bars, in bar charts. */\r
+ private double mBarSpacing = 0;\r
+ /** The margins colors. */\r
+ private int mMarginsColor = NO_COLOR;\r
+ /** The pan limits. */\r
+ private double[] mPanLimits;\r
+ /** The zoom limits. */\r
+ private double[] mZoomLimits;\r
+ /** The X axis labels rotation angle. */\r
+ private float mXLabelsAngle;\r
+ /** The Y axis labels rotation angle. */\r
+ private float mYLabelsAngle;\r
+ /** The initial axis range. */\r
+ private Map<Integer, double[]> initialRange = new LinkedHashMap<Integer, double[]>();\r
+ /** The point size for charts displaying points. */\r
+ private float mPointSize = 3;\r
+ /** The grid color. */\r
+ private int mGridColor = Color.argb(75, 200, 200, 200);\r
+ /** The number of scales. */\r
+ private int scalesCount;\r
+ /** The X axis labels alignment. */\r
+ private Align xLabelsAlign = Align.CENTER;\r
+ /** The Y axis labels alignment. */\r
+ private Align[] yLabelsAlign;\r
+ /** The Y axis alignment. */\r
+ private Align[] yAxisAlign;\r
+ /** The X axis labels color. */\r
+ private int mXLabelsColor = TEXT_COLOR;\r
+ /** The Y axis labels color. */\r
+ private int[] mYLabelsColor = new int[] { TEXT_COLOR };\r
+ /**\r
+ * If X axis value selection algorithm to be used. Only used by the time\r
+ * charts.\r
+ */\r
+ private boolean mXRoundedLabels = true;\r
+\r
+ /**\r
+ * An enum for the XY chart orientation of the X axis.\r
+ */\r
+ public enum Orientation {\r
+ HORIZONTAL(0), VERTICAL(90);\r
+ /** The rotate angle. */\r
+ private int mAngle = 0;\r
+\r
+ private Orientation(int angle) {\r
+ mAngle = angle;\r
+ }\r
+\r
+ /**\r
+ * Return the orientation rotate angle.\r
+ * \r
+ * @return the orientaion rotate angle\r
+ */\r
+ public int getAngle() {\r
+ return mAngle;\r
+ }\r
+ }\r
+\r
+ public XYMultipleSeriesRenderer() {\r
+ this(1);\r
+ }\r
+\r
+ public XYMultipleSeriesRenderer(int scaleNumber) {\r
+ scalesCount = scaleNumber;\r
+ initAxesRange(scaleNumber);\r
+ }\r
+\r
+ public void initAxesRange(int scales) {\r
+ mYTitle = new String[scales];\r
+ yLabelsAlign = new Align[scales];\r
+ yAxisAlign = new Align[scales];\r
+ mYLabelsColor = new int[scales];\r
+ mMinX = new double[scales];\r
+ mMaxX = new double[scales];\r
+ mMinY = new double[scales];\r
+ mMaxY = new double[scales];\r
+ for (int i = 0; i < scales; i++) {\r
+ mYLabelsColor[i] = TEXT_COLOR;\r
+ initAxesRangeForScale(i);\r
+ }\r
+ }\r
+\r
+ public void initAxesRangeForScale(int i) {\r
+ mMinX[i] = MathHelper.NULL_VALUE;\r
+ mMaxX[i] = -MathHelper.NULL_VALUE;\r
+ mMinY[i] = MathHelper.NULL_VALUE;\r
+ mMaxY[i] = -MathHelper.NULL_VALUE;\r
+ double[] range = new double[] { mMinX[i], mMaxX[i], mMinY[i], mMaxY[i] };\r
+ initialRange.put(i, range);\r
+ mYTitle[i] = "";\r
+ mYTextLabels.put(i, new HashMap<Double, String>());\r
+ yLabelsAlign[i] = Align.CENTER;\r
+ yAxisAlign[i] = Align.LEFT;\r
+ }\r
+\r
+ /**\r
+ * Returns the current orientation of the chart X axis.\r
+ * \r
+ * @return the chart orientation\r
+ */\r
+ public Orientation getOrientation() {\r
+ return mOrientation;\r
+ }\r
+\r
+ /**\r
+ * Sets the current orientation of the chart X axis.\r
+ * \r
+ * @param orientation the chart orientation\r
+ */\r
+ public void setOrientation(Orientation orientation) {\r
+ mOrientation = orientation;\r
+ }\r
+\r
+ /**\r
+ * Returns the title for the X axis.\r
+ * \r
+ * @return the X axis title\r
+ */\r
+ public String getXTitle() {\r
+ return mXTitle;\r
+ }\r
+\r
+ /**\r
+ * Sets the title for the X axis.\r
+ * \r
+ * @param title the X axis title\r
+ */\r
+ public void setXTitle(String title) {\r
+ mXTitle = title;\r
+ }\r
+\r
+ /**\r
+ * Returns the title for the Y axis.\r
+ * \r
+ * @return the Y axis title\r
+ */\r
+ public String getYTitle() {\r
+ return getYTitle(0);\r
+ }\r
+\r
+ /**\r
+ * Returns the title for the Y axis.\r
+ * \r
+ * @param scale the renderer scale\r
+ * @return the Y axis title\r
+ */\r
+ public String getYTitle(int scale) {\r
+ return mYTitle[scale];\r
+ }\r
+\r
+ /**\r
+ * Sets the title for the Y axis.\r
+ * \r
+ * @param title the Y axis title\r
+ */\r
+ public void setYTitle(String title) {\r
+ setYTitle(title, 0);\r
+ }\r
+\r
+ /**\r
+ * Sets the title for the Y axis.\r
+ * \r
+ * @param title the Y axis title\r
+ * @param scale the renderer scale\r
+ */\r
+ public void setYTitle(String title, int scale) {\r
+ mYTitle[scale] = title;\r
+ }\r
+\r
+ /**\r
+ * Returns the axis title text size.\r
+ * \r
+ * @return the axis title text size\r
+ */\r
+ public float getAxisTitleTextSize() {\r
+ return mAxisTitleTextSize;\r
+ }\r
+\r
+ /**\r
+ * Sets the axis title text size.\r
+ * \r
+ * @param textSize the chart axis text size\r
+ */\r
+ public void setAxisTitleTextSize(float textSize) {\r
+ mAxisTitleTextSize = textSize;\r
+ }\r
+\r
+ /**\r
+ * Returns the start value of the X axis range.\r
+ * \r
+ * @return the X axis range start value\r
+ */\r
+ public double getXAxisMin() {\r
+ return getXAxisMin(0);\r
+ }\r
+\r
+ /**\r
+ * Sets the start value of the X axis range.\r
+ * \r
+ * @param min the X axis range start value\r
+ */\r
+ public void setXAxisMin(double min) {\r
+ setXAxisMin(min, 0);\r
+ }\r
+\r
+ /**\r
+ * Returns if the minimum X value was set.\r
+ * \r
+ * @return the minX was set or not\r
+ */\r
+ public boolean isMinXSet() {\r
+ return isMinXSet(0);\r
+ }\r
+\r
+ /**\r
+ * Returns the end value of the X axis range.\r
+ * \r
+ * @return the X axis range end value\r
+ */\r
+ public double getXAxisMax() {\r
+ return getXAxisMax(0);\r
+ }\r
+\r
+ /**\r
+ * Sets the end value of the X axis range.\r
+ * \r
+ * @param max the X axis range end value\r
+ */\r
+ public void setXAxisMax(double max) {\r
+ setXAxisMax(max, 0);\r
+ }\r
+\r
+ /**\r
+ * Returns if the maximum X value was set.\r
+ * \r
+ * @return the maxX was set or not\r
+ */\r
+ public boolean isMaxXSet() {\r
+ return isMaxXSet(0);\r
+ }\r
+\r
+ /**\r
+ * Returns the start value of the Y axis range.\r
+ * \r
+ * @return the Y axis range end value\r
+ */\r
+ public double getYAxisMin() {\r
+ return getYAxisMin(0);\r
+ }\r
+\r
+ /**\r
+ * Sets the start value of the Y axis range.\r
+ * \r
+ * @param min the Y axis range start value\r
+ */\r
+ public void setYAxisMin(double min) {\r
+ setYAxisMin(min, 0);\r
+ }\r
+\r
+ /**\r
+ * Returns if the minimum Y value was set.\r
+ * \r
+ * @return the minY was set or not\r
+ */\r
+ public boolean isMinYSet() {\r
+ return isMinYSet(0);\r
+ }\r
+\r
+ /**\r
+ * Returns the end value of the Y axis range.\r
+ * \r
+ * @return the Y axis range end value\r
+ */\r
+ public double getYAxisMax() {\r
+ return getYAxisMax(0);\r
+ }\r
+\r
+ /**\r
+ * Sets the end value of the Y axis range.\r
+ * \r
+ * @param max the Y axis range end value\r
+ */\r
+ public void setYAxisMax(double max) {\r
+ setYAxisMax(max, 0);\r
+ }\r
+\r
+ /**\r
+ * Returns if the maximum Y value was set.\r
+ * \r
+ * @return the maxY was set or not\r
+ */\r
+ public boolean isMaxYSet() {\r
+ return isMaxYSet(0);\r
+ }\r
+\r
+ /**\r
+ * Returns the start value of the X axis range.\r
+ * \r
+ * @param scale the renderer scale\r
+ * @return the X axis range start value\r
+ */\r
+ public double getXAxisMin(int scale) {\r
+ return mMinX[scale];\r
+ }\r
+\r
+ /**\r
+ * Sets the start value of the X axis range.\r
+ * \r
+ * @param min the X axis range start value\r
+ * @param scale the renderer scale\r
+ */\r
+ public void setXAxisMin(double min, int scale) {\r
+ if (!isMinXSet(scale)) {\r
+ initialRange.get(scale)[0] = min;\r
+ }\r
+ mMinX[scale] = min;\r
+ }\r
+\r
+ /**\r
+ * Returns if the minimum X value was set.\r
+ * \r
+ * @param scale the renderer scale\r
+ * @return the minX was set or not\r
+ */\r
+ public boolean isMinXSet(int scale) {\r
+ return mMinX[scale] != MathHelper.NULL_VALUE;\r
+ }\r
+\r
+ /**\r
+ * Returns the end value of the X axis range.\r
+ * \r
+ * @param scale the renderer scale\r
+ * @return the X axis range end value\r
+ */\r
+ public double getXAxisMax(int scale) {\r
+ return mMaxX[scale];\r
+ }\r
+\r
+ /**\r
+ * Sets the end value of the X axis range.\r
+ * \r
+ * @param max the X axis range end value\r
+ * @param scale the renderer scale\r
+ */\r
+ public void setXAxisMax(double max, int scale) {\r
+ if (!isMaxXSet(scale)) {\r
+ initialRange.get(scale)[1] = max;\r
+ }\r
+ mMaxX[scale] = max;\r
+ }\r
+\r
+ /**\r
+ * Returns if the maximum X value was set.\r
+ * \r
+ * @param scale the renderer scale\r
+ * @return the maxX was set or not\r
+ */\r
+ public boolean isMaxXSet(int scale) {\r
+ return mMaxX[scale] != -MathHelper.NULL_VALUE;\r
+ }\r
+\r
+ /**\r
+ * Returns the start value of the Y axis range.\r
+ * \r
+ * @param scale the renderer scale\r
+ * @return the Y axis range end value\r
+ */\r
+ public double getYAxisMin(int scale) {\r
+ return mMinY[scale];\r
+ }\r
+\r
+ /**\r
+ * Sets the start value of the Y axis range.\r
+ * \r
+ * @param min the Y axis range start value\r
+ * @param scale the renderer scale\r
+ */\r
+ public void setYAxisMin(double min, int scale) {\r
+ if (!isMinYSet(scale)) {\r
+ initialRange.get(scale)[2] = min;\r
+ }\r
+ mMinY[scale] = min;\r
+ }\r
+\r
+ /**\r
+ * Returns if the minimum Y value was set.\r
+ * \r
+ * @param scale the renderer scale\r
+ * @return the minY was set or not\r
+ */\r
+ public boolean isMinYSet(int scale) {\r
+ return mMinY[scale] != MathHelper.NULL_VALUE;\r
+ }\r
+\r
+ /**\r
+ * Returns the end value of the Y axis range.\r
+ * \r
+ * @param scale the renderer scale\r
+ * @return the Y axis range end value\r
+ */\r
+ public double getYAxisMax(int scale) {\r
+ return mMaxY[scale];\r
+ }\r
+\r
+ /**\r
+ * Sets the end value of the Y axis range.\r
+ * \r
+ * @param max the Y axis range end value\r
+ * @param scale the renderer scale\r
+ */\r
+ public void setYAxisMax(double max, int scale) {\r
+ if (!isMaxYSet(scale)) {\r
+ initialRange.get(scale)[3] = max;\r
+ }\r
+ mMaxY[scale] = max;\r
+ }\r
+\r
+ /**\r
+ * Returns if the maximum Y value was set.\r
+ * \r
+ * @param scale the renderer scale\r
+ * @return the maxY was set or not\r
+ */\r
+ public boolean isMaxYSet(int scale) {\r
+ return mMaxY[scale] != -MathHelper.NULL_VALUE;\r
+ }\r
+\r
+ /**\r
+ * Returns the approximate number of labels for the X axis.\r
+ * \r
+ * @return the approximate number of labels for the X axis\r
+ */\r
+ public int getXLabels() {\r
+ return mXLabels;\r
+ }\r
+\r
+ /**\r
+ * Sets the approximate number of labels for the X axis.\r
+ * \r
+ * @param xLabels the approximate number of labels for the X axis\r
+ */\r
+ public void setXLabels(int xLabels) {\r
+ mXLabels = xLabels;\r
+ }\r
+\r
+ /**\r
+ * Adds a new text label for the specified X axis value.\r
+ * \r
+ * @param x the X axis value\r
+ * @param text the text label\r
+ * @deprecated use addXTextLabel instead\r
+ */\r
+ public void addTextLabel(double x, String text) {\r
+ addXTextLabel(x, text);\r
+ }\r
+\r
+ /**\r
+ * Adds a new text label for the specified X axis value.\r
+ * \r
+ * @param x the X axis value\r
+ * @param text the text label\r
+ */\r
+ public void addXTextLabel(double x, String text) {\r
+ mXTextLabels.put(x, text);\r
+ }\r
+\r
+ /**\r
+ * Returns the X axis text label at the specified X axis value.\r
+ * \r
+ * @param x the X axis value\r
+ * @return the X axis text label\r
+ */\r
+ public String getXTextLabel(Double x) {\r
+ return mXTextLabels.get(x);\r
+ }\r
+\r
+ /**\r
+ * Returns the X text label locations.\r
+ * \r
+ * @return the X text label locations\r
+ */\r
+ public Double[] getXTextLabelLocations() {\r
+ return mXTextLabels.keySet().toArray(new Double[0]);\r
+ }\r
+\r
+ /**\r
+ * Clears the existing text labels.\r
+ * \r
+ * @deprecated use clearXTextLabels instead\r
+ */\r
+ public void clearTextLabels() {\r
+ clearXTextLabels();\r
+ }\r
+\r
+ /**\r
+ * Clears the existing text labels on the X axis.\r
+ */\r
+ public void clearXTextLabels() {\r
+ mXTextLabels.clear();\r
+ }\r
+\r
+ /**\r
+ * If X axis labels should be rounded.\r
+ * \r
+ * @return if rounded time values to be used\r
+ */\r
+ public boolean isXRoundedLabels() {\r
+ return mXRoundedLabels;\r
+ }\r
+\r
+ /**\r
+ * Sets if X axis rounded time values to be used.\r
+ * \r
+ * @param rounded rounded values to be used\r
+ */\r
+ public void setXRoundedLabels(boolean rounded) {\r
+ mXRoundedLabels = rounded;\r
+ }\r
+\r
+ /**\r
+ * Adds a new text label for the specified Y axis value.\r
+ * \r
+ * @param y the Y axis value\r
+ * @param text the text label\r
+ */\r
+ public void addYTextLabel(double y, String text) {\r
+ addYTextLabel(y, text, 0);\r
+ }\r
+\r
+ /**\r
+ * Adds a new text label for the specified Y axis value.\r
+ * \r
+ * @param y the Y axis value\r
+ * @param text the text label\r
+ * @param scale the renderer scale\r
+ */\r
+ public void addYTextLabel(double y, String text, int scale) {\r
+ mYTextLabels.get(scale).put(y, text);\r
+ }\r
+\r
+ /**\r
+ * Returns the Y axis text label at the specified Y axis value.\r
+ * \r
+ * @param y the Y axis value\r
+ * @return the Y axis text label\r
+ */\r
+ public String getYTextLabel(Double y) {\r
+ return getYTextLabel(y, 0);\r
+ }\r
+\r
+ /**\r
+ * Returns the Y axis text label at the specified Y axis value.\r
+ * \r
+ * @param y the Y axis value\r
+ * @param scale the renderer scale\r
+ * @return the Y axis text label\r
+ */\r
+ public String getYTextLabel(Double y, int scale) {\r
+ return mYTextLabels.get(scale).get(y);\r
+ }\r
+\r
+ /**\r
+ * Returns the Y text label locations.\r
+ * \r
+ * @return the Y text label locations\r
+ */\r
+ public Double[] getYTextLabelLocations() {\r
+ return getYTextLabelLocations(0);\r
+ }\r
+\r
+ /**\r
+ * Returns the Y text label locations.\r
+ * \r
+ * @param scale the renderer scale\r
+ * @return the Y text label locations\r
+ */\r
+ public Double[] getYTextLabelLocations(int scale) {\r
+ return mYTextLabels.get(scale).keySet().toArray(new Double[0]);\r
+ }\r
+\r
+ /**\r
+ * Clears the existing text labels on the Y axis.\r
+ */\r
+ public void clearYTextLabels() {\r
+ clearYTextLabels(0);\r
+ }\r
+\r
+ /**\r
+ * Clears the existing text labels on the Y axis.\r
+ * \r
+ * @param scale the renderer scale\r
+ */\r
+ public void clearYTextLabels(int scale) {\r
+ mYTextLabels.get(scale).clear();\r
+ }\r
+\r
+ /**\r
+ * Returns the approximate number of labels for the Y axis.\r
+ * \r
+ * @return the approximate number of labels for the Y axis\r
+ */\r
+ public int getYLabels() {\r
+ return mYLabels;\r
+ }\r
+\r
+ /**\r
+ * Sets the approximate number of labels for the Y axis.\r
+ * \r
+ * @param yLabels the approximate number of labels for the Y axis\r
+ */\r
+ public void setYLabels(int yLabels) {\r
+ mYLabels = yLabels;\r
+ }\r
+\r
+ /**\r
+ * Sets if the chart point values should be displayed as text.\r
+ * \r
+ * @param display if the chart point values should be displayed as text\r
+ * @deprecated use SimpleSeriesRenderer.setDisplayChartValues() instead\r
+ */\r
+ public void setDisplayChartValues(boolean display) {\r
+ SimpleSeriesRenderer[] renderers = getSeriesRenderers();\r
+ for (SimpleSeriesRenderer renderer : renderers) {\r
+ renderer.setDisplayChartValues(display);\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Sets the chart values text size.\r
+ * \r
+ * @param textSize the chart values text size\r
+ * @deprecated use SimpleSeriesRenderer.setChartValuesTextSize() instead\r
+ */\r
+ public void setChartValuesTextSize(float textSize) {\r
+ SimpleSeriesRenderer[] renderers = getSeriesRenderers();\r
+ for (SimpleSeriesRenderer renderer : renderers) {\r
+ renderer.setChartValuesTextSize(textSize);\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Returns the enabled state of the pan on at least one axis.\r
+ * \r
+ * @return if pan is enabled\r
+ */\r
+ public boolean isPanEnabled() {\r
+ return isPanXEnabled() || isPanYEnabled();\r
+ }\r
+\r
+ /**\r
+ * Returns the enabled state of the pan on X axis.\r
+ * \r
+ * @return if pan is enabled on X axis\r
+ */\r
+ public boolean isPanXEnabled() {\r
+ return mPanXEnabled;\r
+ }\r
+\r
+ /**\r
+ * Returns the enabled state of the pan on Y axis.\r
+ * \r
+ * @return if pan is enabled on Y axis\r
+ */\r
+ public boolean isPanYEnabled() {\r
+ return mPanYEnabled;\r
+ }\r
+\r
+ /**\r
+ * Sets the enabled state of the pan.\r
+ * \r
+ * @param enabledX pan enabled on X axis\r
+ * @param enabledY pan enabled on Y axis\r
+ */\r
+ public void setPanEnabled(boolean enabledX, boolean enabledY) {\r
+ mPanXEnabled = enabledX;\r
+ mPanYEnabled = enabledY;\r
+ }\r
+\r
+ /**\r
+ * Returns the enabled state of the zoom on at least one axis.\r
+ * \r
+ * @return if zoom is enabled\r
+ */\r
+ public boolean isZoomEnabled() {\r
+ return isZoomXEnabled() || isZoomYEnabled();\r
+ }\r
+\r
+ /**\r
+ * Returns the enabled state of the zoom on X axis.\r
+ * \r
+ * @return if zoom is enabled on X axis\r
+ */\r
+ public boolean isZoomXEnabled() {\r
+ return mZoomXEnabled;\r
+ }\r
+\r
+ /**\r
+ * Returns the enabled state of the zoom on Y axis.\r
+ * \r
+ * @return if zoom is enabled on Y axis\r
+ */\r
+ public boolean isZoomYEnabled() {\r
+ return mZoomYEnabled;\r
+ }\r
+\r
+ /**\r
+ * Sets the enabled state of the zoom.\r
+ * \r
+ * @param enabledX zoom enabled on X axis\r
+ * @param enabledY zoom enabled on Y axis\r
+ */\r
+ public void setZoomEnabled(boolean enabledX, boolean enabledY) {\r
+ mZoomXEnabled = enabledX;\r
+ mZoomYEnabled = enabledY;\r
+ }\r
+\r
+ /**\r
+ * Returns the spacing between bars, in bar charts.\r
+ * \r
+ * @return the spacing between bars\r
+ * @deprecated use getBarSpacing instead\r
+ */\r
+ public double getBarsSpacing() {\r
+ return getBarSpacing();\r
+ }\r
+\r
+ /**\r
+ * Returns the spacing between bars, in bar charts.\r
+ * \r
+ * @return the spacing between bars\r
+ */\r
+ public double getBarSpacing() {\r
+ return mBarSpacing;\r
+ }\r
+\r
+ /**\r
+ * Sets the spacing between bars, in bar charts. Only available for bar\r
+ * charts. This is a coefficient of the bar width. For instance, if you want\r
+ * the spacing to be a half of the bar width, set this value to 0.5.\r
+ * \r
+ * @param spacing the spacing between bars coefficient\r
+ */\r
+ public void setBarSpacing(double spacing) {\r
+ mBarSpacing = spacing;\r
+ }\r
+\r
+ /**\r
+ * Returns the margins color.\r
+ * \r
+ * @return the margins color\r
+ */\r
+ public int getMarginsColor() {\r
+ return mMarginsColor;\r
+ }\r
+\r
+ /**\r
+ * Sets the color of the margins.\r
+ * \r
+ * @param color the margins color\r
+ */\r
+ public void setMarginsColor(int color) {\r
+ mMarginsColor = color;\r
+ }\r
+\r
+ /**\r
+ * Returns the grid color.\r
+ * \r
+ * @return the grid color\r
+ */\r
+ public int getGridColor() {\r
+ return mGridColor;\r
+ }\r
+\r
+ /**\r
+ * Sets the color of the grid.\r
+ * \r
+ * @param color the grid color\r
+ */\r
+ public void setGridColor(int color) {\r
+ mGridColor = color;\r
+ }\r
+\r
+ /**\r
+ * Returns the pan limits.\r
+ * \r
+ * @return the pan limits\r
+ */\r
+ public double[] getPanLimits() {\r
+ return mPanLimits;\r
+ }\r
+\r
+ /**\r
+ * Sets the pan limits as an array of 4 values. Setting it to null or a\r
+ * different size array will disable the panning limitation. Values:\r
+ * [panMinimumX, panMaximumX, panMinimumY, panMaximumY]\r
+ * \r
+ * @param panLimits the pan limits\r
+ */\r
+ public void setPanLimits(double[] panLimits) {\r
+ mPanLimits = panLimits;\r
+ }\r
+\r
+ /**\r
+ * Returns the zoom limits.\r
+ * \r
+ * @return the zoom limits\r
+ */\r
+ public double[] getZoomLimits() {\r
+ return mZoomLimits;\r
+ }\r
+\r
+ /**\r
+ * Sets the zoom limits as an array of 4 values. Setting it to null or a\r
+ * different size array will disable the zooming limitation. Values:\r
+ * [zoomMinimumX, zoomMaximumX, zoomMinimumY, zoomMaximumY]\r
+ * \r
+ * @param zoomLimits the zoom limits\r
+ */\r
+ public void setZoomLimits(double[] zoomLimits) {\r
+ mZoomLimits = zoomLimits;\r
+ }\r
+\r
+ /**\r
+ * Returns the rotation angle of labels for the X axis.\r
+ * \r
+ * @return the rotation angle of labels for the X axis\r
+ */\r
+ public float getXLabelsAngle() {\r
+ return mXLabelsAngle;\r
+ }\r
+\r
+ /**\r
+ * Sets the rotation angle (in degrees) of labels for the X axis.\r
+ * \r
+ * @param angle the rotation angle of labels for the X axis\r
+ */\r
+ public void setXLabelsAngle(float angle) {\r
+ mXLabelsAngle = angle;\r
+ }\r
+\r
+ /**\r
+ * Returns the rotation angle of labels for the Y axis.\r
+ * \r
+ * @return the approximate number of labels for the Y axis\r
+ */\r
+ public float getYLabelsAngle() {\r
+ return mYLabelsAngle;\r
+ }\r
+\r
+ /**\r
+ * Sets the rotation angle (in degrees) of labels for the Y axis.\r
+ * \r
+ * @param angle the rotation angle of labels for the Y axis\r
+ */\r
+ public void setYLabelsAngle(float angle) {\r
+ mYLabelsAngle = angle;\r
+ }\r
+\r
+ /**\r
+ * Returns the size of the points, for charts displaying points.\r
+ * \r
+ * @return the point size\r
+ */\r
+ public float getPointSize() {\r
+ return mPointSize;\r
+ }\r
+\r
+ /**\r
+ * Sets the size of the points, for charts displaying points.\r
+ * \r
+ * @param size the point size\r
+ */\r
+ public void setPointSize(float size) {\r
+ mPointSize = size;\r
+ }\r
+\r
+ public void setRange(double[] range) {\r
+ setRange(range, 0);\r
+ }\r
+\r
+ /**\r
+ * Sets the axes range values.\r
+ * \r
+ * @param range an array having the values in this order: minX, maxX, minY,\r
+ * maxY\r
+ * @param scale the renderer scale\r
+ */\r
+ public void setRange(double[] range, int scale) {\r
+ setXAxisMin(range[0], scale);\r
+ setXAxisMax(range[1], scale);\r
+ setYAxisMin(range[2], scale);\r
+ setYAxisMax(range[3], scale);\r
+ }\r
+\r
+ public boolean isInitialRangeSet() {\r
+ return isInitialRangeSet(0);\r
+ }\r
+\r
+ /**\r
+ * Returns if the initial range is set.\r
+ * \r
+ * @param scale the renderer scale\r
+ * @return the initial range was set or not\r
+ */\r
+ public boolean isInitialRangeSet(int scale) {\r
+ return initialRange.get(scale) != null;\r
+ }\r
+\r
+ /**\r
+ * Returns the initial range.\r
+ * \r
+ * @return the initial range\r
+ */\r
+ public double[] getInitialRange() {\r
+ return getInitialRange(0);\r
+ }\r
+\r
+ /**\r
+ * Returns the initial range.\r
+ * \r
+ * @param scale the renderer scale\r
+ * @return the initial range\r
+ */\r
+ public double[] getInitialRange(int scale) {\r
+ return initialRange.get(scale);\r
+ }\r
+\r
+ /**\r
+ * Sets the axes initial range values. This will be used in the zoom fit tool.\r
+ * \r
+ * @param range an array having the values in this order: minX, maxX, minY,\r
+ * maxY\r
+ */\r
+ public void setInitialRange(double[] range) {\r
+ setInitialRange(range, 0);\r
+ }\r
+\r
+ /**\r
+ * Sets the axes initial range values. This will be used in the zoom fit tool.\r
+ * \r
+ * @param range an array having the values in this order: minX, maxX, minY,\r
+ * maxY\r
+ * @param scale the renderer scale\r
+ */\r
+ public void setInitialRange(double[] range, int scale) {\r
+ initialRange.put(scale, range);\r
+ }\r
+\r
+ /**\r
+ * Returns the X axis labels color.\r
+ * \r
+ * @return the X axis labels color\r
+ */\r
+ public int getXLabelsColor() {\r
+ return mXLabelsColor;\r
+ }\r
+\r
+ /**\r
+ * Returns the Y axis labels color.\r
+ * \r
+ * @return the Y axis labels color\r
+ */\r
+ public int getYLabelsColor(int scale) {\r
+ return mYLabelsColor[scale];\r
+ }\r
+\r
+ /**\r
+ * Sets the X axis labels color.\r
+ * \r
+ * @param color the X axis labels color\r
+ */\r
+ public void setXLabelsColor(int color) {\r
+ mXLabelsColor = color;\r
+ }\r
+\r
+ /**\r
+ * Sets the Y axis labels color.\r
+ * \r
+ * @param scale the renderer scale\r
+ * @param color the Y axis labels color\r
+ */\r
+ public void setYLabelsColor(int scale, int color) {\r
+ mYLabelsColor[scale] = color;\r
+ }\r
+\r
+ /**\r
+ * Returns the X axis labels alignment.\r
+ * \r
+ * @return X labels alignment\r
+ */\r
+ public Align getXLabelsAlign() {\r
+ return xLabelsAlign;\r
+ }\r
+\r
+ /**\r
+ * Sets the X axis labels alignment.\r
+ * \r
+ * @param align the X labels alignment\r
+ */\r
+ public void setXLabelsAlign(Align align) {\r
+ xLabelsAlign = align;\r
+ }\r
+\r
+ /**\r
+ * Returns the Y axis labels alignment.\r
+ * \r
+ * @param scale the renderer scale\r
+ * @return Y labels alignment\r
+ */\r
+ public Align getYLabelsAlign(int scale) {\r
+ return yLabelsAlign[scale];\r
+ }\r
+\r
+ public void setYLabelsAlign(Align align) {\r
+ setYLabelsAlign(align, 0);\r
+ }\r
+\r
+ public Align getYAxisAlign(int scale) {\r
+ return yAxisAlign[scale];\r
+ }\r
+\r
+ public void setYAxisAlign(Align align, int scale) {\r
+ yAxisAlign[scale] = align;\r
+ }\r
+\r
+ /**\r
+ * Sets the Y axis labels alignment.\r
+ * \r
+ * @param align the Y labels alignment\r
+ */\r
+ public void setYLabelsAlign(Align align, int scale) {\r
+ yLabelsAlign[scale] = align;\r
+ }\r
+\r
+ public int getScalesCount() {\r
+ return scalesCount;\r
+ }\r
+\r
+}\r