Update and reorganise copy data sets methods (Fix for #1604).
Copying class properties is always done in protected copy method.
This commit is contained in:
parent
9583a18b84
commit
7abc9cd669
13 changed files with 238 additions and 190 deletions
|
@ -53,7 +53,7 @@ public class LineChartActivityColored extends DemoBase {
|
|||
|
||||
private void setupChart(LineChart chart, LineData data, int color) {
|
||||
|
||||
((LineDataSet) data.getDataSetByIndex(0)).setCircleColorHole(color);
|
||||
((LineDataSet) data.getDataSetByIndex(0)).setCircleHoleColor(color);
|
||||
|
||||
// no description text
|
||||
chart.getDescription().setEnabled(false);
|
||||
|
|
|
@ -53,25 +53,24 @@ public class BarDataSet extends BarLineScatterCandleBubbleDataSet<BarEntry> impl
|
|||
|
||||
@Override
|
||||
public DataSet<BarEntry> copy() {
|
||||
|
||||
List<BarEntry> yVals = new ArrayList<BarEntry>();
|
||||
yVals.clear();
|
||||
|
||||
List<BarEntry> entries = new ArrayList<BarEntry>();
|
||||
for (int i = 0; i < mValues.size(); i++) {
|
||||
yVals.add(mValues.get(i).copy());
|
||||
entries.add(mValues.get(i).copy());
|
||||
}
|
||||
|
||||
BarDataSet copied = new BarDataSet(yVals, getLabel());
|
||||
copied.mColors = mColors;
|
||||
copied.mStackSize = mStackSize;
|
||||
copied.mBarShadowColor = mBarShadowColor;
|
||||
copied.mStackLabels = mStackLabels;
|
||||
copied.mHighLightColor = mHighLightColor;
|
||||
copied.mHighLightAlpha = mHighLightAlpha;
|
||||
|
||||
BarDataSet copied = new BarDataSet(entries, getLabel());
|
||||
copy(copied);
|
||||
return copied;
|
||||
}
|
||||
|
||||
protected void copy(BarDataSet barDataSet) {
|
||||
super.copy(barDataSet);
|
||||
barDataSet.mStackSize = mStackSize;
|
||||
barDataSet.mBarShadowColor = mBarShadowColor;
|
||||
barDataSet.mBarBorderWidth = mBarBorderWidth;
|
||||
barDataSet.mStackLabels = mStackLabels;
|
||||
barDataSet.mHighLightAlpha = mHighLightAlpha;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the total number of entries this DataSet represents, including
|
||||
* stacks. All values belonging to a stack are calculated separately.
|
||||
|
|
|
@ -9,12 +9,16 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* Baseclass of all DataSets for Bar-, Line-, Scatter- and CandleStickChart.
|
||||
*
|
||||
*
|
||||
* @author Philipp Jahoda
|
||||
*/
|
||||
public abstract class BarLineScatterCandleBubbleDataSet<T extends Entry> extends DataSet<T> implements IBarLineScatterCandleBubbleDataSet<T> {
|
||||
public abstract class BarLineScatterCandleBubbleDataSet<T extends Entry>
|
||||
extends DataSet<T>
|
||||
implements IBarLineScatterCandleBubbleDataSet<T> {
|
||||
|
||||
/** default highlight color */
|
||||
/**
|
||||
* default highlight color
|
||||
*/
|
||||
protected int mHighLightColor = Color.rgb(255, 187, 115);
|
||||
|
||||
public BarLineScatterCandleBubbleDataSet(List<T> yVals, String label) {
|
||||
|
@ -25,7 +29,7 @@ public abstract class BarLineScatterCandleBubbleDataSet<T extends Entry> extends
|
|||
* Sets the color that is used for drawing the highlight indicators. Dont
|
||||
* forget to resolve the color using getResources().getColor(...) or
|
||||
* Color.rgb(...).
|
||||
*
|
||||
*
|
||||
* @param color
|
||||
*/
|
||||
public void setHighLightColor(int color) {
|
||||
|
@ -36,4 +40,9 @@ public abstract class BarLineScatterCandleBubbleDataSet<T extends Entry> extends
|
|||
public int getHighLightColor() {
|
||||
return mHighLightColor;
|
||||
}
|
||||
|
||||
protected void copy(BarLineScatterCandleBubbleDataSet barLineScatterCandleBubbleDataSet) {
|
||||
super.copy(barLineScatterCandleBubbleDataSet);
|
||||
barLineScatterCandleBubbleDataSet.mHighLightColor = mHighLightColor;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,16 +7,13 @@ import android.graphics.Typeface;
|
|||
|
||||
import com.github.mikephil.charting.components.Legend;
|
||||
import com.github.mikephil.charting.components.YAxis;
|
||||
import com.github.mikephil.charting.formatter.DefaultValueFormatter;
|
||||
import com.github.mikephil.charting.formatter.IValueFormatter;
|
||||
import com.github.mikephil.charting.interfaces.datasets.IDataSet;
|
||||
import com.github.mikephil.charting.model.GradientColor;
|
||||
import com.github.mikephil.charting.utils.ColorTemplate;
|
||||
import com.github.mikephil.charting.utils.MPPointF;
|
||||
import com.github.mikephil.charting.utils.Utils;
|
||||
import com.github.mikephil.charting.model.GradientColor;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Inherited;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -32,9 +29,9 @@ public abstract class BaseDataSet<T extends Entry> implements IDataSet<T> {
|
|||
*/
|
||||
protected List<Integer> mColors = null;
|
||||
|
||||
protected GradientColor gradientColor = null;
|
||||
protected GradientColor mGradientColor = null;
|
||||
|
||||
protected List<GradientColor> gradientColors = null;
|
||||
protected List<GradientColor> mGradientColors = null;
|
||||
|
||||
/**
|
||||
* List representing all colors that are used for drawing the actual values for this DataSet
|
||||
|
@ -151,17 +148,17 @@ public abstract class BaseDataSet<T extends Entry> implements IDataSet<T> {
|
|||
|
||||
@Override
|
||||
public GradientColor getGradientColor() {
|
||||
return gradientColor;
|
||||
return mGradientColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GradientColor> getGradientColors() {
|
||||
return gradientColors;
|
||||
return mGradientColors;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GradientColor getGradientColor(int index) {
|
||||
return gradientColors.get(index % gradientColors.size());
|
||||
return mGradientColors.get(index % mGradientColors.size());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -206,7 +203,7 @@ public abstract class BaseDataSet<T extends Entry> implements IDataSet<T> {
|
|||
*/
|
||||
public void setColors(int[] colors, Context c) {
|
||||
|
||||
if(mColors == null){
|
||||
if (mColors == null) {
|
||||
mColors = new ArrayList<>();
|
||||
}
|
||||
|
||||
|
@ -246,7 +243,7 @@ public abstract class BaseDataSet<T extends Entry> implements IDataSet<T> {
|
|||
* @param endColor
|
||||
*/
|
||||
public void setGradientColor(int startColor, int endColor) {
|
||||
gradientColor = new GradientColor(startColor, endColor);
|
||||
mGradientColor = new GradientColor(startColor, endColor);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -255,7 +252,7 @@ public abstract class BaseDataSet<T extends Entry> implements IDataSet<T> {
|
|||
* @param gradientColors
|
||||
*/
|
||||
public void setGradientColors(List<GradientColor> gradientColors) {
|
||||
this.gradientColors = gradientColors;
|
||||
this.mGradientColors = gradientColors;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -285,7 +282,7 @@ public abstract class BaseDataSet<T extends Entry> implements IDataSet<T> {
|
|||
* Resets all colors of this DataSet and recreates the colors array.
|
||||
*/
|
||||
public void resetColors() {
|
||||
if(mColors == null) {
|
||||
if (mColors == null) {
|
||||
mColors = new ArrayList<Integer>();
|
||||
}
|
||||
mColors.clear();
|
||||
|
@ -527,4 +524,24 @@ public abstract class BaseDataSet<T extends Entry> implements IDataSet<T> {
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void copy(BaseDataSet baseDataSet) {
|
||||
baseDataSet.mAxisDependency = mAxisDependency;
|
||||
baseDataSet.mColors = mColors;
|
||||
baseDataSet.mDrawIcons = mDrawIcons;
|
||||
baseDataSet.mDrawValues = mDrawValues;
|
||||
baseDataSet.mForm = mForm;
|
||||
baseDataSet.mFormLineDashEffect = mFormLineDashEffect;
|
||||
baseDataSet.mFormLineWidth = mFormLineWidth;
|
||||
baseDataSet.mFormSize = mFormSize;
|
||||
baseDataSet.mGradientColor = mGradientColor;
|
||||
baseDataSet.mGradientColors = mGradientColors;
|
||||
baseDataSet.mHighlightEnabled = mHighlightEnabled;
|
||||
baseDataSet.mIconsOffset = mIconsOffset;
|
||||
baseDataSet.mValueColors = mValueColors;
|
||||
baseDataSet.mValueFormatter = mValueFormatter;
|
||||
baseDataSet.mValueColors = mValueColors;
|
||||
baseDataSet.mValueTextSize = mValueTextSize;
|
||||
baseDataSet.mVisible = mVisible;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,20 +41,20 @@ public class BubbleDataSet extends BarLineScatterCandleBubbleDataSet<BubbleEntry
|
|||
|
||||
@Override
|
||||
public DataSet<BubbleEntry> copy() {
|
||||
|
||||
List<BubbleEntry> yVals = new ArrayList<BubbleEntry>();
|
||||
|
||||
List<BubbleEntry> entries = new ArrayList<BubbleEntry>();
|
||||
for (int i = 0; i < mValues.size(); i++) {
|
||||
yVals.add(mValues.get(i).copy());
|
||||
entries.add(mValues.get(i).copy());
|
||||
}
|
||||
|
||||
BubbleDataSet copied = new BubbleDataSet(yVals, getLabel());
|
||||
copied.mColors = mColors;
|
||||
copied.mHighLightColor = mHighLightColor;
|
||||
|
||||
BubbleDataSet copied = new BubbleDataSet(entries, getLabel());
|
||||
copy(copied);
|
||||
return copied;
|
||||
}
|
||||
|
||||
protected void copy(BubbleDataSet bubbleDataSet) {
|
||||
bubbleDataSet.mHighlightCircleWidth = mHighlightCircleWidth;
|
||||
bubbleDataSet.mNormalizeSize = mNormalizeSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMaxSize() {
|
||||
return mMaxSize;
|
||||
|
|
|
@ -79,27 +79,30 @@ public class CandleDataSet extends LineScatterCandleRadarDataSet<CandleEntry> im
|
|||
|
||||
@Override
|
||||
public DataSet<CandleEntry> copy() {
|
||||
|
||||
List<CandleEntry> yVals = new ArrayList<CandleEntry>();
|
||||
yVals.clear();
|
||||
|
||||
List<CandleEntry> entries = new ArrayList<CandleEntry>();
|
||||
for (int i = 0; i < mValues.size(); i++) {
|
||||
yVals.add(mValues.get(i).copy());
|
||||
entries.add(mValues.get(i).copy());
|
||||
}
|
||||
|
||||
CandleDataSet copied = new CandleDataSet(yVals, getLabel());
|
||||
copied.mColors = mColors;
|
||||
copied.mShadowWidth = mShadowWidth;
|
||||
copied.mShowCandleBar = mShowCandleBar;
|
||||
copied.mBarSpace = mBarSpace;
|
||||
copied.mHighLightColor = mHighLightColor;
|
||||
copied.mIncreasingPaintStyle = mIncreasingPaintStyle;
|
||||
copied.mDecreasingPaintStyle = mDecreasingPaintStyle;
|
||||
copied.mShadowColor = mShadowColor;
|
||||
|
||||
CandleDataSet copied = new CandleDataSet(entries, getLabel());
|
||||
copy(copied);
|
||||
return copied;
|
||||
}
|
||||
|
||||
protected void copy(CandleDataSet candleDataSet) {
|
||||
super.copy(candleDataSet);
|
||||
candleDataSet.mShadowWidth = mShadowWidth;
|
||||
candleDataSet.mShowCandleBar = mShowCandleBar;
|
||||
candleDataSet.mBarSpace = mBarSpace;
|
||||
candleDataSet.mShadowColorSameAsCandle = mShadowColorSameAsCandle;
|
||||
candleDataSet.mHighLightColor = mHighLightColor;
|
||||
candleDataSet.mIncreasingPaintStyle = mIncreasingPaintStyle;
|
||||
candleDataSet.mDecreasingPaintStyle = mDecreasingPaintStyle;
|
||||
candleDataSet.mNeutralColor = mNeutralColor;
|
||||
candleDataSet.mIncreasingColor = mIncreasingColor;
|
||||
candleDataSet.mDecreasingColor = mDecreasingColor;
|
||||
candleDataSet.mShadowColor = mShadowColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void calcMinMax(CandleEntry e) {
|
||||
|
||||
|
|
|
@ -157,6 +157,14 @@ public abstract class DataSet<T extends Entry> extends BaseDataSet<T> {
|
|||
*/
|
||||
public abstract DataSet<T> copy();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param dataSet
|
||||
*/
|
||||
protected void copy(DataSet dataSet) {
|
||||
super.copy(dataSet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
|
|
|
@ -30,7 +30,7 @@ public class LineDataSet extends LineRadarDataSet<Entry> implements ILineDataSet
|
|||
/**
|
||||
* the color of the inner circles
|
||||
*/
|
||||
private int mCircleColorHole = Color.WHITE;
|
||||
private int mCircleHoleColor = Color.WHITE;
|
||||
|
||||
/**
|
||||
* the radius of the circle-shaped value indicators
|
||||
|
@ -84,27 +84,29 @@ public class LineDataSet extends LineRadarDataSet<Entry> implements ILineDataSet
|
|||
|
||||
@Override
|
||||
public DataSet<Entry> copy() {
|
||||
|
||||
List<Entry> yVals = new ArrayList<Entry>();
|
||||
|
||||
List<Entry> entries = new ArrayList<Entry>();
|
||||
for (int i = 0; i < mValues.size(); i++) {
|
||||
yVals.add(mValues.get(i).copy());
|
||||
entries.add(mValues.get(i).copy());
|
||||
}
|
||||
|
||||
LineDataSet copied = new LineDataSet(yVals, getLabel());
|
||||
copied.mMode = mMode;
|
||||
copied.mColors = mColors;
|
||||
copied.mCircleRadius = mCircleRadius;
|
||||
copied.mCircleHoleRadius = mCircleHoleRadius;
|
||||
copied.mCircleColors = mCircleColors;
|
||||
copied.mDashPathEffect = mDashPathEffect;
|
||||
copied.mDrawCircles = mDrawCircles;
|
||||
copied.mDrawCircleHole = mDrawCircleHole;
|
||||
copied.mHighLightColor = mHighLightColor;
|
||||
|
||||
LineDataSet copied = new LineDataSet(entries, getLabel());
|
||||
copy(copied);
|
||||
return copied;
|
||||
}
|
||||
|
||||
protected void copy(LineDataSet lineDataSet) {
|
||||
super.copy(lineDataSet);
|
||||
lineDataSet.mCircleColors = mCircleColors;
|
||||
lineDataSet.mCircleHoleColor = mCircleHoleColor;
|
||||
lineDataSet.mCircleHoleRadius = mCircleHoleRadius;
|
||||
lineDataSet.mCircleRadius = mCircleRadius;
|
||||
lineDataSet.mCubicIntensity = mCubicIntensity;
|
||||
lineDataSet.mDashPathEffect = mDashPathEffect;
|
||||
lineDataSet.mDrawCircleHole = mDrawCircleHole;
|
||||
lineDataSet.mDrawCircles = mDrawCircleHole;
|
||||
lineDataSet.mFillFormatter = mFillFormatter;
|
||||
lineDataSet.mMode = mMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the drawing mode for this line dataset
|
||||
*
|
||||
|
@ -364,13 +366,13 @@ public class LineDataSet extends LineRadarDataSet<Entry> implements ILineDataSet
|
|||
*
|
||||
* @param color
|
||||
*/
|
||||
public void setCircleColorHole(int color) {
|
||||
mCircleColorHole = color;
|
||||
public void setCircleHoleColor(int color) {
|
||||
mCircleHoleColor = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCircleHoleColor() {
|
||||
return mCircleColorHole;
|
||||
return mCircleHoleColor;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -122,4 +122,13 @@ public abstract class LineRadarDataSet<T extends Entry> extends LineScatterCandl
|
|||
public boolean isDrawFilledEnabled() {
|
||||
return mDrawFilled;
|
||||
}
|
||||
|
||||
protected void copy(LineRadarDataSet lineRadarDataSet) {
|
||||
super.copy(lineRadarDataSet);
|
||||
lineRadarDataSet.mDrawFilled = mDrawFilled;
|
||||
lineRadarDataSet.mFillAlpha = mFillAlpha;
|
||||
lineRadarDataSet.mFillColor = mFillColor;
|
||||
lineRadarDataSet.mFillDrawable = mFillDrawable;
|
||||
lineRadarDataSet.mLineWidth = mLineWidth;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,4 +109,12 @@ public abstract class LineScatterCandleRadarDataSet<T extends Entry> extends Bar
|
|||
public DashPathEffect getDashPathEffectHighlight() {
|
||||
return mHighlightDashPathEffect;
|
||||
}
|
||||
|
||||
protected void copy(LineScatterCandleRadarDataSet lineScatterCandleRadarDataSet) {
|
||||
super.copy(lineScatterCandleRadarDataSet);
|
||||
lineScatterCandleRadarDataSet.mDrawHorizontalHighlightIndicator = mDrawHorizontalHighlightIndicator;
|
||||
lineScatterCandleRadarDataSet.mDrawVerticalHighlightIndicator = mDrawVerticalHighlightIndicator;
|
||||
lineScatterCandleRadarDataSet.mHighlightLineWidth = mHighlightLineWidth;
|
||||
lineScatterCandleRadarDataSet.mHighlightDashPathEffect = mHighlightDashPathEffect;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,11 +9,15 @@ import java.util.List;
|
|||
|
||||
public class PieDataSet extends DataSet<PieEntry> implements IPieDataSet {
|
||||
|
||||
/** the space in pixels between the chart-slices, default 0f */
|
||||
/**
|
||||
* the space in pixels between the chart-slices, default 0f
|
||||
*/
|
||||
private float mSliceSpace = 0f;
|
||||
private boolean mAutomaticallyDisableSliceSpacing;
|
||||
|
||||
/** indicates the selection distance of a pie slice */
|
||||
/**
|
||||
* indicates the selection distance of a pie slice
|
||||
*/
|
||||
private float mShift = 18f;
|
||||
|
||||
private ValuePosition mXValuePosition = ValuePosition.INSIDE_SLICE;
|
||||
|
@ -33,20 +37,19 @@ public class PieDataSet extends DataSet<PieEntry> implements IPieDataSet {
|
|||
|
||||
@Override
|
||||
public DataSet<PieEntry> copy() {
|
||||
|
||||
List<PieEntry> yVals = new ArrayList<>();
|
||||
|
||||
List<PieEntry> entries = new ArrayList<>();
|
||||
for (int i = 0; i < mValues.size(); i++) {
|
||||
yVals.add(mValues.get(i).copy());
|
||||
entries.add(mValues.get(i).copy());
|
||||
}
|
||||
|
||||
PieDataSet copied = new PieDataSet(yVals, getLabel());
|
||||
copied.mColors = mColors;
|
||||
copied.mSliceSpace = mSliceSpace;
|
||||
copied.mShift = mShift;
|
||||
PieDataSet copied = new PieDataSet(entries, getLabel());
|
||||
copy(copied);
|
||||
return copied;
|
||||
}
|
||||
|
||||
protected void copy(PieDataSet pieDataSet) {
|
||||
super.copy(pieDataSet);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void calcMinMax(PieEntry e) {
|
||||
|
||||
|
@ -79,7 +82,7 @@ public class PieDataSet extends DataSet<PieEntry> implements IPieDataSet {
|
|||
|
||||
/**
|
||||
* When enabled, slice spacing will be 0.0 when the smallest value is going to be
|
||||
* smaller than the slice spacing itself.
|
||||
* smaller than the slice spacing itself.
|
||||
*
|
||||
* @param autoDisable
|
||||
*/
|
||||
|
@ -89,7 +92,7 @@ public class PieDataSet extends DataSet<PieEntry> implements IPieDataSet {
|
|||
|
||||
/**
|
||||
* When enabled, slice spacing will be 0.0 when the smallest value is going to be
|
||||
* smaller than the slice spacing itself.
|
||||
* smaller than the slice spacing itself.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
@ -101,7 +104,7 @@ public class PieDataSet extends DataSet<PieEntry> implements IPieDataSet {
|
|||
/**
|
||||
* sets the distance the highlighted piechart-slice of this DataSet is
|
||||
* "shifted" away from the center of the chart, default 12f
|
||||
*
|
||||
*
|
||||
* @param shift
|
||||
*/
|
||||
public void setSelectionShift(float shift) {
|
||||
|
@ -114,30 +117,26 @@ public class PieDataSet extends DataSet<PieEntry> implements IPieDataSet {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ValuePosition getXValuePosition()
|
||||
{
|
||||
public ValuePosition getXValuePosition() {
|
||||
return mXValuePosition;
|
||||
}
|
||||
|
||||
public void setXValuePosition(ValuePosition xValuePosition)
|
||||
{
|
||||
public void setXValuePosition(ValuePosition xValuePosition) {
|
||||
this.mXValuePosition = xValuePosition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValuePosition getYValuePosition()
|
||||
{
|
||||
public ValuePosition getYValuePosition() {
|
||||
return mYValuePosition;
|
||||
}
|
||||
|
||||
public void setYValuePosition(ValuePosition yValuePosition)
|
||||
{
|
||||
public void setYValuePosition(ValuePosition yValuePosition) {
|
||||
this.mYValuePosition = yValuePosition;
|
||||
}
|
||||
|
||||
/**
|
||||
* When valuePosition is OutsideSlice, use slice colors as line color if true
|
||||
* */
|
||||
*/
|
||||
@Override
|
||||
public boolean isUsingSliceColorAsValueLineColor() {
|
||||
return mUsingSliceColorAsValueLineColor;
|
||||
|
@ -147,10 +146,11 @@ public class PieDataSet extends DataSet<PieEntry> implements IPieDataSet {
|
|||
this.mUsingSliceColorAsValueLineColor = usingSliceColorAsValueLineColor;
|
||||
}
|
||||
|
||||
/** When valuePosition is OutsideSlice, indicates line color */
|
||||
/**
|
||||
* When valuePosition is OutsideSlice, indicates line color
|
||||
*/
|
||||
@Override
|
||||
public int getValueLineColor()
|
||||
{
|
||||
public int getValueLineColor() {
|
||||
return mValueLineColor;
|
||||
}
|
||||
|
||||
|
@ -158,63 +158,63 @@ public class PieDataSet extends DataSet<PieEntry> implements IPieDataSet {
|
|||
this.mValueLineColor = valueLineColor;
|
||||
}
|
||||
|
||||
/** When valuePosition is OutsideSlice, indicates line width */
|
||||
/**
|
||||
* When valuePosition is OutsideSlice, indicates line width
|
||||
*/
|
||||
@Override
|
||||
public float getValueLineWidth()
|
||||
{
|
||||
public float getValueLineWidth() {
|
||||
return mValueLineWidth;
|
||||
}
|
||||
|
||||
public void setValueLineWidth(float valueLineWidth)
|
||||
{
|
||||
public void setValueLineWidth(float valueLineWidth) {
|
||||
this.mValueLineWidth = valueLineWidth;
|
||||
}
|
||||
|
||||
/** When valuePosition is OutsideSlice, indicates offset as percentage out of the slice size */
|
||||
/**
|
||||
* When valuePosition is OutsideSlice, indicates offset as percentage out of the slice size
|
||||
*/
|
||||
@Override
|
||||
public float getValueLinePart1OffsetPercentage()
|
||||
{
|
||||
public float getValueLinePart1OffsetPercentage() {
|
||||
return mValueLinePart1OffsetPercentage;
|
||||
}
|
||||
|
||||
public void setValueLinePart1OffsetPercentage(float valueLinePart1OffsetPercentage)
|
||||
{
|
||||
public void setValueLinePart1OffsetPercentage(float valueLinePart1OffsetPercentage) {
|
||||
this.mValueLinePart1OffsetPercentage = valueLinePart1OffsetPercentage;
|
||||
}
|
||||
|
||||
/** When valuePosition is OutsideSlice, indicates length of first half of the line */
|
||||
/**
|
||||
* When valuePosition is OutsideSlice, indicates length of first half of the line
|
||||
*/
|
||||
@Override
|
||||
public float getValueLinePart1Length()
|
||||
{
|
||||
public float getValueLinePart1Length() {
|
||||
return mValueLinePart1Length;
|
||||
}
|
||||
|
||||
public void setValueLinePart1Length(float valueLinePart1Length)
|
||||
{
|
||||
public void setValueLinePart1Length(float valueLinePart1Length) {
|
||||
this.mValueLinePart1Length = valueLinePart1Length;
|
||||
}
|
||||
|
||||
/** When valuePosition is OutsideSlice, indicates length of second half of the line */
|
||||
/**
|
||||
* When valuePosition is OutsideSlice, indicates length of second half of the line
|
||||
*/
|
||||
@Override
|
||||
public float getValueLinePart2Length()
|
||||
{
|
||||
public float getValueLinePart2Length() {
|
||||
return mValueLinePart2Length;
|
||||
}
|
||||
|
||||
public void setValueLinePart2Length(float valueLinePart2Length)
|
||||
{
|
||||
public void setValueLinePart2Length(float valueLinePart2Length) {
|
||||
this.mValueLinePart2Length = valueLinePart2Length;
|
||||
}
|
||||
|
||||
/** When valuePosition is OutsideSlice, this allows variable line length */
|
||||
/**
|
||||
* When valuePosition is OutsideSlice, this allows variable line length
|
||||
*/
|
||||
@Override
|
||||
public boolean isValueLineVariableLength()
|
||||
{
|
||||
public boolean isValueLineVariableLength() {
|
||||
return mValueLineVariableLength;
|
||||
}
|
||||
|
||||
public void setValueLineVariableLength(boolean valueLineVariableLength)
|
||||
{
|
||||
public void setValueLineVariableLength(boolean valueLineVariableLength) {
|
||||
this.mValueLineVariableLength = valueLineVariableLength;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ public class RadarDataSet extends LineRadarDataSet<RadarEntry> implements IRadar
|
|||
/// If Utils.COLOR_NONE, the color of the dataset is taken.
|
||||
protected int mHighlightCircleStrokeColor = ColorTemplate.COLOR_NONE;
|
||||
|
||||
protected int mHighlightCircleStrokeAlpha = (int)(0.3 * 255);
|
||||
protected int mHighlightCircleStrokeAlpha = (int) (0.3 * 255);
|
||||
protected float mHighlightCircleInnerRadius = 3.0f;
|
||||
protected float mHighlightCircleOuterRadius = 4.0f;
|
||||
protected float mHighlightCircleStrokeWidth = 2.0f;
|
||||
|
@ -31,101 +31,92 @@ public class RadarDataSet extends LineRadarDataSet<RadarEntry> implements IRadar
|
|||
|
||||
/// Returns true if highlight circle should be drawn, false if not
|
||||
@Override
|
||||
public boolean isDrawHighlightCircleEnabled()
|
||||
{
|
||||
public boolean isDrawHighlightCircleEnabled() {
|
||||
return mDrawHighlightCircleEnabled;
|
||||
}
|
||||
|
||||
/// Sets whether highlight circle should be drawn or not
|
||||
@Override
|
||||
public void setDrawHighlightCircleEnabled(boolean enabled)
|
||||
{
|
||||
public void setDrawHighlightCircleEnabled(boolean enabled) {
|
||||
mDrawHighlightCircleEnabled = enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHighlightCircleFillColor()
|
||||
{
|
||||
public int getHighlightCircleFillColor() {
|
||||
return mHighlightCircleFillColor;
|
||||
}
|
||||
|
||||
public void setHighlightCircleFillColor(int color)
|
||||
{
|
||||
public void setHighlightCircleFillColor(int color) {
|
||||
mHighlightCircleFillColor = color;
|
||||
}
|
||||
|
||||
/// Returns the stroke color for highlight circle.
|
||||
/// If Utils.COLOR_NONE, the color of the dataset is taken.
|
||||
@Override
|
||||
public int getHighlightCircleStrokeColor()
|
||||
{
|
||||
public int getHighlightCircleStrokeColor() {
|
||||
return mHighlightCircleStrokeColor;
|
||||
}
|
||||
|
||||
/// Sets the stroke color for highlight circle.
|
||||
/// Set to Utils.COLOR_NONE in order to use the color of the dataset;
|
||||
public void setHighlightCircleStrokeColor(int color)
|
||||
{
|
||||
public void setHighlightCircleStrokeColor(int color) {
|
||||
mHighlightCircleStrokeColor = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHighlightCircleStrokeAlpha()
|
||||
{
|
||||
public int getHighlightCircleStrokeAlpha() {
|
||||
return mHighlightCircleStrokeAlpha;
|
||||
}
|
||||
|
||||
public void setHighlightCircleStrokeAlpha(int alpha)
|
||||
{
|
||||
public void setHighlightCircleStrokeAlpha(int alpha) {
|
||||
mHighlightCircleStrokeAlpha = alpha;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getHighlightCircleInnerRadius()
|
||||
{
|
||||
public float getHighlightCircleInnerRadius() {
|
||||
return mHighlightCircleInnerRadius;
|
||||
}
|
||||
|
||||
public void setHighlightCircleInnerRadius(float radius)
|
||||
{
|
||||
public void setHighlightCircleInnerRadius(float radius) {
|
||||
mHighlightCircleInnerRadius = radius;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getHighlightCircleOuterRadius()
|
||||
{
|
||||
public float getHighlightCircleOuterRadius() {
|
||||
return mHighlightCircleOuterRadius;
|
||||
}
|
||||
|
||||
public void setHighlightCircleOuterRadius(float radius)
|
||||
{
|
||||
public void setHighlightCircleOuterRadius(float radius) {
|
||||
mHighlightCircleOuterRadius = radius;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getHighlightCircleStrokeWidth()
|
||||
{
|
||||
public float getHighlightCircleStrokeWidth() {
|
||||
return mHighlightCircleStrokeWidth;
|
||||
}
|
||||
|
||||
public void setHighlightCircleStrokeWidth(float strokeWidth)
|
||||
{
|
||||
public void setHighlightCircleStrokeWidth(float strokeWidth) {
|
||||
mHighlightCircleStrokeWidth = strokeWidth;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSet<RadarEntry> copy() {
|
||||
|
||||
List<RadarEntry> yVals = new ArrayList<RadarEntry>();
|
||||
|
||||
List<RadarEntry> entries = new ArrayList<RadarEntry>();
|
||||
for (int i = 0; i < mValues.size(); i++) {
|
||||
yVals.add(mValues.get(i).copy());
|
||||
entries.add(mValues.get(i).copy());
|
||||
}
|
||||
|
||||
RadarDataSet copied = new RadarDataSet(yVals, getLabel());
|
||||
copied.mColors = mColors;
|
||||
copied.mHighLightColor = mHighLightColor;
|
||||
|
||||
RadarDataSet copied = new RadarDataSet(entries, getLabel());
|
||||
copy(copied);
|
||||
return copied;
|
||||
}
|
||||
|
||||
protected void copy(RadarDataSet radarDataSet) {
|
||||
super.copy(radarDataSet);
|
||||
radarDataSet.mDrawHighlightCircleEnabled = mDrawHighlightCircleEnabled;
|
||||
radarDataSet.mHighlightCircleFillColor = mHighlightCircleFillColor;
|
||||
radarDataSet.mHighlightCircleInnerRadius = mHighlightCircleInnerRadius;
|
||||
radarDataSet.mHighlightCircleStrokeAlpha = mHighlightCircleStrokeAlpha;
|
||||
radarDataSet.mHighlightCircleStrokeColor = mHighlightCircleStrokeColor;
|
||||
radarDataSet.mHighlightCircleStrokeWidth = mHighlightCircleStrokeWidth;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,28 +47,23 @@ public class ScatterDataSet extends LineScatterCandleRadarDataSet<Entry> impleme
|
|||
|
||||
@Override
|
||||
public DataSet<Entry> copy() {
|
||||
|
||||
List<Entry> yVals = new ArrayList<Entry>();
|
||||
|
||||
List<Entry> entries = new ArrayList<Entry>();
|
||||
for (int i = 0; i < mValues.size(); i++) {
|
||||
yVals.add(mValues.get(i).copy());
|
||||
entries.add(mValues.get(i).copy());
|
||||
}
|
||||
|
||||
ScatterDataSet copied = new ScatterDataSet(yVals, getLabel());
|
||||
copied.mDrawValues = mDrawValues;
|
||||
copied.mValueColors = mValueColors;
|
||||
copied.mColors = mColors;
|
||||
copied.mShapeSize = mShapeSize;
|
||||
copied.mShapeRenderer = mShapeRenderer;
|
||||
copied.mScatterShapeHoleRadius = mScatterShapeHoleRadius;
|
||||
copied.mScatterShapeHoleColor = mScatterShapeHoleColor;
|
||||
copied.mHighlightLineWidth = mHighlightLineWidth;
|
||||
copied.mHighLightColor = mHighLightColor;
|
||||
copied.mHighlightDashPathEffect = mHighlightDashPathEffect;
|
||||
|
||||
ScatterDataSet copied = new ScatterDataSet(entries, getLabel());
|
||||
copy(copied);
|
||||
return copied;
|
||||
}
|
||||
|
||||
protected void copy(ScatterDataSet scatterDataSet) {
|
||||
super.copy(scatterDataSet);
|
||||
scatterDataSet.mShapeSize = mShapeSize;
|
||||
scatterDataSet.mShapeRenderer = mShapeRenderer;
|
||||
scatterDataSet.mScatterShapeHoleRadius = mScatterShapeHoleRadius;
|
||||
scatterDataSet.mScatterShapeHoleColor = mScatterShapeHoleColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the size in density pixels the drawn scattershape will have. This
|
||||
* only applies for non custom shapes.
|
||||
|
@ -141,13 +136,20 @@ public class ScatterDataSet extends LineScatterCandleRadarDataSet<Entry> impleme
|
|||
public static IShapeRenderer getRendererForShape(ScatterChart.ScatterShape shape) {
|
||||
|
||||
switch (shape) {
|
||||
case SQUARE: return new SquareShapeRenderer();
|
||||
case CIRCLE: return new CircleShapeRenderer();
|
||||
case TRIANGLE: return new TriangleShapeRenderer();
|
||||
case CROSS: return new CrossShapeRenderer();
|
||||
case X: return new XShapeRenderer();
|
||||
case CHEVRON_UP: return new ChevronUpShapeRenderer();
|
||||
case CHEVRON_DOWN: return new ChevronDownShapeRenderer();
|
||||
case SQUARE:
|
||||
return new SquareShapeRenderer();
|
||||
case CIRCLE:
|
||||
return new CircleShapeRenderer();
|
||||
case TRIANGLE:
|
||||
return new TriangleShapeRenderer();
|
||||
case CROSS:
|
||||
return new CrossShapeRenderer();
|
||||
case X:
|
||||
return new XShapeRenderer();
|
||||
case CHEVRON_UP:
|
||||
return new ChevronUpShapeRenderer();
|
||||
case CHEVRON_DOWN:
|
||||
return new ChevronDownShapeRenderer();
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
Loading…
Add table
Reference in a new issue