<link rel="stylesheet" href="<?php echo base_url();?>public/js/vendor/bootstrap-datepicker/css/bootstrap-datepicker.standalone.min.css">
<script src="<?php echo base_url();?>public/js/vendor/bootstrap-datepicker/js/bootstrap-datepicker.min.js"></script>
<script src="<?php echo base_url();?>public/js/vendor/bootstrap-datepicker/locales/bootstrap-datepicker.zh-CN.min.js"></script>
<style>
	.today-size{
		font-size: 30px;
	}
	.today-size-title{
		font-size: 20px;
	}
	table td,table th{
		text-align: center;
		background-color: #fff;
		display:table-cell;
		vertical-align:middle;/*设置垂直居中*/
		position: relative;
	}
	table td div{
		
	}
	table td:hover{
		background-color: #87CEFA;
	}
</style>
<div class="content_wrapper">
    <div class="container-fluid">
        <div class="row">
            <div class="col-sm-12">
                <aside>
                    <header><i class="fa fa-fw fa-file"></i>查询</header>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div class="col-sm-12">
                                    <form class="form-inline" role="form" method="POST" action="#operate/daily" name="stanpform">
                                    	<span class="gap"></span>
                                        <div class="form-group">
                                                <label>地区</label>
                                                <select name="address" class="form-control">
                                                	<option value="all">所有</option>
                                                	<?php foreach($addressList as $key => $row){ ?>
                                                		<option value="<?php echo $key; ?>" <?php echo $address == $key?"selected":""; ?>><?php echo $row; ?></option>
                                                	<?php } ?>
                                                	<!--<option value="DE">德国</option>-->
                                                	<!--<option value="FR">法国</option>-->
                                                	<!--<option value="US">美利坚共和国</option>-->
                                                	<!--<option value="ES">西班牙</option>-->
                                                </select>
                                        </div>
                                        <span class="gap"></span>
                                        <div class="form-group">
                                                <label>平台</label>
                                                <select name="channel" class="form-control">
                                                	<option value="all">所有</option>
                                                	<?php 
                                                		foreach($sidList as $channelTemp => $val){
                                                			echo '<option value="'.$channelTemp.'" '.($channel == $channelTemp?"selected":"").'>'.$channelTemp.'</option>';
                                                		}
                                                	?>
                                                </select>
                                        </div>
                                        <span class="gap"></span>
                                        <div class="form-group">
                                                <label>选择日期</label>
                                                <input type="text" class="form-control datetimepicker" value="<?php if($date) echo $date;?>" placeholder="开始时间" name="date" />
                                        </div>
                                        
                                        <button type="submit" class="btn btn-primary">查询</button>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
        </div>

        <div class="row">
            <div class="col-sm-12">
                <div class="table-responsive">
                    <table class="table table-striped table-bordered table-hover" cellspacing="0" width="100%">
						<tr>
							<th rowspan="2" style="width:40px;">流水盈亏</th>
							<td style="width:16%;"  class="today-size-title"><?php echo $month; ?>月内购流水(未分地区)</td>
							<td><?php echo number_format($gamesIncomeTotal,2,".",""); ?></td>
							<td style="width:16%;"  class="today-size-title"><?php echo $month; ?>月总流水</td>
							<td><?php echo number_format($gamesIncomeTotal + $advertIncomeTotal,2,".",""); ?></td>
							<td style="width:16%;"  class="today-size-title"><?php echo $month; ?>月毛利ROI</td>
							<td><?php echo number_format(($gamesIncomeTotal * 0.7 + $advertIncomeTotal) / $launchPayTotal,2,".",""); ?></td>
						</tr>
						<tr>
							<td style="width:16%;"  class="today-size-title"><?php echo $month; ?>月广告流水</td>
							<td><?php echo number_format($advertIncomeTotal,2,".",""); ?></td>
							<td style="width:16%;"  class="today-size-title"><?php echo $month; ?>月投放费用</td>
							<td><?php echo number_format($launchPayTotal,2,".",""); ?></td>
							<td style="width:16%;"  class="today-size-title"><?php echo $month; ?>月盈亏</td>
							<td><?php echo number_format(($gamesIncomeTotal * 0.7 + $advertIncomeTotal) - $launchPayTotal,2,".",""); ?></td>
						</tr>
                    </table>
                </div>
            </div>                    
        </div>
        
        <div class="row">
            <div class="col-sm-8">
                <div class="table-responsive">
                    <table class="table table-striped table-bordered table-hover" cellspacing="0" width="100%">
						<tr>
							<th style="width:40px;">活跃数据</th>
							<td>
								<div>
									<p class="today-size-title">新增用户</p>
									<?php
										$increase = number_format(($newplayerNumber-$newplayerLastNumber)/$newplayerNumber * 100,2,".","");
									?>
									<p><span class="today-size"><?php echo $newplayerNumber; ?></span>&nbsp;<span style="color:<?php echo $newplayerNumber>$newplayerLastNumber?'red;':'green;'; ?>"><?php echo $newplayerNumber>$newplayerLastNumber?'&#8593;':'&#8595;'; ?><?php echo $increase; ?>%</span></p>
									<p><?php echo $newplayerLastNumber; ?></p>
								</div>
							</td>
							<td>
								<div>
									<p class="today-size-title">活跃用户</p>
									<?php
										$increase = number_format(($loginplayerNumber-$loginplayerLastNumber)/$loginplayerNumber * 100,2,".","");
									?>
									<p><span class="today-size"><?php echo $loginplayerNumber; ?></span>&nbsp;<span style="color:<?php echo $loginplayerNumber>$loginplayerLastNumber?'red;':'green;'; ?>"><?php echo $loginplayerNumber>$loginplayerLastNumber?'&#8593;':'&#8595;'; ?><?php echo $increase; ?>%</span></p>
									<p><?php echo $loginplayerLastNumber; ?></p>
								</div>
							</td>
							<td>
								<div>
									<p class="today-size-title">新增次留</p>
									<?php 
										$remainNew = number_format($remainNew,2,".","");
										$remainLastNew = number_format($remainLastNew,2,".","");
										$increase = number_format(($remainNew-$remainLastNew)/$remainNew * 100,2,".","");
									?>
									<p><span class="today-size"><?php echo $remainNew; ?></span>&nbsp;<span style="color:<?php echo $remainNew>$remainLastNew?'red;':'green;'; ?>"><?php echo $remainNew>$remainLastNew?'&#8593;':'&#8595;'; ?><?php echo $increase; ?>%</span></p>
									<p><?php echo $remainLastNew; ?></p>
								</div>
							</td>
							<td>
								<div>
									<p class="today-size-title">活跃次留</p>
									<?php 
										$remainLogin = number_format($remainLogin,2);
										$remainLastLogin = number_format($remainLastLogin,2);
										$increase = number_format(($remainLogin-$remainLastLogin)/$remainNew * 100,2);
									?>
									<p><span class="today-size"><?php echo $remainLogin; ?></span>&nbsp;<span style="color:<?php echo $remainLogin>$remainLastLogin?'red;':'green;'; ?>"><?php echo $remainLogin>$remainLastLogin?'&#8593;':'&#8595;'; ?><?php echo $increase; ?>%</span></p>
									<p><?php echo $remainLastLogin; ?></p>
								</div>
							</td>
							<td>
								<div>
									<p class="today-size-title">人均时长</p>
									<?php 
										$logintimeAvg = number_format($logintimeAvg,2,".","");
										$logintimeLastAvg = number_format($logintimeLastAvg,2,".","");
										$increase = number_format(($logintimeAvg-$logintimeLastAvg)/$logintimeAvg * 100,2,".","");
									?>
									<p><span class="today-size"><?php echo $logintimeAvg; ?></span>&nbsp;<span style="color:<?php echo $logintimeAvg>$logintimeLastAvg?'red;':'green;'; ?>"><?php echo $logintimeAvg>$logintimeLastAvg?'&#8593;':'&#8595;'; ?><?php echo $increase; ?>%</span></p>
									<p><?php echo $logintimeLastAvg; ?></p>
								</div>
							</td>
						</tr>
						<tr>
							<th rowspan="3" style="width:40px;">付费数据</th>
							<td>
								<div>
									<p class="today-size-title">去分成内购</p>
									<?php 
										$gamesIncome_07 = number_format($gamesIncome * 0.7,2,".","");
										$gamesLastIncome_07 = number_format($gamesLastIncome * 0.7,2,".","");
										$increase = number_format(($gamesIncome_07-$gamesLastIncome_07)/($gamesIncome_07) * 100,2,".","");
									?>
									<p><span class="today-size"><?php echo $gamesIncome_07; ?></span>&nbsp;<span style="color:<?php echo $gamesIncome_07>$gamesLastIncome_07?'red;':'green;'; ?>"><?php echo $gamesIncome_07>$gamesLastIncome_07?'&#8593;':'&#8595;'; ?><?php echo $increase; ?>%</span></p>
									<p><?php echo $gamesLastIncome_07; ?></p>
								</div>
							</td>
							<td>
								<div>
									<p class="today-size-title">付费人数</p>
									<?php
										$increase = number_format(($payNumber-$payLastNumber)/$payNumber * 100,2,".","");
									?>
									<p><span class="today-size"><?php echo $payNumber; ?></span>&nbsp;<span style="color:<?php echo $payNumber>$payLastNumber?'red;':'green;'; ?>"><?php echo $payNumber>$payLastNumber?'&#8593;':'&#8595;'; ?><?php echo $increase; ?>%</span></p>
									<p><?php echo $payLastNumber; ?></p>
								</div>
							</td>
							<td>
								<div>
									<p class="today-size-title">付费率</p>
									<?php
										$payRate = number_format($payNumber / $loginplayerNumber,2,".","");
										$payLastRate = number_format($payLastNumber / $loginplayerLastNumber,2,".","");
										$increase = number_format(($payRate-$payLastRate)/$payRate * 100,2,".","");
									?>
									<p><span class="today-size"><?php echo $payRate; ?></span>&nbsp;<span style="color:<?php echo $payRate>$payLastRate?'red;':'green;'; ?>"><?php echo $payRate>$payLastRate?'&#8593;':'&#8595;'; ?><?php echo $increase; ?>%</span></p>
									<p><?php echo $payLastRate; ?></p>
								</div>
							</td>
							<td>
								<p class="today-size-title">ARPU</p>
								<?php
									$ARPU = number_format($gamesIncome / $loginplayerNumber,2,".","");
									$lastARPU = number_format($gamesLastIncome / $loginplayerLastNumber,2,".","");
									$increase = number_format(($ARPU-$lastARPU)/$ARPU * 100,2,".","");
								?>
								<p><span class="today-size"><?php echo $ARPU; ?></span>&nbsp;<span style="color:<?php echo $ARPU>$lastARPU?'red;':'green;'; ?>"><?php echo $ARPU>$lastARPU?'&#8593;':'&#8595;'; ?><?php echo $increase; ?>%</span></p>
								<p><?php echo $lastARPU; ?></p>
							</td>
							<td>
								<p class="today-size-title">ARPPU</p>
								<?php
									$ARPPU = number_format($gamesIncome / $payNumber,2,".","");
									$lastARPPU = number_format($gamesLastIncome / $payLastNumber,2,".","");
									$increase = number_format(($ARPPU-$lastARPPU)/$ARPPU * 100,2,".","");
								?>
								<p><span class="today-size"><?php echo $ARPPU; ?></span>&nbsp;<span style="color:<?php echo $ARPPU>$lastARPPU?'red;':'green;'; ?>"><?php echo $ARPPU>$lastARPPU?'&#8593;':'&#8595;'; ?><?php echo $increase; ?>%</span></p>
								<p><?php echo $lastARPPU; ?></p>
							</td>
						</tr>
						<tr>
							<td rowspan="2">
								<div style="padding-top:42%;">
									<p class="today-size-title">付费金额</p>
									<?php
										$increase = number_format(($gamesIncome-$gamesLastIncome)/$gamesIncome * 100,2,".","");
									?>
									<p><span class="today-size"><?php echo $gamesIncome; ?></span>&nbsp;<span style="color:<?php echo $gamesIncome>$gamesLastIncome?'red;':'green;'; ?>"><?php echo $gamesIncome>$gamesLastIncome?'&#8593;':'&#8595;'; ?><?php echo $increase; ?>%</span></p>
									<p><?php echo $gamesLastIncome; ?></p>
								</div>
							</td>
							<td>
								<p class="today-size-title">新增用户付费人数</p>
								<?php
									$increase = number_format(($newplayerPayNumber-$newplayerLastPayNumber)/$newplayerPayNumber * 100,2,".","");
								?>
								<p><span class="today-size"><?php echo $newplayerPayNumber; ?></span>&nbsp;<span style="color:<?php echo $newplayerPayNumber>$newplayerLastPayNumber?'red;':'green;'; ?>"><?php echo $newplayerPayNumber>$newplayerLastPayNumber?'&#8593;':'&#8595;'; ?><?php echo $increase; ?>%</span></p>
								<p><?php echo $newplayerLastPayNumber; ?></p>
							</td>
							<td rowspan="2">
								<div style="padding-top:42%;">
									<p class="today-size-title">新增付费率</p>
									<?php
										$newplayerPay = number_format(($newplayerPayNumber / $newplayerNumber) * 100,2,".","");
										$newplayerLastPay = number_format(($newplayerLastPayNumber / $newplayerLastNumber) * 100,2,".","");
										$increase = number_format(($newplayerPay-$newplayerLastPay)/$newplayerPay * 100,2,".","");
									?>
									<p><span class="today-size"><?php echo $newplayerPay; ?></span>&nbsp;<span style="color:<?php echo $newplayerPay>$newplayerLastPay?'red;':'green;'; ?>"><?php echo $newplayerPay>$newplayerLastPay?'&#8593;':'&#8595;'; ?><?php echo $increase; ?>%</span></p>
									<p><?php echo $newplayerLastPay; ?></p>
								</div>
							</td>
							<td>
								<p class="today-size-title">老活跃用户付费人数</p>
								<?php
									$increase = number_format(($loginplayerPayNumber-$loginplayerLastPayNumber)/$loginplayerPayNumber * 100,2,".","");
								?>
								<p><span class="today-size"><?php echo $loginplayerPayNumber; ?></span>&nbsp;<span style="color:<?php echo $loginplayerPayNumber>$loginplayerLastPayNumber?'red;':'green;'; ?>"><?php echo $loginplayerPayNumber>$loginplayerLastPayNumber?'&#8593;':'&#8595;'; ?><?php echo $increase; ?>%</span></p>
								<p><?php echo $loginplayerLastPayNumber; ?></p>
							</td>
							<td rowspan="2">
								<div style="padding-top:42%;">
									<?php
										$oldLogin = array_diff($dau,$newDau);
										$oldLastLogin = array_diff($lastDau,$newLastDau);
										$loginlayerPay = number_format(($loginplayerPayNumber / count($oldLogin)) * 100,2,".","");
										$loginplayerLastPay = number_format(($loginplayerLastPayNumber / count($oldLastLogin)) * 100,2,".","");
										$increase = number_format(($loginlayerPay-$loginplayerLastPay)/$loginlayerPay * 100,2,".","");
									?>
									<p class="today-size-title">老活跃用户付费率</p>
									<p><span class="today-size"><?php echo $loginlayerPay; ?></span>&nbsp;<span style="color:<?php echo $loginlayerPay>$loginplayerLastPay?'red;':'green;'; ?>"><?php echo $loginlayerPay>$loginplayerLastPay?'&#8593;':'&#8595;'; ?><?php echo $increase; ?>%</span></p>
									<p><?php echo $loginplayerLastPay; ?></p>
								</div>
							</td>
						</tr>
						<tr>
							<td>
								<p class="today-size-title">新增人数付费金额</p>
								<?php
									$increase = number_format(($newplayerPayIncome-$newplayerLastPayIncome)/$newplayerPayIncome * 100,2,".","");
								?>
								<p><span class="today-size"><?php echo $newplayerPayIncome; ?></span>&nbsp;<span style="color:<?php echo $newplayerPayIncome>$newplayerLastPayIncome?'red;':'green;'; ?>"><?php echo $newplayerPayIncome>$newplayerLastPayIncome?'&#8593;':'&#8595;'; ?><?php echo $increase; ?>%</span></p>
								<p><?php echo $newplayerLastPayIncome; ?></p>
							</td>
							<td>
								<p class="today-size-title">老活跃用户付费金额</p>
								<?php
									$increase = number_format(($loginplayerPayIncome-$loginplayerLastPayIncome)/$loginplayerPayIncome * 100,2,".","");
								?>
								<p><span class="today-size"><?php echo $loginplayerPayIncome; ?></span>&nbsp;<span style="color:<?php echo $loginplayerPayIncome>$loginplayerLastPayIncome?'red;':'green;'; ?>"><?php echo $loginplayerPayIncome>$loginplayerLastPayIncome?'&#8593;':'&#8595;'; ?><?php echo $increase; ?>%</span></p>
								<p><?php echo $loginplayerLastPayIncome; ?></p>
							</td>
						</tr>
                    </table>
                </div>
            </div>
            <div class="col-sm-4">
                <div class="table-responsive">
                    <table class="table table-striped table-bordered table-hover" cellspacing="0" width="100%">
						<tr>
							<th rowspan="2" style="width:40px;">投放数据</th>
							<td rowspan="2">
								<div style="padding-top:42%;">
									<p class="today-size-title">投放花费</p>
									<?php
										$increase = number_format(($launchData['pay']-$launchLastData['pay'])/$launchData['pay'] * 100,2,".","");
									?>
									<p><span class="today-size"><?php echo $launchData['pay']; ?></span>&nbsp;<span style="color:<?php echo $launchData['pay']>$launchLastData['pay']?'red;':'green;'; ?>"><?php echo $launchData['pay']>$launchLastData['pay']?'&#8593;':'&#8595;'; ?><?php echo $increase; ?>%</span></p>
									<p><?php echo $launchLastData['pay']; ?></p>
								</div>
							</td>
							<td>
								<p class="today-size-title">CPI</p>
								<?php
									$increase = number_format(($launchData['cpi']-$launchLastData['cpi'])/$launchData['cpi'] * 100,2,".","");
								?>
								<p><span class="today-size"><?php echo number_format($launchData['cpi'],2,".",""); ?></span>&nbsp;<span style="color:<?php echo $launchData['cpi']>$launchLastData['cpi']?'red;':'green;'; ?>"><?php echo $launchData['cpi']>$launchLastData['cpi']?'&#8593;':'&#8595;'; ?><?php echo $increase; ?>%</span></p>
								<p><?php echo number_format($launchLastData['cpi'],2,".",""); ?></p>
							</td>
						</tr>
						<tr>
							<td>
								<p class="today-size-title">当日盈亏</p>
								<?php
									$loss = number_format(($gamesIncome * 0.7) + $advertData['income'] - $launchData['pay'],2,".","");
									$lossLast = number_format(($gamesLastIncome * 0.7) + $advertData['income'] - $launchData['pay'],2,".","");
									$increase = number_format(($loss-$lossLast)/$loss * 100,2,".","");
								?>
								<p><span class="today-size"><?php echo $loss; ?></span>&nbsp;<span style="color:<?php echo $loss>$lossLast?'red;':'green;'; ?>"><?php echo $loss>$lossLast?'&#8593;':'&#8595;'; ?><?php echo $increase; ?>%</span></p>
								<p><?php echo $lossLast; ?></p>
							</td>
						</tr>
						<tr>
							<th rowspan="2" style="width:40px;">广告数据</th>
							<td rowspan="2">
								<div style="padding-top:42%;">
									<p class="today-size-title">广告收入</p>
									<?php
										$increase = number_format(($advertData['income']-$advertLastData['income'])/$advertData['income'] * 100,2,".","");
									?>
									<p><span class="today-size"><?php echo $advertData['income']; ?></span>&nbsp;<span style="color:<?php echo $advertData['income']>$advertLastData['income']?'red;':'green;'; ?>"><?php echo $advertData['income']>$advertLastData['income']?'&#8593;':'&#8595;'; ?><?php echo $increase; ?>%</span></p>
									<p><?php echo $advertLastData['income']; ?></p>
								</div>
							</td>
							<td>
								<p class="today-size-title">人均展示</p>
								<?php
									$increase = number_format(($advertData['showAvg']-$advertLastData['showAvg'])/$advertData['showAvg'] * 100,2,".","");
								?>
								<p><span class="today-size"><?php echo number_format($advertData['showAvg'],2,".",""); ?></span>&nbsp;<span style="color:<?php echo $advertData['showAvg']>$advertLastData['showAvg']?'red;':'green;'; ?>"><?php echo $advertData['showAvg']>$advertLastData['showAvg']?'&#8593;':'&#8595;'; ?><?php echo $increase; ?>%</span></p>
								<p><?php echo number_format($advertLastData['showAvg'],2,".",""); ?></p>
							</td>
						</tr>
						<tr>
							<td>
								<p class="today-size-title">eCPM</p>
								<?php
									$increase = number_format(($advertData['ecpm']-$advertLastData['ecpm'])/$advertData['ecpm'] * 100,2,".","");
								?>
								<p><span class="today-size"><?php echo number_format($advertData['ecpm'],2,".",""); ?></span>&nbsp;<span style="color:<?php echo $advertData['ecpm']>$advertLastData['ecpm']?'red;':'green;'; ?>"><?php echo $advertData['ecpm']>$advertLastData['ecpm']?'&#8593;':'&#8595;'; ?><?php echo $increase; ?>%</span></p>
								<p><?php echo number_format($advertLastData['ecpm'],2,".",""); ?></p>
							</td>
						</tr>
                    </table>
                </div>
            </div>
        </div>
        
        <div class="row">
            <div class="col-sm-6">
                <aside>
                    <header><i class="fa fa-fw fa-file"></i>新增活跃</header>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div id="container1" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
            <div class="col-sm-6">
                <aside>
                    <header><i class="fa fa-fw fa-file"></i>新增留存</header>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div id="container2" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
            <div class="col-sm-6">
                <aside>
                    <header><i class="fa fa-fw fa-file"></i>AND/IOS各项占比</header>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div id="container3" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
            <div class="col-sm-6">
                <aside>
                    <header><i class="fa fa-fw fa-file"></i>流水与花费</header>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div id="container4" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
        </div>
    </div>
