forked from PhilJay/MPAndroidChart
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAxisRenderer.java
More file actions
121 lines (97 loc) · 2.75 KB
/
AxisRenderer.java
File metadata and controls
121 lines (97 loc) · 2.75 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
package com.github.mikephil.charting.renderer;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import com.github.mikephil.charting.utils.Transformer;
import com.github.mikephil.charting.utils.ViewPortHandler;
/**
* Baseclass of all axis renderers.
*
* @author Philipp Jahoda
*/
public abstract class AxisRenderer extends Renderer {
protected Transformer mTrans;
/** paint object for the grid lines */
protected Paint mGridPaint;
/** paint for the x-label values */
protected Paint mAxisLabelPaint;
/** paint for the line surrounding the chart */
protected Paint mAxisLinePaint;
/** paint used for the limit lines */
protected Paint mLimitLinePaint;
public AxisRenderer(ViewPortHandler viewPortHandler, Transformer trans) {
super(viewPortHandler);
this.mTrans = trans;
mAxisLabelPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mGridPaint = new Paint();
mGridPaint.setColor(Color.GRAY);
mGridPaint.setStrokeWidth(1f);
mGridPaint.setStyle(Style.STROKE);
mGridPaint.setAlpha(90);
mAxisLinePaint = new Paint();
mAxisLinePaint.setColor(Color.BLACK);
mAxisLinePaint.setStrokeWidth(1f);
mAxisLinePaint.setStyle(Style.STROKE);
mLimitLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mLimitLinePaint.setStyle(Paint.Style.STROKE);
}
/**
* Returns the Paint object used for drawing the axis (labels).
*
* @return
*/
public Paint getPaintAxisLabels() {
return mAxisLabelPaint;
}
/**
* Returns the Paint object that is used for drawing the grid-lines of the
* axis.
*
* @return
*/
public Paint getPaintGrid() {
return mGridPaint;
}
/**
* Returns the Paint object that is used for drawing the axis-line that goes
* alongside the axis.
*
* @return
*/
public Paint getPaintAxisLine() {
return mAxisLinePaint;
}
/**
* Returns the Transformer object used for transforming the axis values.
*
* @return
*/
public Transformer getTransformer() {
return mTrans;
}
/**
* Draws the axis labels to the screen.
*
* @param c
*/
public abstract void renderAxisLabels(Canvas c);
/**
* Draws the grid lines belonging to the axis.
*
* @param c
*/
public abstract void renderGridLines(Canvas c);
/**
* Draws the line that goes alongside the axis.
*
* @param c
*/
public abstract void renderAxisLine(Canvas c);
/**
* Draws the LimitLines associated with this axis to the screen.
*
* @param c
*/
public abstract void renderLimitLines(Canvas c);
}