|
1 | 1 | package com.github.mikephil.charting.data.realm.implementation; |
2 | 2 |
|
| 3 | +import android.graphics.Color; |
| 4 | + |
3 | 5 | import com.github.mikephil.charting.data.realm.base.RealmLineRadarDataSet; |
4 | 6 | import com.github.mikephil.charting.interfaces.datasets.IRadarDataSet; |
| 7 | +import com.github.mikephil.charting.utils.ColorTemplate; |
5 | 8 |
|
6 | 9 | import io.realm.RealmObject; |
7 | 10 | import io.realm.RealmResults; |
|
11 | 14 | */ |
12 | 15 | public class RealmRadarDataSet<T extends RealmObject> extends RealmLineRadarDataSet<T> implements IRadarDataSet { |
13 | 16 |
|
| 17 | + /// flag indicating whether highlight circle should be drawn or not |
| 18 | + protected boolean mDrawHighlightCircleEnabled = false; |
| 19 | + |
| 20 | + protected int mHighlightCircleFillColor = Color.WHITE; |
| 21 | + |
| 22 | + /// The stroke color for highlight circle. |
| 23 | + /// If Utils.COLOR_NONE, the color of the dataset is taken. |
| 24 | + protected int mHighlightCircleStrokeColor = ColorTemplate.COLOR_NONE; |
| 25 | + |
| 26 | + protected int mHighlightCircleStrokeAlpha = (int)(0.3 * 255); |
| 27 | + protected float mHighlightCircleInnerRadius = 3.0f; |
| 28 | + protected float mHighlightCircleOuterRadius = 4.0f; |
| 29 | + protected float mHighlightCircleStrokeWidth = 2.0f; |
| 30 | + |
14 | 31 | /** |
15 | 32 | * Constructor for creating a RadarDataSet with realm data. |
16 | 33 | * |
@@ -38,6 +55,90 @@ public RealmRadarDataSet(RealmResults<T> result, String yValuesField, String xIn |
38 | 55 | calcMinMax(0, results.size()); |
39 | 56 | } |
40 | 57 |
|
| 58 | + /// Returns true if highlight circle should be drawn, false if not |
| 59 | + @Override |
| 60 | + public boolean isDrawHighlightCircleEnabled() |
| 61 | + { |
| 62 | + return mDrawHighlightCircleEnabled; |
| 63 | + } |
| 64 | + |
| 65 | + /// Sets whether highlight circle should be drawn or not |
| 66 | + @Override |
| 67 | + public void setDrawHighlightCircleEnabled(boolean enabled) |
| 68 | + { |
| 69 | + mDrawHighlightCircleEnabled = enabled; |
| 70 | + } |
| 71 | + |
| 72 | + @Override |
| 73 | + public int getHighlightCircleFillColor() |
| 74 | + { |
| 75 | + return mHighlightCircleFillColor; |
| 76 | + } |
| 77 | + |
| 78 | + public void setHighlightCircleFillColor(int color) |
| 79 | + { |
| 80 | + mHighlightCircleFillColor = color; |
| 81 | + } |
| 82 | + |
| 83 | + /// Returns the stroke color for highlight circle. |
| 84 | + /// If Utils.COLOR_NONE, the color of the dataset is taken. |
| 85 | + @Override |
| 86 | + public int getHighlightCircleStrokeColor() |
| 87 | + { |
| 88 | + return mHighlightCircleStrokeColor; |
| 89 | + } |
| 90 | + |
| 91 | + /// Sets the stroke color for highlight circle. |
| 92 | + /// Set to Utils.COLOR_NONE in order to use the color of the dataset; |
| 93 | + public void setHighlightCircleStrokeColor(int color) |
| 94 | + { |
| 95 | + mHighlightCircleStrokeColor = color; |
| 96 | + } |
| 97 | + |
| 98 | + @Override |
| 99 | + public int getHighlightCircleStrokeAlpha() |
| 100 | + { |
| 101 | + return mHighlightCircleStrokeAlpha; |
| 102 | + } |
| 103 | + |
| 104 | + public void setHighlightCircleStrokeAlpha(int alpha) |
| 105 | + { |
| 106 | + mHighlightCircleStrokeAlpha = alpha; |
| 107 | + } |
| 108 | + |
| 109 | + @Override |
| 110 | + public float getHighlightCircleInnerRadius() |
| 111 | + { |
| 112 | + return mHighlightCircleInnerRadius; |
| 113 | + } |
| 114 | + |
| 115 | + public void setHighlightCircleInnerRadius(float radius) |
| 116 | + { |
| 117 | + mHighlightCircleInnerRadius = radius; |
| 118 | + } |
| 119 | + |
| 120 | + @Override |
| 121 | + public float getHighlightCircleOuterRadius() |
| 122 | + { |
| 123 | + return mHighlightCircleOuterRadius; |
| 124 | + } |
| 125 | + |
| 126 | + public void setHighlightCircleOuterRadius(float radius) |
| 127 | + { |
| 128 | + mHighlightCircleOuterRadius = radius; |
| 129 | + } |
| 130 | + |
| 131 | + @Override |
| 132 | + public float getHighlightCircleStrokeWidth() |
| 133 | + { |
| 134 | + return mHighlightCircleStrokeWidth; |
| 135 | + } |
| 136 | + |
| 137 | + public void setHighlightCircleStrokeWidth(float strokeWidth) |
| 138 | + { |
| 139 | + mHighlightCircleStrokeWidth = strokeWidth; |
| 140 | + } |
| 141 | + |
41 | 142 | @Override |
42 | 143 | public void build(RealmResults<T> results) { |
43 | 144 | super.build(results); |
|
0 commit comments