</div>
<!--<script type="text/javascript" src="--><?php //echo base_url().'public/js/chart/chart.js';?><!--"></script>-->
<script type="text/javascript" src="<?php echo base_url();?>public/js/highcharts/highcharts.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>public/js/highcharts/modules/exporting.js"></script>
<script type="text/javascript">
    //选择日期
    $('.datetimepicker').datepicker({
        language:'zh-CN',
        format:'yyyy-mm-dd',
        zIndexOffset:906  //控制z-index
    });
    
    var chart2 = Highcharts.chart('container2', {
        chart: {
            type: 'line'
        },
        title: {
            text: '新增留存'
        },
        subtitle: {
            text: ''
        },
        xAxis: {
            categories: [<?php 
            	foreach($newRemainData['data'] as $day => $row){
            		echo "'".$day."',";
            	}
            ?>]
        },
        yAxis: [{ // Primary yAxis
            labels: {
                format: '{value}',
                style: {
                    color: Highcharts.getOptions().colors[1]
                }
            },
            title: {
                text: '数值',
                style: {
                    color: Highcharts.getOptions().colors[1]
                }
            }
        }, { // Secondary yAxis
            title: {
                text: '百分比',
                style: {
                    color: Highcharts.getOptions().colors[1]
                }
            },
            labels: {
                format: '{value} %',
                style: {
                    color: Highcharts.getOptions().colors[1]
                }
            },
            opposite: true
        }],
        plotOptions: {
            line: {
                dataLabels: {
                    enabled: true
                },
                enableMouseTracking: false
            }
        },
        series: [{
            name: 'Android',
            data: [<?php 
            	foreach($newRemainData['data'] as $day => $row){
            		if(empty($row['android'])){
            			echo "0,";
            		}else{
            			echo $row['android'].",";
            		}
            	}
            ?>]
        },{
            name: 'IOS',
            data: [<?php 
            	foreach($newRemainData['data'] as $day => $row){
            		if(empty($row['ios'])){
            			echo "0,";
            		}else{
            			echo $row['ios'].",";
            		}
            	}
            ?>]
        }]
    });
    
    var chart1 = Highcharts.chart('container1', {
        chart: {
            type: 'column'
        },
        title: {
            text: '新增活跃'
        },
        subtitle: {
            text: ''
        },
        xAxis: {
            categories: [<?php 
            	foreach($newDauData['data'] as $day => $row){
            		echo "'".$day."',";
            	}
            ?>]
        },
        yAxis: [{ // Primary yAxis
            labels: {
                format: '{value}',
                style: {
                    color: Highcharts.getOptions().colors[1]
                }
            },
            title: {
                text: '数值',
                style: {
                    color: Highcharts.getOptions().colors[1]
                }
            }
        }, { // Secondary yAxis
            title: {
                text: '数值',
                style: {
                    color: Highcharts.getOptions().colors[1]
                }
            },
            labels: {
                format: '{value}',
                style: {
                    color: Highcharts.getOptions().colors[1]
                }
            },
            opposite: true
        }],
        plotOptions: {
            line: {
                dataLabels: {
                    enabled: true
                },
                enableMouseTracking: false
            }
        },
        series: [{
        	type : 'column',
            name: '自然新增',
            data: [<?php 
            	foreach($newDauData['data'] as $day => $row){
            		if(empty($row['naturalNew'])){
            			echo "0,";
            		}else{
            			echo $row['naturalNew'].",";
            		}
            	}
            ?>]
        },{
        	type : 'column',
            name: '广告新增',
            data: [<?php 
            	foreach($newDauData['data'] as $day => $row){
            		if(empty($row['advertNew'])){
            			echo "0,";
            		}else{
            			echo $row['advertNew'].",";
            		}
            	}
            ?>]
        },{
        	type : 'column',
            name: '自传播',
            data: [<?php 
            	foreach($newDauData['data'] as $day => $row){
            		if(empty($row['selfNew'])){
            			echo "0,";
            		}else{
            			echo $row['selfNew'].",";
            		}
            	}
            ?>]
        },{
        	type : 'line',
            name: '活跃用户',
            data: [<?php 
            	foreach($newDauData['data'] as $day => $row){
            		if(empty($row['dau'])){
            			echo "0,";
            		}else{
            			echo $row['dau'].",";
            		}
            	}
            ?>],
            yAxis: 1,
        }]
    });
    
    var chart3 = Highcharts.chart('container3', {
        chart: {
            type: 'column'
        },
        title: {
            text: 'AND/IOS各项占比'
        },
        subtitle: {
            text: ''
        },
        xAxis: {
            categories: ['新增用户','新增用户收入','DAU','总活跃用户的收入']
        },
        tooltip: {
            formatter: function () {
                return '<br/>' +
                    this.series.name + ': ' + this.y + '<br/>' +
                    '总量: ' + this.point.stackTotal;
            }
        },
        plotOptions: {
            column: {
                stacking: 'normal'
            }
        },
        yAxis: [{ // Primary yAxis
            labels: {
                format: '{value}',
                style: {
                    color: Highcharts.getOptions().colors[1]
                }
            },
            title: {
                text: '数值',
                style: {
                    color: Highcharts.getOptions().colors[1]
                }
            }
        }, { // Secondary yAxis
            title: {
                text: '百分比',
                style: {
                    color: Highcharts.getOptions().colors[1]
                }
            },
            labels: {
                format: '{value} %',
                style: {
                    color: Highcharts.getOptions().colors[1]
                }
            },
            opposite: true
        }],
        plotOptions: {
            column: {
                stacking: 'normal'
            }
        },
        series: [{
            name: 'Android',
            data: [<?php
            	echo $ANDIOSRateData['android']['newplayer'].",";
            	echo $ANDIOSRateData['android']['newplayerPayIncome'].",";
            	echo $ANDIOSRateData['android']['dau'].",";
            	echo $ANDIOSRateData['android']['totalIncome'].",";
            ?>],
            stack: '来源',
        },{
            name: 'IOS',
            data: [<?php
            	echo $ANDIOSRateData['ios']['newplayer'].",";
            	echo $ANDIOSRateData['ios']['newplayerPayIncome'].",";
            	echo $ANDIOSRateData['ios']['dau'].",";
            	echo $ANDIOSRateData['ios']['totalIncome'].",";
            ?>],
            stack: '来源',
        }]
    });
    
    var chart4 = Highcharts.chart('container4', {
        chart: {
            type: 'line'
        },
        title: {
            text: '流水与花费'
        },
        subtitle: {
            text: ''
        },
        xAxis: {
            categories: [<?php 
            	foreach($logPayData['data'] as $day => $row){
            		echo "'".$day."',";
            	}
            ?>]
        },
        yAxis: [{ // Primary yAxis
            labels: {
                format: '{value}',
                style: {
                    color: Highcharts.getOptions().colors[1]
                }
            },
            title: {
                text: '数值',
                style: {
                    color: Highcharts.getOptions().colors[1]
                }
            }
        }, { // Secondary yAxis
            title: {
                text: '百分比',
                style: {
                    color: Highcharts.getOptions().colors[1]
                }
            },
            labels: {
                format: '{value} %',
                style: {
                    color: Highcharts.getOptions().colors[1]
                }
            },
            opposite: true
        }],
        plotOptions: {
            line: {
                dataLabels: {
                    enabled: true
                },
                enableMouseTracking: false
            }
        },
        series: [{
            name: '内购收入',
            data: [<?php 
            	foreach($logPayData['data'] as $day => $row){
            		if(empty($row['gamesIncome'])){
            			echo "0,";
            		}else{
            			echo $row['gamesIncome'].",";
            		}
            	}
            ?>]
        },{
            name: '广告收入',
            data: [<?php 
            	foreach($logPayData['data'] as $day => $row){
            		if(empty($row['advertIncome'])){
            			echo "0,";
            		}else{
            			echo $row['advertIncome'].",";
            		}
            	}
            ?>]
        },{
            name: '市场花费',
            data: [<?php 
            	foreach($logPayData['data'] as $day => $row){
            		if(empty($row['marketPay'])){
            			echo "0,";
            		}else{
            			echo $row['marketPay'].",";
            		}
            	}
            ?>]
        }]
    });
</script>