How to use getStatisticsHeaderHeight method of pts_graph_lines class

Best Phoronix-test-suite code snippet using pts_graph_lines.getStatisticsHeaderHeight

pts_graph_lines.php

Source:pts_graph_lines.php Github

copy

Full Screen

...175 $precision = $this->i['graph_max_value'] > 999 ? 0 : 1;176 $num_rows = max(1, ceil($this->test_result->test_result_buffer->get_count() / $this->i['keys_per_line']));177 $num_cols = ceil($this->test_result->test_result_buffer->get_count() / $num_rows);178 $y_start = $this->i['top_heading_height'] + 24;179 //$y_start = $this->i['top_start'] - $this->graph_key_height() + $this->getStatisticsHeaderHeight();180 $y_end = $y_start + $this->i['key_line_height'] * ($num_rows );181 $x_start = $this->i['left_start'];182 $x_end = $x_start + $this->i['key_item_width'] * ($num_cols - 1);183 // draw the "Min Avg Max" text184 $stat_header_offset = $this->i['key_longest_string_width'] + $square_length + 10;185 $g_text = $this->svg_dom->make_g(array('font-size' => 6.5, 'fill' => self::$c['color']['notches']));186 for($x = $x_start + $stat_header_offset; $x <= $x_end + $stat_header_offset; $x += $this->i['key_item_width'])187 {188 $stat_words = array('Min', 'Avg', 'Max');189 $stat_word_width = $this->get_stat_word_width();190 $attributes = array('y' => $y_start - 14);191 foreach($stat_words as &$stat_word)192 {193 $attributes['x'] = $x;194 $this->svg_dom->add_text_element($stat_word, $attributes, $g_text);195 $x += $stat_word_width;196 }197 }198 // draw the keys and the min,avg,max values199 $g_rect = $this->svg_dom->make_g(array('stroke' => self::$c['color']['notches'], 'stroke-width' => 1));200 for($i = 0, $x = $x_start; $x <= $x_end; $x += $this->i['key_item_width'])201 {202 for ($y = $y_start; $y <= $y_end; $y += $this->i['key_line_height'], ++$i)203 {204 if(!isset($this->test_result->test_result_buffer->buffer_items[$i]))205 {206 break;207 }208 $identifier_title = $this->test_result->test_result_buffer->buffer_items[$i]->get_result_identifier();209 $this_color = $this->get_paint_color($identifier_title);210 // draw square211 $this->svg_dom->add_element('rect',212 array('x' => $x, 'y' => $y - $square_length, 'width' => $square_length,213 'height' => $square_length, 'fill' => $this_color), $g_rect);214 // draw text215 $g_text = $this->svg_dom->make_g(array('font-size' => self::$c['size']['key'], 'fill' => $this_color));216 $this->svg_dom->add_text_element($identifier_title, array('x' => $x + $square_length + 4, 'y' => $y), $g_text);217 // draw min/avg/max218 $x_stat_loc = $x + $square_length + $this->i['key_longest_string_width'] + 10;219 $vals = $this->test_result->test_result_buffer->buffer_items[$i]->get_result_value();220 $attributes = array('y' => $y);221 $stat_word_width = $this->get_stat_word_width();222 $stat_array = $this->calc_min_avg_max($vals);223 $precise_stat_array = array();224 foreach($stat_array as $stat_value)225 {226 if(is_string($stat_value))227 {228 // TODO investigate this case...229 // sometimes $stat_value is string of comma separated values230 $precise_stat_array[] = $stat_value;231 }232 else233 {234 $precise_stat_array[] = pts_math::set_precision($stat_value, $precision);235 }236 }237 $attributes['x'] = $x_stat_loc;238 foreach($precise_stat_array as $stat_value)239 {240 $this->svg_dom->add_text_element(strval($stat_value), $attributes, $g_text);241 $attributes['x'] += $stat_word_width;242 }243 }244 }245 }246 private static function calc_min_avg_max(&$data_set)247 {248 if(empty($data_set))249 {250 return array(0, 0, 0);251 }252 $min_value = min($data_set);253 $max_value = max($data_set);254 $avg_value = array_sum($data_set) / count($data_set);255 return array($min_value, $avg_value, $max_value);256 }257 protected function renderGraphLines()258 {259 $prev_value = 0;260 foreach($this->test_result->test_result_buffer->buffer_items as &$buffer_item)261 {262 $paint_color = $this->get_paint_color($buffer_item->get_result_identifier());263 $result_array = $buffer_item->get_result_value();264 $raw_array = $buffer_item->get_result_raw();265 $point_counter = count($result_array);266 $regression_plots = array();267 $poly_points = array();268 $g = $this->svg_dom->make_g(array('stroke' => $paint_color, 'stroke-width' => 1, 'fill' => $paint_color));269 for($i = 0; $i < $point_counter; $i++)270 {271 $value = isset($result_array[$i]) ? $result_array[$i] : -1;272 if($value < 0)273 {274 // Draw whatever is needed of the line so far, since there is no result here275 $this->draw_graph_line_process($poly_points, $paint_color, $regression_plots, $point_counter, $g);276 continue;277 }278 $identifier = $buffer_item->get_result_identifier();279 $std_error = isset($raw_array[$i]) ? pts_math::standard_error(pts_strings::colon_explode($raw_array[$i])) : 0;280 $data_string = $identifier . ': ' . $value;281 $value_plot_top = $this->i['graph_top_end'] + 1 - ($this->i['graph_max_value'] == 0 ? 0 : round(($value / $this->i['graph_max_value']) * ($this->i['graph_top_end'] - $this->i['top_start'])));282 $px_from_left = round($this->i['left_start'] + ($this->i['identifier_width'] * ($i + (count($this->graph_identifiers) > 1 ? 1 : 0))));283 if($px_from_left > $this->i['graph_left_end'])284 {285 break;286 }287 if($value_plot_top >= $this->i['graph_top_end'])288 {289 $value_plot_top = $this->i['graph_top_end'] - 1;290 }291 $poly_points[] = array($px_from_left, $value_plot_top, $data_string, $std_error);292 if(isset($this->d['regression_marker_threshold']) && $this->d['regression_marker_threshold'] > 0 && $i > 0 && abs(1 - ($value / $prev_value)) > $this->d['regression_marker_threshold'])293 {294 $regression_plots[($i - 1)] = $prev_identifier . ': ' . $prev_value;295 $regression_plots[$i] = $identifier . ': ' . $value;296 }297 $prev_identifier = $identifier;298 $prev_value = $value;299 }300 $this->draw_graph_line_process($poly_points, $paint_color, $regression_plots, $point_counter, $g);301 }302 }303 protected function draw_graph_line_process(&$poly_points, &$paint_color, &$regression_plots, $point_counter, &$g)304 {305 $poly_points_count = count($poly_points);306 if($poly_points_count == 0)307 {308 // There's nothing to draw309 return;310 }311 $svg_poly = array();312 foreach($poly_points as $x_y)313 {314 $svg_poly[] = round($x_y[0]) . ',' . round($x_y[1]);315 }316 $svg_poly = implode(' ', $svg_poly);317 $this->svg_dom->add_element('polyline', array('points' => $svg_poly, 'fill' => 'none', 'stroke-width' => 2), $g);318 // plot error bars if needed319 foreach($poly_points as $i => $x_y_pair)320 {321 if($x_y_pair[0] < ($this->i['left_start'] + 2) || $x_y_pair[0] > ($this->i['graph_left_end'] - 2))322 {323 // Don't draw anything on the left or right hand edges324 continue;325 }326 $plotted_error_bar = false;327 if($x_y_pair[3] > 0 && $this->i['graph_max_value'] != 0)328 {329 $std_error_width = 4;330 $std_error_rel_size = round(($x_y_pair[3] / $this->i['graph_max_value']) * ($this->i['graph_top_end'] - $this->i['top_start']));331 if($std_error_rel_size > 3)332 {333 $this->svg_dom->add_element('line', array('x1' => $x_y_pair[0], 'y1' => ($x_y_pair[1] + $std_error_rel_size), 'x2' => $x_y_pair[0], 'y2' => ($x_y_pair[1] - $std_error_rel_size)), $g);334 $this->svg_dom->add_element('line', array('x1' => ($x_y_pair[0] - $std_error_width), 'y1' => ($x_y_pair[1] - $std_error_rel_size), 'x2' => ($x_y_pair[0] + $std_error_width), 'y2' => ($x_y_pair[1] - $std_error_rel_size)), $g);335 $this->svg_dom->add_element('line', array('x1' => ($x_y_pair[0] - $std_error_width), 'y1' => ($x_y_pair[1] + $std_error_rel_size), 'x2' => ($x_y_pair[0] + $std_error_width), 'y2' => ($x_y_pair[1] + $std_error_rel_size)), $g);336 $plotted_error_bar = true;337 }338 }339 if(isset($regression_plots[$i]) && $i > 0)340 {341 $this->svg_dom->draw_svg_line($x_y_pair[0], $x_y_pair[1] + 6, $x_y_pair[0], $x_y_pair[1] - 6, self::$c['color']['alert'], 4, array('xlink:title' => $regression_plots[$i]));342 }343 if($point_counter < 6 || $plotted_error_bar || $i == 0 || $i == ($poly_points_count - 1))344 {345 $this->svg_dom->add_element('ellipse', array('cx' => $x_y_pair[0], 'cy' => $x_y_pair[1], 'rx' => 3, 'ry' => 3, 'xlink:title' => $x_y_pair[2]), $g);346 }347 }348 $poly_points = array();349 }350 protected function render_graph_result()351 {352 $this->renderGraphLines();353 }354 protected function graph_key_height()355 {356 if(isset($this->i['force_simple_keys']) && $this->i['force_simple_keys'])357 {358 return parent::graph_key_height();359 }360 if($this->test_result->test_result_buffer->get_count() < 2 && $this->i['show_graph_key'] == false)361 {362 return 0;363 }364 $this->i['key_line_height'] = 16;365 $this->i['key_longest_string_width'] = self::text_string_width($this->test_result->test_result_buffer->get_longest_identifier(), self::$c['size']['key']);366 $item_width_spacing = 32;367 $this->i['key_item_width'] = $this->i['key_longest_string_width'] + $this->get_stat_word_width() * 3 + $item_width_spacing;368 // if there are <=4 data sets, then use a single column, otherwise, try and multi-col it369 if($this->test_result->test_result_buffer->get_count() < 3)370 {371 $this->i['keys_per_line'] = 1;372 }373 else374 {375 $this->i['keys_per_line'] = max(1, floor(($this->i['graph_left_end'] - $this->i['left_start']) / $this->i['key_item_width']));376 }377 $statistics_header_height = $this->getStatisticsHeaderHeight();378 $extra_spacing = 16;379 return ceil($this->test_result->test_result_buffer->get_count() / $this->i['keys_per_line']) * $this->i['key_line_height']380 + $statistics_header_height + $extra_spacing;381 }382 private function get_stat_word_width()383 {384 return ceil(2.6 * self::text_string_width($this->i['graph_max_value'] + 0.1, $this->i['min_identifier_size'] + 0.5));385 }386 private function getStatisticsHeaderHeight()387 {388 return $this->i['plot_overview_text'] ? 10 : 0;389 }390}391?>...

