Skip to content

Commit 9b6612b

Browse files
committed
完成轴和标题空白等注释
1 parent 9bc999a commit 9b6612b

File tree

9 files changed

+381
-54
lines changed

9 files changed

+381
-54
lines changed

.idea/misc.xml

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

chart/src/main/java/com/daivd/chart/component/ChartTitle.java

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,27 @@
1010
import com.daivd.chart.data.style.FontStyle;
1111

1212
/**
13-
* Created by huang on 2017/9/29.
1413
* 绘制标题
14+
* @author huangyanbin
1515
*/
1616

1717
public class ChartTitle extends PercentComponent<String> implements IChartTitle {
1818

19+
/**
20+
* 图表标题最大占比
21+
*/
1922
private static final float MAX_PERCENT =0.4f;
23+
/**
24+
* 标题字体样式
25+
*/
2026
private FontStyle fontStyle= new FontStyle();
21-
Path path = new Path();
2227

28+
private Path path = new Path();
2329

30+
/**
31+
* 设置标题占比
32+
* @param percent 百分比
33+
*/
2434
@Override
2535
public void setPercent(float percent) {
2636
if(percent > MAX_PERCENT){
@@ -29,6 +39,13 @@ public void setPercent(float percent) {
2939
super.setPercent(percent);
3040
}
3141

42+
/**
43+
* 绘制标题
44+
* <p>通过设置标题方位绘制标题</p>
45+
* @param canvas 画布
46+
* @param chartName 图表标题
47+
* @param paint 画笔
48+
*/
3249
@Override
3350
public void draw(Canvas canvas, String chartName, Paint paint) {
3451
fontStyle.fillPaint(paint);
@@ -56,10 +73,17 @@ public void draw(Canvas canvas, String chartName, Paint paint) {
5673
}
5774
}
5875

76+
/**
77+
* 获取标题字体样式
78+
* @return 标题字体样式
79+
*/
5980
public FontStyle getFontStyle() {
6081
return fontStyle;
6182
}
62-
83+
/**
84+
* 设置标题字体样式
85+
* @param fontStyle 标题字体样式
86+
*/
6387
public void setFontStyle(FontStyle fontStyle) {
6488
this.fontStyle = fontStyle;
6589
}

chart/src/main/java/com/daivd/chart/component/EmptyView.java

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,44 +8,81 @@
88
import com.daivd.chart.data.style.FontStyle;
99

1010
/**
11-
* Created by huang on 2017/9/30.
1211
* 空白提示
12+
* @author huangyanbin
1313
*/
1414

1515
public class EmptyView implements IEmpty {
16+
/**
17+
* 空白提示字体样式
18+
*/
1619
private FontStyle fontStyle = new FontStyle();
20+
/**
21+
* 空白文字
22+
*/
1723
private String emptyTip = "No Data";
24+
/**
25+
* 空白范围
26+
*/
1827
private Rect rect;
1928

29+
/**
30+
* 绘制空白
31+
* @param canvas 画布
32+
* @param paint 画笔
33+
*/
2034
@Override
2135
public void draw(Canvas canvas, Paint paint) {
2236
draw(canvas,emptyTip,paint);
2337
}
2438

39+
/**
40+
* 获取空白字体样式
41+
* @return 空白字体样式
42+
*/
2543
public FontStyle getFontStyle() {
2644
return fontStyle;
2745
}
28-
46+
/**
47+
* 设置空白字体样式
48+
* @param fontStyle 空白字体样式
49+
*/
2950
public void setFontStyle(FontStyle fontStyle) {
3051
this.fontStyle = fontStyle;
3152
}
32-
53+
/**
54+
* 设置空白提示
55+
* @return 空白提示
56+
*/
3357
@Override
3458
public String getEmptyTip() {
3559
return emptyTip;
3660
}
37-
61+
/**
62+
* 获取空白提示
63+
* @param emptyTip 空白提示
64+
*/
3865
@Override
3966
public void setEmptyTip(String emptyTip) {
4067
this.emptyTip = emptyTip;
4168
}
4269

43-
70+
/**
71+
* 计算空白大小
72+
* <p>因为空白提示是占整个图表不需要计算</>
73+
* @param chartRect 图表范围
74+
*/
4475
@Override
4576
public void computeRect(Rect chartRect) {
4677
rect = chartRect;
4778
}
4879

80+
/**
81+
* 绘制空白
82+
* @param canvas 画布
83+
* @param emptyTip 空白提示
84+
* @param paint 画笔
85+
*/
4986
@Override
5087
public void draw(Canvas canvas, String emptyTip, Paint paint) {
5188
fontStyle.fillPaint(paint);

chart/src/main/java/com/daivd/chart/component/Legend.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818

1919
import java.util.List;
2020

21-
/**Legend
22-
* Created by huang n 2017/9/29.
21+
/**
22+
* 图表图例
23+
* @author huangyanbin
2324
*/
2425

2526
public class Legend<C extends ColumnData> extends PercentComponent<ChartData<C>> implements ILegend<C> {

0 commit comments

Comments
 (0)