forked from PhilJay/MPAndroidChart
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBarData.java
More file actions
112 lines (94 loc) · 2.69 KB
/
BarData.java
File metadata and controls
112 lines (94 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
package com.github.mikephil.charting.data;
import java.util.ArrayList;
import java.util.List;
/**
* Data object that represents all data for the BarChart.
*
* @author Philipp Jahoda
*/
public class BarData extends BarLineScatterCandleData<BarDataSet> {
/** the space that is left between groups of bars */
private float mGroupSpace = 0.8f;
// /**
// * The maximum space (in pixels on the screen) a single bar can consume.
// */
// private float mMaximumBarWidth = 100f;
public BarData() {
super();
}
public BarData(List<String> xVals) {
super(xVals);
}
public BarData(String[] xVals) {
super(xVals);
}
public BarData(List<String> xVals, List<BarDataSet> dataSets) {
super(xVals, dataSets);
}
public BarData(String[] xVals, List<BarDataSet> dataSets) {
super(xVals, dataSets);
}
public BarData(List<String> xVals, BarDataSet dataSet) {
super(xVals, toList(dataSet));
}
public BarData(String[] xVals, BarDataSet dataSet) {
super(xVals, toList(dataSet));
}
private static List<BarDataSet> toList(BarDataSet dataSet) {
List<BarDataSet> sets = new ArrayList<BarDataSet>();
sets.add(dataSet);
return sets;
}
/**
* Returns the space that is left out between groups of bars. Always returns
* 0 if the BarData object only contains one DataSet (because for one
* DataSet, there is no group-space needed).
*
* @return
*/
public float getGroupSpace() {
if (mDataSets.size() <= 1)
return 0f;
else
return mGroupSpace;
}
/**
* Sets the space between groups of bars of different datasets in percent of
* the total width of one bar. 100 = space is exactly one bar width,
* default: 80
*
* @param percent
*/
public void setGroupSpace(float percent) {
mGroupSpace = percent / 100f;
}
/**
* Returns true if this BarData object contains grouped DataSets (more than
* 1 DataSet).
*
* @return
*/
public boolean isGrouped() {
return mDataSets.size() > 1 ? true : false;
}
//
// /**
// * Sets the maximum width (in density pixels) a single bar in the barchart
// * should consume.
// *
// * @param max
// */
// public void setBarWidthMaximum(float max) {
// mMaximumBarWidth = Utils.convertDpToPixel(max);
// }
//
// /**
// * Returns the maximum width (in density pixels) a single bar in the
// * barchart should consume.
// *
// * @return
// */
// public float getBarWidthMaximum() {
// return mMaximumBarWidth;
// }
}