-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Expand file tree
/
Copy pathXAxis.java
More file actions
136 lines (114 loc) · 3.48 KB
/
XAxis.java
File metadata and controls
136 lines (114 loc) · 3.48 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
package com.github.mikephil.charting.components;
import com.github.mikephil.charting.utils.Utils;
/**
* Class representing the x-axis labels settings. Only use the setter methods to
* modify it. Do not access public variables directly. Be aware that not all
* features the XLabels class provides are suitable for the RadarChart.
*
* @author Philipp Jahoda
*/
public class XAxis extends AxisBase {
/**
* width of the x-axis labels in pixels - this is automatically
* calculated by the computeSize() methods in the renderers
*/
public int mLabelWidth = 1;
/**
* height of the x-axis labels in pixels - this is automatically
* calculated by the computeSize() methods in the renderers
*/
public int mLabelHeight = 1;
/**
* width of the (rotated) x-axis labels in pixels - this is automatically
* calculated by the computeSize() methods in the renderers
*/
public int mLabelRotatedWidth = 1;
/**
* height of the (rotated) x-axis labels in pixels - this is automatically
* calculated by the computeSize() methods in the renderers
*/
public int mLabelRotatedHeight = 1;
/**
* This is the angle for drawing the X axis labels (in degrees)
*/
protected float mLabelRotationAngle = 0f;
/**
* if set to true, the chart will avoid that the first and last label entry
* in the chart "clip" off the edge of the chart
*/
private boolean mAvoidFirstLastClipping = false;
/**
* minimum spacing between labels in pixels
*/
protected float mSpaceBetweenLabelsMin = 0;
/**
* the position of the x-labels relative to the chart
*/
private XAxisPosition mPosition = XAxisPosition.TOP;
/**
* enum for the position of the x-labels relative to the chart
*/
public enum XAxisPosition {
TOP, BOTTOM, BOTH_SIDED, TOP_INSIDE, BOTTOM_INSIDE
}
public XAxis() {
super();
mYOffset = Utils.convertDpToPixel(4.f); // -3
}
/**
* Returns minimum spacing between labels in pixels
*/
public float getSpaceBetweenLabelsMin() { return mSpaceBetweenLabelsMin; }
/**
* Sets minimum spacing between labels in pixels
*/
public void setSpaceBetweenLabelsMin(float space)
{
mSpaceBetweenLabelsMin = space;
}
/**
* returns the position of the x-labels
*/
public XAxisPosition getPosition() {
return mPosition;
}
/**
* sets the position of the x-labels
*
* @param pos
*/
public void setPosition(XAxisPosition pos) {
mPosition = pos;
}
/**
* returns the angle for drawing the X axis labels (in degrees)
*/
public float getLabelRotationAngle() {
return mLabelRotationAngle;
}
/**
* sets the angle for drawing the X axis labels (in degrees)
*
* @param angle the angle in degrees
*/
public void setLabelRotationAngle(float angle) {
mLabelRotationAngle = angle;
}
/**
* if set to true, the chart will avoid that the first and last label entry
* in the chart "clip" off the edge of the chart or the screen
*
* @param enabled
*/
public void setAvoidFirstLastClipping(boolean enabled) {
mAvoidFirstLastClipping = enabled;
}
/**
* returns true if avoid-first-lastclipping is enabled, false if not
*
* @return
*/
public boolean isAvoidFirstLastClippingEnabled() {
return mAvoidFirstLastClipping;
}
}