protected function render_graph_key()
 {
     if (isset($this->i['force_simple_keys']) && $this->i['force_simple_keys']) {
         return parent::render_graph_key();
     }
     if (!$this->i['plot_overview_text']) {
         return;
     }
     if ($this->i['key_line_height'] == 0) {
         return;
     }
     $square_length = 10;
     $precision = $this->i['graph_max_value'] > 999 ? 0 : 1;
     $num_rows = max(1, ceil($this->test_result->test_result_buffer->get_count() / $this->i['keys_per_line']));
     $num_cols = ceil($this->test_result->test_result_buffer->get_count() / $num_rows);
     $y_start = $this->i['top_heading_height'] + 24;
     //$y_start = $this->i['top_start'] - $this->graph_key_height() + $this->getStatisticsHeaderHeight();
     $y_end = $y_start + $this->i['key_line_height'] * $num_rows;
     $x_start = $this->i['left_start'];
     $x_end = $x_start + $this->i['key_item_width'] * ($num_cols - 1);
     // draw the "Min Avg Max" text
     $stat_header_offset = $this->i['key_longest_string_width'] + $square_length + 10;
     $g_text = $this->svg_dom->make_g(array('font-size' => 6.5, 'fill' => self::$c['color']['notches']));
     for ($x = $x_start + $stat_header_offset; $x <= $x_end + $stat_header_offset; $x += $this->i['key_item_width']) {
         $stat_words = array('Min', 'Avg', 'Max');
         $stat_word_width = $this->get_stat_word_width();
         $attributes = array('y' => $y_start - 14);
         foreach ($stat_words as &$stat_word) {
             $attributes['x'] = $x;
             $this->svg_dom->add_text_element($stat_word, $attributes, $g_text);
             $x += $stat_word_width;
         }
     }
     // draw the keys and the min,avg,max values
     $g_rect = $this->svg_dom->make_g(array('stroke' => self::$c['color']['notches'], 'stroke-width' => 1));
     for ($i = 0, $x = $x_start; $x <= $x_end; $x += $this->i['key_item_width']) {
         for ($y = $y_start; $y <= $y_end; $y += $this->i['key_line_height'], ++$i) {
             if (!isset($this->test_result->test_result_buffer->buffer_items[$i])) {
                 break;
             }
             $identifier_title = $this->test_result->test_result_buffer->buffer_items[$i]->get_result_identifier();
             $this_color = $this->get_paint_color($identifier_title);
             // draw square
             $this->svg_dom->add_element('rect', array('x' => $x, 'y' => $y - $square_length, 'width' => $square_length, 'height' => $square_length, 'fill' => $this_color), $g_rect);
             // draw text
             $g_text = $this->svg_dom->make_g(array('font-size' => self::$c['size']['key'], 'fill' => $this_color));
             $this->svg_dom->add_text_element($identifier_title, array('x' => $x + $square_length + 4, 'y' => $y), $g_text);
             // draw min/avg/max
             $x_stat_loc = $x + $square_length + $this->i['key_longest_string_width'] + 10;
             $vals = $this->test_result->test_result_buffer->buffer_items[$i]->get_result_value();
             $attributes = array('y' => $y);
             $stat_word_width = $this->get_stat_word_width();
             $stat_array = $this->calc_min_avg_max($vals);
             $precise_stat_array = array();
             foreach ($stat_array as $stat_value) {
                 array_push($precise_stat_array, pts_math::set_precision($stat_value, $precision));
             }
             $attributes['x'] = $x_stat_loc;
             foreach ($precise_stat_array as $stat_value) {
                 $this->svg_dom->add_text_element(strval($stat_value), $attributes, $g_text);
                 $attributes['x'] += $stat_word_width;
             }
         }
     }
 }