How to use graph_key_height method of pts_graph_lines class

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

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 }...

Full Screen

Full Screen

graph_key_height

Using AI Code Generation

copy

Full Screen

1$graph = new pts_graph_lines(800, 600);2$graph->set_graph_title('Graph Title');3$graph->set_graph_label('X-Axis Label', 'Y-Axis Label');4$graph->set_graph_key_height(20);5$graph->set_graph_key_width(100);6$graph->set_graph_key_position(100, 100);7$graph->set_graph_key_color('000000');8$graph->set_graph_key_font('000000', 10);9$graph->set_graph_key_font('000000', 10, 'bold');10$graph->set_graph_key_font('000000', 10, 'italic');11$graph->set_graph_key_font('000000', 10, 'bold italic');12$graph->set_graph_font('000000', 10);13$graph->set_graph_font('000000', 10, 'bold');14$graph->set_graph_font('000000', 10, 'italic');15$graph->set_graph_font('000000', 10, 'bold italic');16$graph->set_graph_background_color('FFFFFF');17$graph->set_graph_background_color('FFFFFF', 'FFFFFF');18$graph->set_graph_background_color('FFFFFF', 'FFFFFF', 'FFFFFF');19$graph->set_graph_background_color('FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF');20$graph->set_graph_background_color('FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF');21$graph->set_graph_background_color('FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF');22$graph->set_graph_background_color('FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF');23$graph->set_graph_background_color('FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF');24$graph->set_graph_background_color('FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF');25$graph->set_graph_background_color('FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF');26$graph->set_graph_background_color('FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF', 'FFFFFF');27$graph->set_graph_background_color('FFFFFF',

Full Screen

Full Screen

graph_key_height

Using AI Code Generation

copy

Full Screen

1require_once('pts_graph_lines.php');2$graph = new pts_graph_lines();3$graph->graph_key_height(20);4$graph->graph_key_width(200);5$graph->graph_title('Graph Title');6$graph->graph_y_title('Y Title');7$graph->graph_x_title('X Title');8$graph->graph_x_title('X Title');9$graph->graph_x_data(array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'));10$graph->graph_y_data(array(1,2,3,4,5,6,7,8,9,10,11,12), 'line1', 'Line 1');11$graph->graph_y_data(array(1,2,3,4,5,6,7,8,9,10,11,12), 'line2', 'Line 2');12$graph->graph_y_data(array(1,2,3,4,5,6,7,8,9,10,11,12), 'line3', 'Line 3');13$graph->graph_y_data(array(1,2,3,4,5,6,7,8,9,10,11,12), 'line4', 'Line 4');14$graph->graph_y_data(array(1,2,3,4,5,6,7,8,9,10,11,12), 'line5', 'Line 5');15$graph->graph_y_data(array(1,2,3,4,5,6,7,8,9,10,11,12), 'line6', 'Line 6');16$graph->graph_y_data(array(1,2,3,4,5,6,7,8,9,10,11,12), 'line7', 'Line 7');17$graph->graph_y_data(array(1,2,3,4,5,6,7,8,9,10,11,12), 'line8', 'Line 8');18$graph->graph_y_data(array(1,2,3,4,5,6,7,8,9,10,11,12), 'line9', 'Line 9');19$graph->graph_y_data(array(1,2,3,4,5,6,7,8,

Full Screen

Full Screen

graph_key_height

Using AI Code Generation

copy

Full Screen

1include_once("pts/pts_graph_lines.php");2$graph = new pts_graph_lines();3$graph->graph_key_height(20);4$graph->draw_graph();5$graph->display_graph();6include_once("pts/pts_graph_lines.php");7$graph = new pts_graph_lines();8$graph->graph_key_width(100);9$graph->draw_graph();10$graph->display_graph();11include_once("pts/pts_graph_lines.php");12$graph = new pts_graph_lines();13$graph->graph_key_color("red");14$graph->draw_graph();15$graph->display_graph();

Full Screen

Full Screen

graph_key_height

Using AI Code Generation

copy

Full Screen

1$graph = new pts_graph_lines();2$graph->set_key_labels(array('1', '2', '3', '4', '5', '6', '7'));3$graph->set_key_height(40);4$graph->set_key_width(20);5$graph->set_key_position('r');6$graph->set_key_border('tb');7$graph->set_key_border_color('red');8$graph->set_key_background_color('green');9$graph->set_key_font_size(10);10$graph->set_key_font_color('blue');11$graph->set_key_font('Arial');12$graph->set_key_margin('10');13$graph->set_key_padding('10');14$graph->set_key_round('5');15$graph->set_key_shadow('gray');16$graph->set_key_transparency(50);17$graph->set_key_outline_color('red');18$graph->set_key_outline_thickness('2');19$graph->set_key_outline_style('dashed');20$graph->set_key_gradient_color('green');21$graph->set_key_gradient_style('horizontal');22$graph->set_key_gradient_angle(45);23$graph->set_key_gradient_position(0.5);24$graph->set_key_gradient_type('radial');25$graph->set_key_gradient_smoothness('10');26$graph->set_key_gradient_start_color('red');27$graph->set_key_gradient_end_color('green');

Full Screen

Full Screen

graph_key_height

Using AI Code Generation

copy

Full Screen

1include("pts_graph_lines.php");2$graph = new pts_graph_lines();3$graph->graph_key_height(30);4$graph->graph_title("Graph Title");5$graph->graph_x_title("X Axis Title");6$graph->graph_y_title("Y Axis Title");7$graph->graph_x_values(array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"));8$graph->graph_y_values(array(0,10,20,30,40,50,60,70,80,90,100));9$graph->graph_add_data(array(0,10,20,30,40,50,60,70,80,90,100), "blue", "Data Set 1");10$graph->graph_add_data(array(100,90,80,70,60,50,40,30,20,10,0), "red", "Data Set 2");11$graph->graph_out();12include("pts_graph_lines.php");13$graph = new pts_graph_lines();14$graph->graph_key_position("left");15$graph->graph_title("Graph Title");16$graph->graph_x_title("X Axis Title");17$graph->graph_y_title("Y Axis Title");18$graph->graph_x_values(array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"));19$graph->graph_y_values(array(0,10,20,30,40,50,60,70,80,

Full Screen

Full Screen

graph_key_height

Using AI Code Generation

copy

Full Screen

1$graph_key_height = 20;2$graph = new pts_graph_lines($graph_key_height);3$graph->set_title('Graph Title');4$graph->set_title_font_size(20);5$graph->set_title_font_color('blue');6$graph->set_title_font('Arial');7$graph->set_title_font_style('bold');8$graph->set_title_font_weight('bold');9$graph->set_title_font_variant('small-caps');10$graph->set_title_font_decoration('underline');11$graph->set_x_label('X Label');12$graph->set_x_label_font_size(16);13$graph->set_x_label_font_color('green');14$graph->set_x_label_font('Arial');15$graph->set_x_label_font_style('italic');16$graph->set_x_label_font_weight('bold');17$graph->set_x_label_font_variant('small-caps');18$graph->set_x_label_font_decoration('underline');19$graph->set_x_axis_font_size(12);20$graph->set_x_axis_font_color('red');21$graph->set_x_axis_font('Arial');22$graph->set_x_axis_font_style('italic');23$graph->set_x_axis_font_weight('bold');24$graph->set_x_axis_font_variant('small-caps');25$graph->set_x_axis_font_decoration('underline');26$graph->set_x_axis_2_label('X Label 2');27$graph->set_x_axis_2_label_font_size(12);28$graph->set_x_axis_2_label_font_color('red');29$graph->set_x_axis_2_label_font('Arial');30$graph->set_x_axis_2_label_font_style('italic');31$graph->set_x_axis_2_label_font_weight('bold');32$graph->set_x_axis_2_label_font_variant('small-caps');33$graph->set_x_axis_2_label_font_decoration('underline');34$graph->set_x_axis_2_font_size(12);35$graph->set_x_axis_2_font_color('red');36$graph->set_x_axis_2_font('Arial');37$graph->set_x_axis_2_font_style('italic');38$graph->set_x_axis_2_font_weight('bold');39$graph->set_x_axis_2_font_variant('small-caps');40$graph->set_x_axis_2_font_decoration('underline');41$graph->set_y_label('Y Label');

Full Screen

Full Screen

graph_key_height

Using AI Code Generation

copy

Full Screen

1require_once(PTS_CORE . 'pts_graph_lines.php');2$graph = new pts_graph_lines();3$graph->load_data(array(array('a', 1, 2, 3, 4, 5), array('b', 5, 4, 3, 2, 1), array('c', 2, 3, 4, 5, 6)));4$graph->graph_key_height(100);5$graph->render_graph();6$graph->display_graph();7$graph->add_title('Example 2');8$graph->display_graph();9$graph->add_legend();10$graph->display_graph();11$graph->add_title('Example 2');12$graph->display_graph();13$graph->graph_key_height(100);14$graph->display_graph();15$graph->add_grid();16$graph->display_graph();17$graph->add_shadow();18$graph->display_graph();19$graph->add_background();20$graph->display_graph();21$graph->add_border();22$graph->display_graph();23$graph->add_footer();24$graph->display_graph();25$graph->add_logo();26$graph->display_graph();

Full Screen

Full Screen

graph_key_height

Using AI Code Generation

copy

Full Screen

1$graph = new pts_graph_lines();2$graph->set_graph_key_height(40);3$graph->render_graph($data_array);4$graph = new pts_graph_lines();5$graph->set_graph_key_height(100);6$graph->render_graph($data_array);7$graph = new pts_graph_lines();8$graph->set_graph_key_height(200);9$graph->render_graph($data_array);10$graph = new pts_graph_lines();11$graph->set_graph_key_height(300);12$graph->render_graph($data_array);13$graph = new pts_graph_lines();14$graph->set_graph_key_height(400);15$graph->render_graph($data_array);16$graph = new pts_graph_lines();17$graph->set_graph_key_height(500);18$graph->render_graph($data_array);19$graph = new pts_graph_lines();20$graph->set_graph_key_height(600);21$graph->render_graph($data_array);

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 graph_key_height code on LambdaTest Cloud Grid

Execute automation tests with graph_key_height 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