Full Screen

Full Screen

getStatisticsHeaderHeight

Using AI Code Generation

copy

Full Screen

1$graph = new pts_graph_lines();2$graph->set_title('Graph Title');3$graph->set_x_label('X Axis');4$graph->set_y_label('Y Axis');5$graph->set_x_label_type('string');6$graph->set_y_label_type('string');7$graph->set_x_data(array('1','2','3'));8$graph->set_y_data(array('1','2','3'));9$graph->set_data_label('Data Label');10$graph->set_data_label_type('string');11$graph->set_data_label_position('top');12$graph->set_data_label_color('red');13$graph->set_data_label_font_size(10);14$graph->set_data_label_font('Arial');15$graph->set_data_label_font_weight('bold');16$graph->set_data_label_font_style('italic');17$graph->set_data_label_font_decoration('underline');18$graph->set_data_label_background_color('blue');19$graph->set_data_label_background_opacity(0.5);20$graph->set_data_label_rounded(5);21$graph->set_data_label_border_color('green');22$graph->set_data_label_border_width(2);23$graph->set_data_label_border_style('dashed');24$graph->set_data_label_padding(5);25$graph->set_data_label_margin(5);26$graph->set_data_label_shadow_color('black');27$graph->set_data_label_shadow_offset(5);28$graph->set_data_label_shadow_opacity(0.5);29$graph->set_data_label_shadow_blur_radius(5);30$graph->set_data_label_outline_color('orange');31$graph->set_data_label_outline_offset(5);32$graph->set_data_label_outline_opacity(0.5);33$graph->set_data_label_outline_blur_radius(5);34$graph->set_data_label_line_height(20);35$graph->set_data_label_word_wrap(20);36$graph->set_data_label_word_wrap_hyphenate(true);37$graph->set_data_label_word_wrap_hyphenate_character('-');38$graph->set_data_label_word_wrap_hyphenate_limit(3);39$graph->set_data_label_word_wrap_hyphenate_min_before(3);40$graph->set_data_label_word_wrap_hyphenate_min_after(3);41$graph->set_data_label_word_wrap_hyphenate_min_word_length(5);42$graph->set_data_label_word_wrap_hyphenate_language('

Full Screen

Full Screen

getStatisticsHeaderHeight

Using AI Code Generation

copy

Full Screen

1include 'pts_graph_lines.php';2$pts_graph_lines = new pts_graph_lines();3$pts_graph_lines->setGraphTitle('Graph Title');4$pts_graph_lines->setGraphSubTitle('Graph Sub Title');5$pts_graph_lines->setGraphTitleColor('000000');6$pts_graph_lines->setGraphTitleSize(12);7$pts_graph_lines->setGraphSubTitleColor('000000');8$pts_graph_lines->setGraphSubTitleSize(10);9$pts_graph_lines->setGraphTitleFont('Arial');10$pts_graph_lines->setGraphSubTitleFont('Arial');11$pts_graph_lines->setGraphTitleFontStyle('bold');12$pts_graph_lines->setGraphSubTitleFontStyle('bold');13$pts_graph_lines->setGraphTitleFontStyle('italic');14$pts_graph_lines->setGraphSubTitleFontStyle('italic');15$pts_graph_lines->setGraphTitleFontStyle('underline');16$pts_graph_lines->setGraphSubTitleFontStyle('underline');17$pts_graph_lines->setGraphTitleFontStyle('strikethrough');18$pts_graph_lines->setGraphSubTitleFontStyle('strikethrough');19$pts_graph_lines->setGraphTitleFontStyle('overline');

Full Screen

Full Screen

getStatisticsHeaderHeight

Using AI Code Generation

copy

Full Screen

1require_once('pts_graph_lines.php');2$graph = new pts_graph_lines();3echo $graph->getStatisticsHeaderHeight();4require_once('pts_graph_lines.php');5$graph = new pts_graph_lines();6$graph->setGraphTitle('Graph Title');7echo $graph->getStatisticsHeaderHeight();8require_once('pts_graph_lines.php');9$graph = new pts_graph_lines();10$graph->setGraphTitle('Graph Title');11$graph->setGraphSubTitle('Graph Sub Title');12echo $graph->getStatisticsHeaderHeight();13require_once('pts_graph_lines.php');14$graph = new pts_graph_lines();15$graph->setGraphTitle('Graph Title');16$graph->setGraphSubTitle('Graph Sub Title');17$graph->setGraphSubTitle2('Graph Sub Title 2');18echo $graph->getStatisticsHeaderHeight();19require_once('pts_graph_lines.php');20$graph = new pts_graph_lines();21$graph->setGraphTitle('Graph Title');22$graph->setGraphSubTitle('Graph Sub Title');23$graph->setGraphSubTitle2('Graph Sub Title 2');24$graph->setGraphSubTitle3('Graph Sub Title 3');25echo $graph->getStatisticsHeaderHeight();26require_once('pts_graph_lines.php');27$graph = new pts_graph_lines();28$graph->setGraphTitle('Graph Title');29$graph->setGraphSubTitle('Graph Sub Title');30$graph->setGraphSubTitle2('Graph Sub Title 2');31$graph->setGraphSubTitle3('

Full Screen

Full Screen

getStatisticsHeaderHeight

Using AI Code Generation

copy

Full Screen

1$graph = new pts_graph_lines();2$graph->set_graph_title('Graph Title');3$graph->set_graph_title_position(50);4$graph->set_graph_title_font_size(20);5$graph->set_graph_title_color('green');6$graph->set_graph_title_background_color('yellow');7$graph->set_graph_title_border_color('red');8$graph->set_graph_title_border_size(5);9$graph->set_graph_title_border_style('dashed');10$graph->set_graph_title_border_radius(15);11$graph->set_graph_title_padding(10);12$graph->set_graph_title_margin(15);13$graph->set_graph_title_opacity(0.5);14$graph->set_graph_title_box_shadow('10px 10px 5px grey');15$graph->set_graph_title_text_shadow('10px 10px 5px grey');16$graph->set_graph_title_font_weight('bold');17$graph->set_graph_title_font_style('italic');18$graph->set_graph_title_text_align('center');19$graph->set_graph_title_text_decoration('underline');20$graph->set_graph_title_text_transform('capitalize');21$graph->set_graph_title_letter_spacing('0.5em');22$graph->set_graph_title_word_spacing('0.5em');23$graph->set_graph_title_line_height('2.5em');24$graph->set_graph_title_font_family('Arial, Helvetica, sans-serif');25$graph->set_graph_title_font_variant('small-caps');26$graph->set_graph_title_direction('rtl');27$graph->set_graph_title_visibility('hidden');28$graph->set_graph_title_white_space('pre');29$graph->set_graph_title_word_wrap('break-word');30$graph->set_graph_title_z_index(10);31$graph->set_graph_title_vertical_align('middle');32$graph->set_graph_title_float('left');33$graph->set_graph_title_clear('both');34$graph->set_graph_title_display('block');35$graph->set_graph_title_position_type('fixed');36$graph->set_graph_title_position_top(50);37$graph->set_graph_title_position_right(100);38$graph->set_graph_title_position_bottom(150);39$graph->set_graph_title_position_left(200);40$graph->set_graph_title_overflow('scroll');41$graph->set_graph_title_cursor('pointer');42$graph->set_graph_title_clip('rect(0px, 100px, 100px, 0px)');

Full Screen

Full Screen

getStatisticsHeaderHeight

Using AI Code Generation

copy

Full Screen

1$graph = new pts_graph_lines();2$height = $graph->getStatisticsHeaderHeight();3echo $height;4pts_graph_lines::getStatisticsHeaderHeight()5public function getStatisticsHeaderHeight()6$graph = new pts_graph_lines();7$height = $graph->getStatisticsHeaderHeight();8echo $height;

Full Screen

Full Screen

getStatisticsHeaderHeight

Using AI Code Generation

copy

Full Screen

1include_once('pts_graph_lines.php');2$obj = new pts_graph_lines();3$obj->getStatisticsHeaderHeight();4Recommended Posts: PHP | imagecolorallocate() Function5PHP | imagecolorallocatealpha() Function6PHP | imagecolorat() Function7PHP | imagecolorclosest() Function8PHP | imagecolorclosestalpha() Function9PHP | imagecolorclosesthwb() Function10PHP | imagecolordeallocate() Function11PHP | imagecolorexact() Function12PHP | imagecolorexactalpha() Function13PHP | imagecolormatch() Function14PHP | imagecolorresolve() Function15PHP | imagecolorresolvealpha() Function16PHP | imagecolorset() Function17PHP | imagecolorsforindex() Function18PHP | imagecolorstotal() Function19PHP | imagecolortransparent() Function20PHP | imageconvolution() Function21PHP | imagecopy() Function22PHP | imagecopymerge() Function23PHP | imagecopymergegray() Function24PHP | imagecopyresampled() Function25PHP | imagecopyresized() Function26PHP | imagecreate() Function27PHP | imagecreatefromgd() Function28PHP | imagecreatefromgd2() Function29PHP | imagecreatefromgd2part() Function30PHP | imagecreatefromgif() Function31PHP | imagecreatefromjpeg() Function32PHP | imagecreatefrompng() Function33PHP | imagecreatefromstring() Function34PHP | imagecreatefromwbmp() Function35PHP | imagecreatefromwebp() Function36PHP | imagecreatefromxbm() Function37PHP | imagecreatefromxpm() Function38PHP | imagecreatetruecolor() Function39PHP | imagecrop() Function40PHP | imagecropauto() Function41PHP | imagedashedline() Function42PHP | imagedestroy() Function43PHP | imageellipse() Function44PHP | imagefill() Function45PHP | imagefilledarc() Function

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Phoronix-test-suite automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Trigger getStatisticsHeaderHeight code on LambdaTest Cloud Grid

Execute automation tests with getStatisticsHeaderHeight on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful