单军华
2018-05-04 25f409185a53e5e7beb17518a684298d92d31b3f
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
//
//  HistoryRecordPage.m
//  pregnancy_guard
//
//  Created by WindShan on 2017/7/11.
//  Copyright © 2017年 WindShan. All rights reserved.
//
 
#import "HistoryRecordPage.h"
#import "GloriaLabel.h"
#import "NetworkSingleton.h"
#import "AdNoticeView.h"
#import "NoticeModel.h"
#import "HistoryDataModel.h"
 
@interface HistoryRecordPage ()
{
    JHLineChart *historyRecordLineChart;
    NSMutableArray * modelArray;
    UIButton * _DayBtn;
    UIButton * _WeekBtn;
    UIButton * _MonthBtn;
    int        currentUnit; // 1 周 2 月
    GloriaLabel* _UnitTipsLabel;
    NSDate *CurrentDate;
    NSDate *initialDate;
    GloriaLabel* _BeginTimesLabel;
    GloriaLabel* _EndTimesLabel;
    NSString * _beginTimeStr;
    NSString * _EndTimeStr;
    GloriaLabel* _StatusLabel;
    GloriaLabel* _YearLabel;
}
 
@property (nonatomic, strong) AdNoticeView * adNoticeView; // 广告控件
 
@end
 
@implementation HistoryRecordPage
 
