11package com .github .mikephil .charting .data ;
22
33import android .annotation .SuppressLint ;
4+ import android .graphics .drawable .Drawable ;
45
56import com .github .mikephil .charting .highlight .Range ;
67
@@ -33,10 +34,54 @@ public class BarEntry extends Entry {
3334 private float mPositiveSum ;
3435
3536 /**
36- * Constructor for stacked bar entries.
37+ * Constructor for normal bars (not stacked).
38+ *
39+ * @param x
40+ * @param y
41+ */
42+ public BarEntry (float x , float y ) {
43+ super (x , y );
44+ }
45+
46+ /**
47+ * Constructor for normal bars (not stacked).
48+ *
49+ * @param x
50+ * @param y
51+ * @param data - Spot for additional data this Entry represents.
52+ */
53+ public BarEntry (float x , float y , Object data ) {
54+ super (x , y , data );
55+ }
56+
57+ /**
58+ * Constructor for normal bars (not stacked).
59+ *
60+ * @param x
61+ * @param y
62+ * @param icon - icon image
63+ */
64+ public BarEntry (float x , float y , Drawable icon ) {
65+ super (x , y , icon );
66+ }
67+
68+ /**
69+ * Constructor for normal bars (not stacked).
3770 *
3871 * @param x
39- * @param vals - the stack values, use at lest 2
72+ * @param y
73+ * @param icon - icon image
74+ * @param data - Spot for additional data this Entry represents.
75+ */
76+ public BarEntry (float x , float y , Drawable icon , Object data ) {
77+ super (x , y , icon , data );
78+ }
79+
80+ /**
81+ * Constructor for stacked bar entries. One data object for whole stack
82+ *
83+ * @param x
84+ * @param vals - the stack values, use at least 2
4085 */
4186 public BarEntry (float x , float [] vals ) {
4287 super (x , calcSum (vals ));
@@ -47,39 +92,49 @@ public BarEntry(float x, float[] vals) {
4792 }
4893
4994 /**
50- * Constructor for normal bars (not stacked).
95+ * Constructor for stacked bar entries. One data object for whole stack
5196 *
5297 * @param x
53- * @param y
98+ * @param vals - the stack values, use at least 2
99+ * @param data - Spot for additional data this Entry represents.
54100 */
55- public BarEntry (float x , float y ) {
56- super (x , y );
101+ public BarEntry (float x , float [] vals , Object data ) {
102+ super (x , calcSum (vals ), data );
103+
104+ this .mYVals = vals ;
105+ calcPosNegSum ();
106+ calcRanges ();
57107 }
58108
59109 /**
60- * Constructor for stacked bar entries.
110+ * Constructor for stacked bar entries. One data object for whole stack
61111 *
62112 * @param x
63- * @param vals - the stack values, use at least 2
64- * @param label Additional description label.
113+ * @param vals - the stack values, use at least 2
114+ * @param icon - icon image
65115 */
66- public BarEntry (float x , float [] vals , String label ) {
67- super (x , calcSum (vals ), label );
116+ public BarEntry (float x , float [] vals , Drawable icon ) {
117+ super (x , calcSum (vals ), icon );
68118
69119 this .mYVals = vals ;
70120 calcPosNegSum ();
71121 calcRanges ();
72122 }
73123
74124 /**
75- * Constructor for normal bars (not stacked).
125+ * Constructor for stacked bar entries. One data object for whole stack
76126 *
77127 * @param x
78- * @param y
79- * @param data Spot for additional data this Entry represents.
128+ * @param vals - the stack values, use at least 2
129+ * @param icon - icon image
130+ * @param data - Spot for additional data this Entry represents.
80131 */
81- public BarEntry (float x , float y , Object data ) {
82- super (x , y , data );
132+ public BarEntry (float x , float [] vals , Drawable icon , Object data ) {
133+ super (x , calcSum (vals ), icon , data );
134+
135+ this .mYVals = vals ;
136+ calcPosNegSum ();
137+ calcRanges ();
83138 }
84139
85140 /**
0 commit comments