*/
    ?>
<h2>Pattern Difficulty Graph (<?php 
    echo $programmatically_derived_interval;
    ?>
s sections)</h2>
<p>Hover for applied difficulty at current time</p>
<div id="graph">
	<?php 
    // ---------- NPS GRAPH GENERATION STARTS HERE ---------- //
    //$column_distributions_auto['nps_factored_with_pattern_analysis'] = ahrens_moving_average($column_distributions_auto['nps_factored_with_pattern_analysis'], 20, count($column_distributions_auto['nps_factored_with_pattern_analysis']));
    $simple_pattern_graph_array = array();
    foreach ($new_stamina_difficulties as $val) {
        array_push($simple_pattern_graph_array, $val['expected_difficulty']);
    }
    $simple_pattern_graph_array = ahrens_moving_average($simple_pattern_graph_array, 5, count($simple_pattern_graph_array));
    $column_widths = 100 / count($simple_pattern_graph_array);
    $left = 0;
    $peak = 0;
    foreach ($simple_pattern_graph_array as $key => $val) {
        if ($val > $peak) {
            $peak = $val;
        }
    }
    foreach ($simple_pattern_graph_array as $second => $graph_row) {
        ?>
			<?php 
        $height = $graph_row / $peak * 100;
        $left += $column_widths;
        ?>
			<div class="bar has-tip" data-tooltip aria-haspopup="true" title="<?php 
 protected function _get_simple_expected_difficulty_array($column_distributions)
 {
     $simple_array = array();
     $simple_array_diff = array();
     $simple_array_points = array();
     foreach ($column_distributions as $val) {
         $interval_array = array();
         $interval_array['expected_difficulty'] = $val['expected_difficulty'];
         $interval_array['dance_points'] = $val['points'];
         array_push($simple_array_diff, $val['expected_difficulty']);
         array_push($simple_array_points, $val['points']);
     }
     $simple_array_diff = ahrens_moving_average($simple_array_diff, 2, count($simple_array_diff));
     foreach ($simple_array_diff as $key => $val) {
         $simple_array[$key] = array('expected_difficulty' => isset($simple_array_diff[$key]) ? $simple_array_diff[$key] : 0, 'dance_points' => isset($simple_array_points[$key]) ? $simple_array_points[$key] : 0);
     }
     return $simple_array;
 }