- (void)viewDidLoad
{
    [super viewDidLoad];
    
    self.title = @"历史记录";
    [self setNavigationLeft:@"ic_back_arraw.png" sel:@selector(backAticon)];
    
    UIImageView * ic_bottom_bg = [[UIImageView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT-112-NavBar_Height, SCREEN_WIDTH, 112)];
    ic_bottom_bg.image = [UIImage imageNamed:@"ic_bottom_bg"];
    ic_bottom_bg.userInteractionEnabled = YES;
    [self.view addSubview:ic_bottom_bg];
    
    UIImageView * ic_time_bk = [[UIImageView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-225)/2, 15, 225, 25)];
    ic_time_bk.image = [UIImage imageNamed:@"ic_time_bk"];
    ic_time_bk.userInteractionEnabled = YES;
    [ic_bottom_bg addSubview:ic_time_bk];
    
    // Y = 0 75 150
    
    currentUnit = 1;
    CurrentDate = [DateUtil dateFromStringYMD:[DateUtil stringFromOffDateYMD:[NSDate date] dayCount:-1]];
    initialDate = CurrentDate;
    _DayBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    _DayBtn.frame = CGRectMake(0, 0, 75, 25);
    [_DayBtn setBackgroundImage:[UIImage imageNamed:@"ic_time_item_bk"] forState:UIControlStateNormal];
    [_DayBtn setTitle:@"日" forState:UIControlStateNormal];
    _DayBtn.titleLabel.font = [UIFont systemFontOfSize: 14.0];
    [_DayBtn setTitleColor:kUIColorFromRGB(0xffffff) forState:UIControlStateNormal];
    [_DayBtn addTarget:self action:@selector(unitDayLogin) forControlEvents:UIControlEventTouchUpInside];
    [ic_time_bk addSubview:_DayBtn];
    
    _WeekBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    _WeekBtn.frame = CGRectMake(75, 0, 75, 25);
    [_WeekBtn setBackgroundImage:[UIImage imageNamed:@"ic_time_item_bk"] forState:UIControlStateNormal];
    [_WeekBtn setTitle:@"周" forState:UIControlStateNormal];
    _WeekBtn.titleLabel.font = [UIFont systemFontOfSize: 14.0];
    [_WeekBtn setTitleColor:kUIColorFromRGB(0xffffff) forState:UIControlStateNormal];
    [_WeekBtn addTarget:self action:@selector(unitWeekLogin) forControlEvents:UIControlEventTouchUpInside];
    [ic_time_bk addSubview:_WeekBtn];
    [_WeekBtn setBackgroundImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
    
    _MonthBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    _MonthBtn.frame = CGRectMake(150, 0,75, 25);
    [_MonthBtn setBackgroundImage:[UIImage imageNamed:@"ic_time_item_bk"] forState:UIControlStateNormal];
    [_MonthBtn setTitle:@"月" forState:UIControlStateNormal];
    _MonthBtn.titleLabel.font = [UIFont systemFontOfSize: 14.0];
    [_MonthBtn setTitleColor:kUIColorFromRGB(0xffffff) forState:UIControlStateNormal];
    [_MonthBtn addTarget:self action:@selector(unitMonthLogin) forControlEvents:UIControlEventTouchUpInside];
    [ic_time_bk addSubview:_MonthBtn];
    [_MonthBtn setBackgroundImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
 
    
    UIImageView * ic_line = [[UIImageView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH/2, (112-15-25-52)/2 + 15 + 25 , 1, 52)];
    ic_line.image = [UIImage imageNamed:@"ic_line"];
    [ic_bottom_bg addSubview:ic_line];
    
    GloriaLabel* _AvgValueLabel = [[GloriaLabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH/4, 15 + 25 + 10,SCREEN_WIDTH/4, 20)];
    _AvgValueLabel.font = [UIFont systemFontOfSize:14];
    _AvgValueLabel.textAlignment = UITextAlignmentLeft;
    _AvgValueLabel.textColor = kUIColorFromRGB(0xffffff);
    _AvgValueLabel.text = @"平均值";
    [ic_bottom_bg addSubview:_AvgValueLabel];
    
    _YearLabel = [[GloriaLabel alloc] initWithFrame:CGRectMake(0, 15 + 25 + 10 + 20,SCREEN_WIDTH/4, 30)];
    _YearLabel.font = [UIFont boldSystemFontOfSize:18];
    _YearLabel.textAlignment = UITextAlignmentRight;
    _YearLabel.textColor = kUIColorFromRGB(0xffffff);
    _YearLabel.text = @"0";
    [ic_bottom_bg addSubview:_YearLabel];
    
    // 根据字符串大小计算label的大小
    CGSize size = [_YearLabel.text sizeWithFont:[UIFont boldSystemFontOfSize:18.0f] constrainedToSize:CGSizeMake(self.view.frame.size.width, 300) lineBreakMode:NSLineBreakByWordWrapping];
    
    GloriaLabel* _UnitLabel = [[GloriaLabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH/4+size.width/2+2, 15 + 25 + 10 + 20,SCREEN_WIDTH/2, 30)];
    _UnitLabel.font = [UIFont systemFontOfSize:14];
    _UnitLabel.textAlignment = UITextAlignmentLeft;
    _UnitLabel.textColor = kUIColorFromRGB(0xffffff);
    _UnitLabel.text = @"μW/c㎡";
    [ic_bottom_bg addSubview:_UnitLabel];
    
    GloriaLabel* _StatusTipsLabel = [[GloriaLabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH/2, 15 + 25 + 10,SCREEN_WIDTH/2, 20)];
    _StatusTipsLabel.font = [UIFont systemFontOfSize:14];
    _StatusTipsLabel.textAlignment = UITextAlignmentCenter;
    _StatusTipsLabel.textColor = kUIColorFromRGB(0xffffff);
    _StatusTipsLabel.text = @"状况";
    [ic_bottom_bg addSubview:_StatusTipsLabel];
    
    _StatusLabel = [[GloriaLabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH/2, 15 + 25 + 10+ 20,SCREEN_WIDTH/2, 20)];
    _StatusLabel.font = [UIFont boldSystemFontOfSize:18];
    _StatusLabel.textAlignment = UITextAlignmentCenter;
    _StatusLabel.textColor = kUIColorFromRGB(0xffffff);
    _StatusLabel.text = @"未知";
    [ic_bottom_bg addSubview:_StatusLabel];
    
    _BeginTimesLabel = [[GloriaLabel alloc] initWithFrame:CGRectMake(0, 0,SCREEN_WIDTH, 20)];
    _BeginTimesLabel.font = [UIFont boldSystemFontOfSize:14];
    _BeginTimesLabel.textAlignment = UITextAlignmentCenter;
    _BeginTimesLabel.textColor = RgbColor(0, 146, 252);
    _BeginTimesLabel.text = [DateUtil stringFromOffDateYMD:CurrentDate dayCount:-currentUnit];
    [self.view  addSubview:_BeginTimesLabel];
    
    _beginTimeStr = _BeginTimesLabel.text;
    _EndTimeStr = _beginTimeStr;
    
    GloriaLabel* _TimesLabel = [[GloriaLabel alloc] initWithFrame:CGRectMake(0, 20,SCREEN_WIDTH, 20)];
    _TimesLabel.font = [UIFont boldSystemFontOfSize:14];
    _TimesLabel.textAlignment = UITextAlignmentCenter;
    _TimesLabel.textColor = RgbColor(0, 146, 252);
    _TimesLabel.text = @"至";
    [self.view  addSubview:_TimesLabel];
    
    _EndTimesLabel = [[GloriaLabel alloc] initWithFrame:CGRectMake(0, 40,SCREEN_WIDTH, 20)];
    _EndTimesLabel.font = [UIFont boldSystemFontOfSize:14];
    _EndTimesLabel.textAlignment = UITextAlignmentCenter;
    _EndTimesLabel.textColor = RgbColor(0, 146, 252);
    _EndTimesLabel.text = [DateUtil stringFromDateYMD:CurrentDate];
    [self.view  addSubview:_EndTimesLabel];
    
    UIButton * _arraw_leftBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    _arraw_leftBtn.frame = CGRectMake(88, 20 , 15, 15);
    [_arraw_leftBtn setBackgroundImage:[UIImage imageNamed:@"icon_arraw_left"] forState:UIControlStateNormal];
    _arraw_leftBtn.titleLabel.font = [UIFont systemFontOfSize: 14.0];
    [_arraw_leftBtn setTitleColor:kUIColorFromRGB(0xfebead) forState:UIControlStateNormal];
    [_arraw_leftBtn addTarget:self action:@selector(leftLogin) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:_arraw_leftBtn];
    
    
    UIButton * _arraw_rightBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    _arraw_rightBtn.frame = CGRectMake(SCREEN_WIDTH-88-15, 20, 15, 15);
    [_arraw_rightBtn setBackgroundImage:[UIImage imageNamed:@"icon_arraw_right"] forState:UIControlStateNormal];
    _arraw_rightBtn.titleLabel.font = [UIFont systemFontOfSize: 14.0];
    [_arraw_rightBtn setTitleColor:kUIColorFromRGB(0xfebead) forState:UIControlStateNormal];
    [_arraw_rightBtn addTarget:self action:@selector(rightLogin) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:_arraw_rightBtn];
    
    modelArray = [[NSMutableArray alloc] init];
    
     [self drawHistoryRecordLine];
    
    _UnitTipsLabel = [[GloriaLabel alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT-112-NavBar_Height-30, SCREEN_WIDTH, 20)];
    _UnitTipsLabel.font = [UIFont boldSystemFontOfSize:14];
    _UnitTipsLabel.textAlignment = UITextAlignmentCenter;
    _UnitTipsLabel.textColor = RgbColor(0, 146, 252);
    _UnitTipsLabel.text = @"时间段(按日)";
    [self.view  addSubview:_UnitTipsLabel];
    
    [self GetUserDataList];
    
    [self GetNoticeInfo];
    // Do any additional setup after loading the view.
}
 
-(void)leftLogin
{
    CurrentDate = [DateUtil dateFromStringYMD:[DateUtil stringFromOffDateYMD:CurrentDate dayCount:-(currentUnit+1)]];
    _BeginTimesLabel.text = [DateUtil stringFromOffDateYMD:CurrentDate dayCount:-currentUnit];
    _EndTimesLabel.text = [DateUtil stringFromDateYMD:CurrentDate];
    
    _beginTimeStr = [NSString stringWithFormat:@"%@",_BeginTimesLabel.text];
    if(currentUnit == 1)
    {
        _EndTimeStr = _BeginTimesLabel.text ;
    }
    else
    {
        _EndTimeStr = _EndTimesLabel.text;
    }
    
    [self GetUserDataList];
}
 
-(void)rightLogin
{
    if( ![[DateUtil stringFromDateYMD:CurrentDate] isEqualToString: [DateUtil stringFromDateYMD:initialDate]])
    {
        CurrentDate = [DateUtil dateFromStringYMD:[DateUtil stringFromOffDateYMD:CurrentDate dayCount:(currentUnit+1)]];
        _BeginTimesLabel.text = [DateUtil stringFromOffDateYMD:CurrentDate dayCount:-currentUnit];
        _EndTimesLabel.text = [DateUtil stringFromDateYMD:CurrentDate];
        [self GetUserDataList];
    }
}
 
 
-(void)GetNoticeInfo
{
    //[UserDefault stringForKey:@"user_id"]
    NSString *path = [[NSString alloc] initWithFormat:GET_NOTICE];
    
    NSMutableDictionary * params = [[NSMutableDictionary alloc] init];
    
    MPWeakSelf(self);
    [NetworkSingleton networkingGetMethod:params urlName:path success:^(id responseBody)
     {
         MPStrongSelf(self);
         BaseResModel * resModel = [Global toBaseModel:responseBody];
         
         if(resModel.code == 0)
         {
             //[UserDefault setObject:self.is_open_upload forKey:@"is_open_upload"];
             [UserDefault synchronize];
             
             
             NoticeModel * model = [NoticeModel mj_objectWithKeyValues:resModel.content];
             
             if (self.adNoticeView == nil)
             {
                 self.adNoticeView = [[AdNoticeView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT) dataModel:model];
                 //self.adNoticeView.delegate = self;
                 [self.view addSubview:self.adNoticeView];
             }
            else
            {
               [self.adNoticeView setUIView:model];
            }
         }
         else
         {
             //[Global alertMessageEx:resModel.desc title:@"提示信息" okTtitle:nil cancelTitle:@"OK" delegate:self];
         }
     }
                                  failure:^(NSString *error)
     {
         
         [Global alertMessageEx:error title:@"获取失败" okTtitle:nil cancelTitle:@"OK" delegate:self];
     }];
}
 
 
-(void)GetUserDataList
{
    //[UserDefault stringForKey:@"user_id"]
    NSString *path = [[NSString alloc] initWithFormat:GET_DATALIST];
    
    NSMutableDictionary * params = [[NSMutableDictionary alloc] init];
    [params setValue:[UserDefault stringForKey:@"user_id"] forKey:@"user_id"];
    [params setValue:_beginTimeStr forKey:@"start_time"];
    [params setValue:_EndTimeStr forKey:@"end_time"];
    
    MPWeakSelf(self);
    [NetworkSingleton networkingGetMethod:params urlName:path success:^(id responseBody)
     {
         MPStrongSelf(self);
         BaseResModel * resModel = [Global toBaseModel:responseBody];
         
         if(resModel.code == 0)
         {
             _StatusLabel.text = [resModel.content objectForKey:@"status"];
             float avg = [[resModel.content objectForKey:@"avg"] floatValue];
             _YearLabel.text = [NSString stringWithFormat:@"%02.02f",avg];
             
             NSMutableArray * TempArr = [HistoryDataModel mj_objectArrayWithKeyValuesArray:[resModel.content objectForKey:@"data"]];
 
             if( [TempArr count] == 0 )
             {
                 [Global alertMessageEx:resModel.desc title:@"提示信息" okTtitle:nil cancelTitle:@"OK" delegate:self];
             }
             else
             {
                 [modelArray removeAllObjects];
                 [modelArray addObjectsFromArray:TempArr];
                 [historyRecordLineChart.valueArr removeAllObjects];
                 [historyRecordLineChart.valueArr addObjectsFromArray:modelArray];
                 [historyRecordLineChart.xLineDataArr removeAllObjects];
                 for (NSInteger i = 0; i < modelArray.count; i++)
                 {
                     [historyRecordLineChart.xLineDataArr addObject:[NSString stringWithFormat:@"%d",i]];
                 }
                 
                 //                 [valuepm25Arr replaceObjectAtIndex:7 withObject: [NSString stringWithFormat:@"%ld",[model.x1 integerValue]/100 + i]];
                 //                 [valueco2Arr replaceObjectAtIndex:7 withObject:[NSString stringWithFormat:@"%ld",[model.x5 integerValue]/1000 +i]];
                 
                 [historyRecordLineChart clearLine];
             }
 
             //[self.tableView reloadData];
             //[Global alertMessageEx:resModel.desc title:@"提示信息" okTtitle:nil cancelTitle:@"OK" delegate:self];
         }
         else
         {
             [Global alertMessageEx:resModel.desc title:@"提示信息" okTtitle:nil cancelTitle:@"OK" delegate:self];
         }
     }
                                  failure:^(NSString *error)
     {
         
         [Global alertMessageEx:error title:@"获取失败" okTtitle:nil cancelTitle:@"OK" delegate:self];
     }];
}
 
 
-(void)unitMonthLogin
{
    currentUnit = 28;
    [_DayBtn setBackgroundImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
    [_WeekBtn setBackgroundImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
    [_MonthBtn setBackgroundImage:[UIImage imageNamed:@"ic_time_item_bk"] forState:UIControlStateNormal];
    CurrentDate = [DateUtil dateFromStringYMD:[DateUtil stringFromOffDateYMD:[NSDate date] dayCount:-1]];
    _BeginTimesLabel.text = [DateUtil stringFromOffDateYMD:CurrentDate dayCount:-currentUnit];
    _EndTimesLabel.text = [DateUtil stringFromDateYMD:CurrentDate];
    [self GetUserDataList];
    _UnitTipsLabel.text = @"时间段(按月)";
}
 
-(void)unitWeekLogin
{
    currentUnit = 7;
    [_WeekBtn setBackgroundImage:[UIImage imageNamed:@"ic_time_item_bk"] forState:UIControlStateNormal];
    [_MonthBtn setBackgroundImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
    [_DayBtn setBackgroundImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
    CurrentDate = [DateUtil dateFromStringYMD:[DateUtil stringFromOffDateYMD:[NSDate date] dayCount:-1]];
    _BeginTimesLabel.text = [DateUtil stringFromOffDateYMD:CurrentDate dayCount:-currentUnit];
    _EndTimesLabel.text = [DateUtil stringFromDateYMD:CurrentDate];
    [self GetUserDataList];
    _UnitTipsLabel.text = @"时间段(按周)";
}
 
-(void)unitDayLogin
{
    currentUnit = 1;
    [_DayBtn setBackgroundImage:[UIImage imageNamed:@"ic_time_item_bk"] forState:UIControlStateNormal];
    [_WeekBtn setBackgroundImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
    [_MonthBtn setBackgroundImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
    CurrentDate = [DateUtil dateFromStringYMD:[DateUtil stringFromOffDateYMD:[NSDate date] dayCount:-1]];
    _BeginTimesLabel.text = [DateUtil stringFromOffDateYMD:CurrentDate dayCount:-currentUnit];
    _EndTimesLabel.text = [DateUtil stringFromDateYMD:CurrentDate];
    _beginTimeStr = [NSString stringWithFormat:@"%@",_BeginTimesLabel.text];
    _EndTimeStr = _BeginTimesLabel.text ;
    _UnitTipsLabel.text = @"时间段(按日)";
    [self GetUserDataList];
}
 
-(void)drawHistoryRecordLine
{
    
    /*     Create object        */
    historyRecordLineChart = [[JHLineChart alloc] initWithFrame:CGRectMake(0, 60, SCREEN_WIDTH-20, SCREEN_HEIGHT-112-NavBar_Height-40-40-20) andLineChartType:JHChartLineEveryValueForEveryX];
    
    /* The scale value of the X axis can be passed into the NSString or NSNumber type and the data structure changes with the change of the line chart type. The details look at the document or other quadrant X axis data source sample.*/
    
    //co2LineChart.xLineDataArr = @[@"10:00",@"11:21",@"12:32",@"13:33",@"14:43",@"15:33",@"16:11",@"17:21"];
    
    /* The different types of the broken line chart, according to the quadrant division, different quadrant correspond to different X axis scale data source and different value data source. */
    
    historyRecordLineChart.lineChartQuadrantType = JHLineChartQuadrantTypeFirstQuardrant;
    
    historyRecordLineChart.lineWidth = 3.0;
    historyRecordLineChart.valueArr = [NSMutableArray array];
    NSMutableArray * valueTeampArr = [[NSMutableArray alloc] init];
    //for (int i = 0; i < modelArray.count; i++)
    for (int i = 0; i < 10; i++)
    {
        //LiveDataModel * model = [modelArray objectAtIndex:i];
        
        [valueTeampArr addObject:[NSString stringWithFormat:@"%d",0]];
        [historyRecordLineChart.xLineDataArr addObject:[NSString stringWithFormat:@"%d",i]];
    }
    
    //NSMutableArray * valueTeampArr = [[NSMutableArray alloc] init];
    //for (int i = 0; i < 8; i++)
    //{
    //    [valueTeampArr addObject:@"3000"];
    //    [co2LineChart.xLineDataArr addObject:[NSString stringWithFormat:@"%d",i]];
    //}
    
    [historyRecordLineChart.valueArr addObject:valueTeampArr];
    
    [historyRecordLineChart updateYScale];
    
    /*  是否显示坐标点的曲线*/
    historyRecordLineChart.showYLevelLine = YES;
    /*         *  whether this chart shows leading lines for value point or not,default is YES  是否显示坐标点的曲线*/
    historyRecordLineChart.showValueLeadingLine = NO;
    //historyRecordLineChart.showYLine = NO;
    historyRecordLineChart.yLineDataArr  = @[@"10",@"20",@"30",@"40",@"50",@"60",@"70",@"80",@"90",@"100"];//[NSMutableArray array];
    // 二氧化碳
    /* Line Chart colors 曲线颜色 */
    historyRecordLineChart.valueLineColorArr =@[RgbColor(143, 246, 218)];
    /* Colors for every line chart 坐标点的颜色*/
    historyRecordLineChart.pointColorArr = @[RgbColor(36, 209, 215)];
    
    
    /* color for XY axis XY轴线条的颜色*/
    historyRecordLineChart.xAndYLineColor = RgbColor(0, 146, 252);
    /* XY axis scale color XY轴显示数值的颜色*/
    historyRecordLineChart.xAndYNumberColor = RgbColor(0, 146, 252);
    /* Dotted line color of the coordinate point */
    historyRecordLineChart.positionLineColorArr = @[RgbColor(0, 146, 252)];
    /*  坐标点数值的颜色*/
    historyRecordLineChart.pointNumberColorArr = @[[UIColor orangeColor]];
    /*        Set whether to fill the content, the default is False   是否填充曲线内部区域      */
    historyRecordLineChart.contentFill = NO;
    /*        Set whether the curve path         */
    historyRecordLineChart.pathCurve = YES;
    /*        Set fill color array      曲线内部区域填充的颜色    */
    historyRecordLineChart.contentFillColorArr = @[[UIColor orangeColor]];
    
    [self.view addSubview:historyRecordLineChart];
    /*       Start animation        */
    [historyRecordLineChart showAnimation];
    
    //GloriaLabel * timeTips = [[GloriaLabel alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-200)/2, 215+150, 200, 30)];
    //[timeTips setText:@"单位(天)"];
    //timeTips.textColor = RgbColor(171, 172, 173);
    //timeTips.textAlignment = UITextAlignmentCenter;
    //timeTips.font = [UIFont boldSystemFontOfSize:14];
    //[self.view addSubview:timeTips];
    
}
 
-(void) reDrawLine
{
    if( modelArray.count == 10 )
    {
        [historyRecordLineChart.xLineDataArr removeAllObjects];
        [historyRecordLineChart.valueArr removeAllObjects];
    }
    
    for (int i = 0; i < modelArray.count; i++)
    {
        //LiveDataModel * model = [modelArray objectAtIndex:i];
        
        //[historyRecordLineChart.valueArr addObject:model.x5];
        [historyRecordLineChart.xLineDataArr addObject:[NSString stringWithFormat:@"%d",i]];
    }
    
    /*Start animation*/
    [historyRecordLineChart  showAnimation];
}
 
-(void)backAticon
{
    //[self.navigationController popToViewController:self animated:YES];
    [self dismissViewControllerAnimated:YES completion:nil];
}
 
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
 
 
/*
#pragma mark - Navigation
 
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/
 
@end