1+ package com .xxmassdeveloper .mpchartexample .custom ;
2+
3+
4+ import io .realm .RealmList ;
5+ import io .realm .RealmObject ;
6+
7+ /**
8+ * Demo class that encapsulates data stored in realm.io database.
9+ * This class represents data suitable for all chart-types.
10+ */
11+ public class RealmDemoData extends RealmObject {
12+
13+ private float yValue ;
14+ private float xValue ;
15+
16+ private float open , close , high , low ;
17+
18+ private float bubbleSize ;
19+
20+ private RealmList <RealmFloat > stackValues ;
21+
22+ private String someStringField ;
23+
24+ /**
25+ * label for pie entries
26+ */
27+ private String label ;
28+
29+ // ofc there could me more fields here...
30+
31+ public RealmDemoData () {
32+
33+ }
34+
35+ public RealmDemoData (float yValue ) {
36+ this .yValue = yValue ;
37+ }
38+
39+ public RealmDemoData (float xValue , float yValue ) {
40+ this .xValue = xValue ;
41+ this .yValue = yValue ;
42+ }
43+
44+ /**
45+ * Constructor for stacked bars.
46+ *
47+ * @param xValue
48+ * @param stackValues
49+ */
50+ public RealmDemoData (float xValue , float [] stackValues ) {
51+ this .xValue = xValue ;
52+ this .stackValues = new RealmList <RealmFloat >();
53+
54+ for (float val : stackValues ) {
55+ this .stackValues .add (new RealmFloat (val ));
56+ }
57+ }
58+
59+ /**
60+ * Constructor for candles.
61+ *
62+ * @param xValue
63+ * @param high
64+ * @param low
65+ * @param open
66+ * @param close
67+ */
68+ public RealmDemoData (float xValue , float high , float low , float open , float close ) {
69+ this .yValue = (high + low ) / 2f ;
70+ this .high = high ;
71+ this .low = low ;
72+ this .open = open ;
73+ this .close = close ;
74+ this .xValue = xValue ;
75+ }
76+
77+ /**
78+ * Constructor for bubbles.
79+ *
80+ * @param xValue
81+ * @param yValue
82+ * @param bubbleSize
83+ */
84+ public RealmDemoData (float xValue , float yValue , float bubbleSize ) {
85+ this .xValue = xValue ;
86+ this .yValue = yValue ;
87+ this .bubbleSize = bubbleSize ;
88+ }
89+
90+ /**
91+ * Constructor for pie chart.
92+ *
93+ * @param yValue
94+ * @param label
95+ */
96+ public RealmDemoData (float yValue , String label ) {
97+ this .yValue = yValue ;
98+ this .label = label ;
99+ }
100+
101+ public float getyValue () {
102+ return yValue ;
103+ }
104+
105+ public void setyValue (float yValue ) {
106+ this .yValue = yValue ;
107+ }
108+
109+ public float getxValue () {
110+ return xValue ;
111+ }
112+
113+ public void setxValue (float xValue ) {
114+ this .xValue = xValue ;
115+ }
116+
117+ public RealmList <RealmFloat > getStackValues () {
118+ return stackValues ;
119+ }
120+
121+ public void setStackValues (RealmList <RealmFloat > stackValues ) {
122+ this .stackValues = stackValues ;
123+ }
124+
125+ public float getOpen () {
126+ return open ;
127+ }
128+
129+ public void setOpen (float open ) {
130+ this .open = open ;
131+ }
132+
133+ public float getClose () {
134+ return close ;
135+ }
136+
137+ public void setClose (float close ) {
138+ this .close = close ;
139+ }
140+
141+ public float getHigh () {
142+ return high ;
143+ }
144+
145+ public void setHigh (float high ) {
146+ this .high = high ;
147+ }
148+
149+ public float getLow () {
150+ return low ;
151+ }
152+
153+ public void setLow (float low ) {
154+ this .low = low ;
155+ }
156+
157+ public float getBubbleSize () {
158+ return bubbleSize ;
159+ }
160+
161+ public void setBubbleSize (float bubbleSize ) {
162+ this .bubbleSize = bubbleSize ;
163+ }
164+
165+ public String getSomeStringField () {
166+ return someStringField ;
167+ }
168+
169+ public void setSomeStringField (String someStringField ) {
170+ this .someStringField = someStringField ;
171+ }
172+
173+ public String getLabel () {
174+ return label ;
175+ }
176+
177+ public void setLabel (String label ) {
178+ this .label = label ;
179+ }
180+ }
0 commit comments