27
27
28
28
import java .util .ArrayList ;
29
29
import java .util .List ;
30
- import java .util .Random ;
31
30
32
31
public class ScatterChartActivity extends AppCompatActivity {
33
32
@@ -44,22 +43,49 @@ protected void onCreate(Bundle savedInstanceState) {
44
43
Resources res = getResources ();
45
44
FontStyle .setDefaultTextSpSize (this ,12 );
46
45
List <String > chartYDataList = new ArrayList <>();
47
- for (int i =0 ; i <100 ;i ++){
48
- chartYDataList .add ("huang" );
49
- chartYDataList .add ("li" );
50
- }
46
+ chartYDataList .add ("Tokyo" );
47
+ chartYDataList .add ("Paris" );
48
+ chartYDataList .add ("Hong Kong" );
49
+ chartYDataList .add ("Singapore" );
50
+ chartYDataList .add ("Sydney" );
51
+ chartYDataList .add ("Milano" );
52
+ chartYDataList .add ("Shanghai" );
53
+ chartYDataList .add ("Beijing" );
54
+ chartYDataList .add ("Madrid" );
55
+ chartYDataList .add ("Moscow" );
56
+ chartYDataList .add ("Seoul" );
57
+ chartYDataList .add ("Bangkok" );
51
58
List <LineData > ColumnDatas = new ArrayList <>();
52
59
ArrayList <Double > tempList1 = new ArrayList <>();
53
- Random random = new Random ();
54
- for (int i =0 ; i <100 ;i ++){
55
- tempList1 .add ((double )random .nextInt (70 ));
56
- tempList1 .add ((double )random .nextInt (70 ));
57
- }
60
+ tempList1 .add (26d );
61
+ tempList1 .add (35d );
62
+ tempList1 .add (40d );
63
+ tempList1 .add (-20d );
64
+ tempList1 .add (26d );
65
+ tempList1 .add (35d );
66
+ tempList1 .add (-40d );
67
+ tempList1 .add (10d );
68
+ tempList1 .add (26d );
69
+ tempList1 .add (-15d );
70
+ tempList1 .add (40d );
71
+ tempList1 .add (10d );
58
72
LineData columnData1 = new LineData ("Temperature" ,"℃" , IAxis .AxisDirection .RIGHT ,getResources ().getColor (R .color .arc3 ),tempList1 );
59
- //ArrayList<Double> humidityList = new ArrayList<>();
60
-
73
+ ArrayList <Double > humidityList = new ArrayList <>();
74
+ humidityList .add (60d );
75
+ humidityList .add (50d );
76
+ humidityList .add (30d );
77
+ humidityList .add (65d );
78
+ humidityList .add (60d );
79
+ humidityList .add (100d );
80
+ humidityList .add (80d );
81
+ humidityList .add (65d );
82
+ humidityList .add (60d );
83
+ humidityList .add (50d );
84
+ humidityList .add (30d );
85
+ humidityList .add (65d );
86
+ LineData columnData2 = new LineData ("Humidity" ,"RH%" ,getResources ().getColor (R .color .arc2 ),humidityList );
61
87
ColumnDatas .add (columnData1 );
62
- // ColumnDatas.add(columnData2);
88
+ ColumnDatas .add (columnData2 );
63
89
ChartData <LineData > chartData2 = new ChartData <>("Scatter chart" ,chartYDataList ,ColumnDatas );
64
90
65
91
lineChart .setLineModel (LineChart .CURVE_MODEL );
@@ -116,7 +142,7 @@ protected void onCreate(Bundle savedInstanceState) {
116
142
PointStyle style = legendPoint .getPointStyle ();
117
143
style .setShape (PointStyle .RECT );
118
144
lineChart .getLegend ().setPercent (0.2f );
119
- // lineChart.getHorizontalAxis().setRotateAngle(45);
145
+ lineChart .getHorizontalAxis ().setRotateAngle (45 );
120
146
lineChart .getHorizontalAxis ().setAxisDirection (IAxis .AxisDirection .TOP );
121
147
lineChart .getProvider ().setDrawLine (false );
122
148
lineChart .getHorizontalAxis ().setFormat (new IFormat <String >() {
0 commit comments