@@ -31,32 +31,49 @@ protected void onCreate(Bundle savedInstanceState) {
31
31
setContentView (R .layout .activity_bar );
32
32
barChart = (BarChart ) findViewById (R .id .columnChart );
33
33
Resources res = getResources ();
34
- FontStyle .setDefaultTextSpSize (this ,12 );
34
+ FontStyle .setDefaultTextSpSize (this ,8 );
35
35
List <String > chartYDataList = new ArrayList <>();
36
36
chartYDataList .add ("Tokyo" );
37
37
chartYDataList .add ("Paris" );
38
38
chartYDataList .add ("Hong Kong" );
39
- chartYDataList .add ("Singapore" );
39
+ chartYDataList .add ("Singapore" );//Y轴行列要跟下面数据添加对上
40
+ chartYDataList .add ("Google I/O" );
41
+ chartYDataList .add ("Hello World" );
42
+ chartYDataList .add ("Android" );
40
43
41
44
42
- List <BarData > ColumnDatas = new ArrayList <>();
43
45
ArrayList <Double > tempList1 = new ArrayList <>();
44
46
tempList1 .add (26d );
45
47
tempList1 .add (35d );
46
48
tempList1 .add (40d );
47
49
tempList1 .add (10d );
50
+ tempList1 .add (46d );
51
+ tempList1 .add (45d );
52
+ tempList1 .add (14d );
48
53
49
54
50
- BarData columnData1 = new BarData ("Temperature" ,"℃" ,getResources ().getColor (R .color .arc3 ),tempList1 );
51
55
ArrayList <Double > humidityList = new ArrayList <>();
52
56
humidityList .add (60d );
53
57
humidityList .add (50d );
54
58
humidityList .add (30d );
55
59
humidityList .add (65d );
60
+ humidityList .add (35d );
61
+ humidityList .add (78d );
62
+ humidityList .add (74d );
56
63
64
+ BarData columnData1 = new BarData ("Temperature" ,"℃" ,getResources ().getColor (R .color .arc3 ),tempList1 );
57
65
BarData columnData2 = new BarData ("Humidity" ,"RH%" ,getResources ().getColor (R .color .arc2 ),humidityList );
66
+ BarData columnData3 = new BarData ("Hwwo" ,"RH%" ,getResources ().getColor (R .color .arc1 ),humidityList );
67
+ BarData columnData4 = new BarData ("Chaone" ,"RH%" ,getResources ().getColor (R .color .temp_click_text_color ),humidityList );
68
+ BarData columnData5 = new BarData ("GOOGO" ,"RH%" ,getResources ().getColor (R .color .ground_20cm ),humidityList );
69
+
70
+ List <BarData > ColumnDatas = new ArrayList <>();
58
71
ColumnDatas .add (columnData1 );
59
72
ColumnDatas .add (columnData2 );
73
+ ColumnDatas .add (columnData3 );
74
+ ColumnDatas .add (columnData4 );
75
+ ColumnDatas .add (columnData5 );
76
+
60
77
ChartData <BarData > chartData = new ChartData <>("bar chart" ,chartYDataList ,ColumnDatas );
61
78
barChart .setChartData (chartData );
62
79
barChart .startChartAnim (1000 );
0 commit comments