<div class="jumbotron">
        <h1><?php 
echo $user;
?>
</h1>
        <p class="lead">Recent Activity</p>
        <?php 
//Get our current month and year.
$endMonth = intval(date('m'));
$endYear = intval(date('Y'));
$startMonth = $endMonth;
$startYear = $endYear - 1;
//Draw our graph.
$data = getTweetsForIntervalByUsernameAsArray($user, $startMonth, $startYear, $endMonth, $endYear);
$graph = new GraphWrapper("tweetsOverYear", $data, 'date', ['numTweets'], 'date', ['Tweets']);
echo $graph->getChart();
echo "<br/>";
echo "<p class='lead'>Keys</p>";
echo "<br/>";
$model = new KeyConnections();
echo $this->render('/key-connections/_form', ['model' => $model]);
$userId = User::find()->where(['username' => $user])->one()->id;
//Draw our keys.
$dataProvider = new ActiveDataProvider(['query' => KeyConnections::find()->where(['owner' => $userId])]);
echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'name', 'text', ['class' => 'yii\\grid\\ActionColumn', 'controller' => 'key-connections']]]);
?>
    </div>
</div>

    <div class="jumbotron">
        <h1>Most Active Users</h1>
        <?php 
//Get our current month and year.
$endMonth = intval(date('m'));
$endYear = intval(date('Y'));
$startMonth = $endMonth;
$startYear = $endYear - 1;
//Draw our graph.
$data = getTopUsersForInterval($startMonth, $startYear, $endMonth, $endYear);
$donut = new GraphWrapper("topusersoveryear", $data, 'date');
echo $donut->getDonut(325);
?>
        <?php 
$data = getTopUserTweetsForIntervalAsArray($startMonth, $startYear, $endMonth, $endYear);
$multiGraph = new GraphWrapper("topUserActivity", $data, 'date', getTopUsers($startMonth, $startYear, $endMonth, $endYear), 'date', getTopUsers($startMonth, $startYear, $endMonth, $endYear));
echo $multiGraph->getChart();
?>
    </div>
</div>







<?php 
class GraphWrapper
{
    private $data;