How to use pts_graph_core class

Best Phoronix-test-suite code snippet using pts_graph_core

pts_render.php

Source:pts_render.php Github

copy

Full Screen

...32 if($object instanceof pts_test_result)33 {34 $graph = self::render_graph_process($object, $result_file, false, $extra_attributes);35 }36 else if($object instanceof pts_graph_core)37 {38 $graph = $object;39 }40 else41 {42 return false;43 }44 if($graph == false)45 {46 return false;47 }48 $graph->renderGraph();49 $graph = $graph->svg_dom->output(null, $output_format);50 switch($output_format)51 {52 case 'PNG':53 case 'JPG':54 if($nested)55 {56 $graph = '<img src="data:image/png;base64,' . base64_encode($graph) . '" />';57 }58 else59 {60 header('Content-Type: image/' . strtolower($output_format));61 }62 break;63 case 'HTML':64 break;65 default:66 case 'SVG':67 if($nested)68 {69 // strip out any DOCTYPE and other crud that would be redundant, so start at SVG tag70 $graph = substr($graph, strpos($graph, '<svg'));71 }72 else73 {74 header('Content-type: image/svg+xml');75 }76 break;77 }78 return $graph;79 }80 public static function render_graph_process(&$result_object, &$result_file = null, $save_as = false, $extra_attributes = null)81 {82 // NOTICE: $save_as doesn't appear used anymore83 if(isset($extra_attributes['clear_unchanged_results']))84 {85 $result_object->remove_unchanged_results();86 }87 if(isset($extra_attributes['clear_noisy_results']))88 {89 $result_object->remove_noisy_results();90 }91 if(isset($extra_attributes['sort_result_buffer']))92 {93 $result_object->test_result_buffer->sort_buffer_items();94 }95 if(isset($extra_attributes['normalize_result_buffer']))96 {97 if(isset($extra_attributes['highlight_graph_values']) && is_array($extra_attributes['highlight_graph_values']) && count($extra_attributes['highlight_graph_values']) == 1)98 {99 $normalize_against = $extra_attributes['highlight_graph_values'][0];100 }101 else102 {103 $normalize_against = false;104 }105 $result_object->normalize_buffer_values($normalize_against, $extra_attributes);106 }107 if(isset($extra_attributes['sort_result_buffer_values']))108 {109 $result_object->sort_results_by_performance();110 }111 /*if(isset($extra_attributes['remove_noisy_results']))112 {113 foreach($result_object->test_result_buffer->get_buffer_items() as $i => &$buffer_item)114 {115 }116 }*/117 if(isset($extra_attributes['reverse_result_buffer']))118 {119 $result_object->test_result_buffer->buffer_values_reverse();120 }121 if($result_object->test_result_buffer->get_count() == 0)122 {123 return false;124 }125 $horizontal_bars = pts_graph_core::get_graph_config('style', 'bar_graphs_horizontal') && !isset($extra_attributes['vertical_bars']);126 if($result_file != null)127 {128 // Cache the redundant words on identifiers so it's not re-computed on every graph129 static $redundant_word_cache;130 if(!isset($redundant_word_cache[$result_file->get_title()]))131 {132 $redundant_word_cache[$result_file->get_title()] = self::evaluate_redundant_identifier_words($result_file->get_system_identifiers());133 }134 if($redundant_word_cache[$result_file->get_title()])135 {136 $result_object->test_result_buffer->auto_shorten_buffer_identifiers($redundant_word_cache[$result_file->get_title()]);137 }138 $result_identifiers = $result_object->test_result_buffer->get_identifiers();139 // COMPACT PROCESS140 if(!isset($extra_attributes['compact_to_scalar']) && $result_object->test_profile->get_display_format() == 'LINE_GRAPH' && ($result_file->get_system_count() > 7 || $result_file->is_multi_way_comparison($result_identifiers, $extra_attributes)))141 {142 // If there's too many lines being plotted on line graph, likely to look messy, so convert to scalar automatically143 $extra_attributes['compact_to_scalar'] = true;144 }145 // XXX: removed || $result_file->is_results_tracker() from below and should be added146 // Removing the command fixes cases like: 1210053-BY-MYRESULTS43147 if(isset($extra_attributes['compact_to_scalar']) || isset($extra_attributes['compact_scatter']) || $result_file->is_multi_way_comparison($result_identifiers, $extra_attributes))148 {149 if((isset($extra_attributes['compact_to_scalar']) || (false && $result_file->is_multi_way_comparison($result_identifiers, $extra_attributes))) && in_array($result_object->test_profile->get_display_format(), array('LINE_GRAPH', 'FILLED_LINE_GRAPH')) && pts_graph_core::get_graph_config('style', 'allow_box_plots'))150 {151 // Convert multi-way line graph into horizontal box plot152 $result_object->test_profile->set_display_format('HORIZONTAL_BOX_PLOT');153 }154 if($result_file->is_results_tracker() && !isset($extra_attributes['compact_to_scalar']))155 {156 $extra_attributes['force_tracking_line_graph'] = 1;157 }158 if((self::multi_way_identifier_check($result_object->test_result_buffer->get_identifiers()) || (isset($extra_attributes['force_tracking_line_graph']) && $extra_attributes['force_tracking_line_graph'])))159 {160 //$result_table = false;161 //pts_render::compact_result_file_test_object($result_object, $result_table, $result_file, $extra_attributes);162 if($result_object->test_profile->get_display_format() == 'LINE_GRAPH' || (isset($extra_attributes['force_tracking_line_graph']) && $extra_attributes['force_tracking_line_graph']))163 {164 $result_object->test_profile->set_display_format('LINE_GRAPH');165 }166 }167 }168 if(in_array($result_object->test_profile->get_display_format(), array('LINE_GRAPH')) && !isset($extra_attributes['force_tracking_line_graph']))169 {170 // Check to see for line graphs if every result is an array of the same result (i.e. a flat line for every result).171 // If all the results are just flat lines, you might as well convert it to a bar graph172 $buffer_items = $result_object->test_result_buffer->get_buffer_items();173 $all_values_are_flat = false;174 $big_data_set = 0;175 $flat_values = array();176 foreach($buffer_items as $i => $buffer_item)177 {178 $values_in_buffer = explode(',', $buffer_item->get_result_value());179 $unique_in_buffer = array_unique($values_in_buffer);180 $all_values_are_flat = count($unique_in_buffer) == 1;181 if(isset($values_in_buffer[1200]))182 {183 // if more than 1200 points to plot, likely will be messy so condense it184 $big_data_set++;185 }186 if($all_values_are_flat == false)187 {188 break;189 }190 $flat_values[$i] = array_pop($unique_in_buffer);191 }192 if($all_values_are_flat)193 {194 $result_object->test_result_buffer = new pts_test_result_buffer();195 foreach($buffer_items as $i => $buffer_item)196 {197 $result_object->test_result_buffer->add_test_result($buffer_item->get_result_identifier(), $flat_values[$i]);198 }199 $result_object->test_profile->set_display_format('BAR_GRAPH');200 }201 else if($big_data_set > 0 && pts_graph_core::get_graph_config('style', 'allow_box_plots') && !isset($extra_attributes['no_box_plots']))202 {203 $result_object->test_profile->set_display_format('HORIZONTAL_BOX_PLOT');204 }205 }206 }207 if(isset($extra_attributes['graph_render_type']))208 {209 $result_object->test_profile->set_display_format($extra_attributes['graph_render_type']);210 }211 switch($result_object->test_profile->get_display_format())212 {213 case 'LINE_GRAPH':214 $graph = new pts_graph_lines($result_object, $result_file, $extra_attributes);215 break;216 case 'HORIZONTAL_BOX_PLOT':217 if(pts_graph_core::get_graph_config('style', 'allow_box_plots'))218 {219 $graph = new pts_graph_box_plot($result_object, $result_file, $extra_attributes);220 break;221 }222 case 'BAR_ANALYZE_GRAPH':223 case 'BAR_GRAPH':224 if($horizontal_bars)225 {226 $graph = new pts_graph_horizontal_bars($result_object, $result_file, $extra_attributes);227 }228 else229 {230 $graph = new pts_graph_vertical_bars($result_object, $result_file, $extra_attributes);231 }...

Full Screen

Full Screen

pts_graph_core

Using AI Code Generation

copy

Full Screen

1require_once('pts-core/pts-core.php');2$graph = new pts_graph_core();3$graph->set_graph_dimensions(800, 600);4$graph->set_graph_title('Graph Title');5$graph->set_graph_title_position('left');6$graph->set_graph_title_color('blue');7$graph->set_graph_title_font('arial.ttf');8$graph->set_graph_title_font_size(16);9$graph->set_graph_title_bold(true);10$graph->set_graph_title_italic(true);11$graph->set_graph_title_underline(true);12$graph->set_graph_title_background_color('green');13$graph->set_graph_title_background_transparency(50);14$graph->set_graph_title_border_color('red');15$graph->set_graph_title_border_size(5);16$graph->set_graph_title_border_transparency(50);17$graph->set_graph_title_padding(5);18$graph->set_graph_title_rounded_corners(5);19$graph->set_graph_title_shadow_color('black');20$graph->set_graph_title_shadow_transparency(50);21$graph->set_graph_title_shadow_offset(5);22$graph->set_graph_title_shadow_blur(5);23$graph->set_graph_background_color('green');24$graph->set_graph_background_transparency(50);25$graph->set_graph_background_border_color('red');26$graph->set_graph_background_border_size(5);27$graph->set_graph_background_border_transparency(50);28$graph->set_graph_background_padding(5);29$graph->set_graph_background_rounded_corners(5);30$graph->set_graph_background_shadow_color('black');31$graph->set_graph_background_shadow_transparency(50);32$graph->set_graph_background_shadow_offset(5);33$graph->set_graph_background_shadow_blur(5);34$graph->set_graph_title('Graph Title');35$graph->set_graph_title_position('left');36$graph->set_graph_title_color('blue');37$graph->set_graph_title_font('arial.ttf');38$graph->set_graph_title_font_size(16);39$graph->set_graph_title_bold(true);40$graph->set_graph_title_italic(true);41$graph->set_graph_title_underline(true);42$graph->set_graph_title_background_color('green');43$graph->set_graph_title_background_transparency(50);44$graph->set_graph_title_border_color('red');45$graph->set_graph_title_border_size(5);46$graph->set_graph_title_border_transparency(50);

Full Screen

Full Screen

pts_graph_core

Using AI Code Generation

copy

Full Screen

1require_once('pts-core/pts-core.php');2$graph = new pts_graph_core();3$graph->set_identifier('test');4$graph->set_title('Test');5$graph->set_x_label('X Label');6$graph->set_y_label('Y Label');7$graph->set_x_label_angle(45);8$graph->set_x_label_interval(1);9$graph->set_x_label_count(10);10$graph->set_x_label_type('string');11$graph->set_x_label('X Label');12$graph->set_y_label('Y Label');13$graph->set_x_label_angle(45);14$graph->set_x_label_interval(1);15$graph->set_x_label_count(10);16$graph->set_x_label_type('string');17$graph->set_x_label('X Label');18$graph->set_y_label('Y Label');19$graph->set_x_label_angle(45);20$graph->set_x_label_interval(1);21$graph->set_x_label_count(10);22$graph->set_x_label_type('string');23$graph->set_x_label('X Label');24$graph->set_y_label('Y Label');25$graph->set_x_label_angle(45);26$graph->set_x_label_interval(1);27$graph->set_x_label_count(10);28$graph->set_x_label_type('string');29$graph->set_x_label('X Label');30$graph->set_y_label('Y Label');31$graph->set_x_label_angle(45);32$graph->set_x_label_interval(1);33$graph->set_x_label_count(10);34$graph->set_x_label_type('string');35$graph->set_x_label('X Label');36$graph->set_y_label('Y Label');37$graph->set_x_label_angle(45);38$graph->set_x_label_interval(1);39$graph->set_x_label_count(10);40$graph->set_x_label_type('string');41$graph->set_x_label('X Label');42$graph->set_y_label('Y Label');43$graph->set_x_label_angle(45);44$graph->set_x_label_interval(1);45$graph->set_x_label_count(10);46$graph->set_x_label_type('string');47$graph->set_x_label('X Label');48$graph->set_y_label('Y Label');49$graph->set_x_label_angle(45);50$graph->set_x_label_interval(1);

Full Screen

Full Screen

pts_graph_core

Using AI Code Generation

copy

Full Screen

1require_once('pts-core.php');2$pts_graph = new pts_graph_core();3$pts_graph->set_title('Graph Title');4$pts_graph->set_x_label('X Label');5$pts_graph->set_y_label('Y Label');6$pts_graph->set_x_label_angle(45);7$pts_graph->set_x_label_font_size(10);8$pts_graph->set_y_label_font_size(10);9$pts_graph->set_x_label_font_color('blue');10$pts_graph->set_y_label_font_color('blue');11$pts_graph->set_x_axis_color('blue');12$pts_graph->set_y_axis_color('blue');13$pts_graph->set_x_grid_color('blue');14$pts_graph->set_y_grid_color('blue');15$pts_graph->set_x_axis_font_size(10);16$pts_graph->set_y_axis_font_size(10);17$pts_graph->set_x_axis_font_color('blue');18$pts_graph->set_y_axis_font_color('blue');19$pts_graph->set_x_font_color('blue');20$pts_graph->set_y_font_color('blue');21$pts_graph->set_x_font_size(10);22$pts_graph->set_y_font_size(10);23$pts_graph->set_x_axis_font('arial');24$pts_graph->set_y_axis_font('arial');25$pts_graph->set_x_axis_font_color('blue');26$pts_graph->set_y_axis_font_color('blue');27$pts_graph->set_x_axis_font_size(10);28$pts_graph->set_y_axis_font_size(10);29$pts_graph->set_x_axis_font_color('blue');30$pts_graph->set_y_axis_font_color('blue');31$pts_graph->set_x_axis_font('arial');32$pts_graph->set_y_axis_font('arial');33$pts_graph->set_x_axis_font_size(10);34$pts_graph->set_y_axis_font_size(10);35$pts_graph->set_x_axis_font_color('blue');36$pts_graph->set_y_axis_font_color('blue');37$pts_graph->set_x_axis_font('arial');38$pts_graph->set_y_axis_font('arial');39$pts_graph->set_x_axis_font_size(10);40$pts_graph->set_y_axis_font_size(10);

Full Screen

Full Screen

pts_graph_core

Using AI Code Generation

copy

Full Screen

1$pts_graph_core = new pts_graph_core();2$pts_graph_core->set_graph_title('Test Graph');3$pts_graph_core->set_graph_title_font_size(16);4$pts_graph_core->set_graph_title_color('#000000');5$pts_graph_core->set_graph_title_position('center');6$pts_graph_core->set_graph_width(600);7$pts_graph_core->set_graph_height(400);8$pts_graph_core->set_graph_background_color('#FFFFFF');9$pts_graph_core->set_graph_background_transparency(0);10$pts_graph_core->set_graph_border_color('#000000');11$pts_graph_core->set_graph_border_transparency(0);12$pts_graph_core->set_graph_border_thickness(1);13$pts_graph_core->set_graph_title_background_color('#FFFFFF');14$pts_graph_core->set_graph_title_background_transparency(0);15$pts_graph_core->set_graph_title_border_color('#000000');16$pts_graph_core->set_graph_title_border_transparency(0);17$pts_graph_core->set_graph_title_border_thickness(1);18$pts_graph_core->set_graph_title_font_size(16);19$pts_graph_core->set_graph_title_color('#000000');20$pts_graph_core->set_graph_title_position('center');21$pts_graph_core->set_graph_title_font('Arial');22$pts_graph_core->set_graph_title_font_weight('normal');23$pts_graph_core->set_graph_title_font_style('normal');24$pts_graph_core->set_graph_title_font_decoration('normal');25$pts_graph_core->set_graph_title_font_color('#000000');26$pts_graph_core->set_graph_title_font_size(16);27$pts_graph_core->set_graph_title_color('#000000');28$pts_graph_core->set_graph_title_position('center');29$pts_graph_core->set_graph_title_font('Arial');30$pts_graph_core->set_graph_title_font_weight('normal');31$pts_graph_core->set_graph_title_font_style('normal');32$pts_graph_core->set_graph_title_font_decoration('normal');33$pts_graph_core->set_graph_title_font_color('#000000');34$pts_graph_core->set_graph_title_font_size(16);35$pts_graph_core->set_graph_title_color('#000000');36$pts_graph_core->set_graph_title_position('center');37$pts_graph_core->set_graph_title_font('Arial');38$pts_graph_core->set_graph_title_font_weight('normal');39$pts_graph_core->set_graph_title_font_style('normal');

Full Screen

Full Screen

pts_graph_core

Using AI Code Generation

copy

Full Screen

1require_once 'pts_graph_core.php';2$graph = new pts_graph_core();3$graph->set_title('Performance Graph');4$graph->set_x_label('Time');5$graph->set_y_label('Performance');6$graph->set_x_scale(0, 10);7$graph->set_y_scale(0, 100);8$graph->set_x_format('%1.1f');9$graph->set_y_format('%1.1f');10$graph->set_x_legend('Time', 12, '#000000');11$graph->set_y_legend('Performance', 12, '#000000');12$graph->set_x_axis_steps(10);13$graph->set_y_axis_steps(10);14$graph->set_x_axis_steps(10);15$graph->set_y_axis_steps(10);16$graph->set_x_axis_steps(10);17$graph->set_y_axis_steps(10);18$graph->add_data( array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), 'Performance', 'lines', 5, '#FF0000');19$graph->add_data( array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), 'Performance', 'points', 5, '#0000FF');20$graph->create_graph();21require_once 'pts_graph_core.php';22$graph = new pts_graph_core();23$graph->set_title('Performance Graph');24$graph->set_x_label('Time');25$graph->set_y_label('Performance');26$graph->set_x_scale(0, 10);27$graph->set_y_scale(0, 100);28$graph->set_x_format('%1.1f');29$graph->set_y_format('%1.1f');30$graph->set_x_legend('Time', 12, '#000000');31$graph->set_y_legend('Performance', 12, '#

Full Screen

Full Screen

pts_graph_core

Using AI Code Generation

copy

Full Screen

1require_once 'pts_graph_core.php';2$graph = new pts_graph_core();3$graph->set_title('Graph Title');4$graph->set_subtitle('Graph Subtitle');5$graph->set_x_title('X Axis Title');6$graph->set_y_title('Y Axis Title');7$graph->set_x_data(array('a', 'b', 'c', 'd', 'e'));8$graph->set_y_data(array(0, 1, 2, 3, 4));9$graph->set_y_data(array(4, 3, 2, 1, 0));10$graph->set_y_data(array(2, 2, 2, 2, 2));11$graph->set_y_data(array(0, 2, 4, 2, 0));12$graph->set_y_data(array(4, 2, 0, 2, 4));13$graph->set_y_data(array(2, 2, 2, 2, 2));14$graph->set_y_data(array(0, 1, 2, 3, 4));15$graph->set_y_data(array(4, 3, 2, 1, 0));16$graph->set_y_data(array(2, 2, 2, 2, 2));17$graph->set_y_data(array(0, 2, 4, 2, 0));18$graph->set_y_data(array(4, 2, 0, 2, 4));19$graph->set_y_data(array(2, 2, 2, 2,

Full Screen

Full Screen

pts_graph_core

Using AI Code Generation

copy

Full Screen

1include_once('pts_graph_core.php');2$graph = new pts_graph_core();3$graph->set_title('Graph of Test Result');4$graph->set_x_label('X axis');5$graph->set_y_label('Y axis');6$graph->set_x_values(array('1','2','3','4','5','6','7','8','9','10'));7$graph->set_y_values(array('1','2','3','4','5','6','7','8','9','10'));8$graph->set_x_scale(array('1','2','3','4','5','6','7','8','9','10'));9$graph->set_y_scale(array('1','2','3','4','5','6','7','8','9','10'));10$graph->set_x_legend(array('1','2','3','4','5','6','7','8','9','10'));11$graph->set_y_legend(array('1','2','3','4','5','6','7','8','9','10'));12$graph->set_x_legend(array('1','2','3','4','5','6','7','8','9','10'));13$graph->set_y_legend(array('1','2','3','4','5','6','7','8','9','10'));14$graph->set_graph_type('line');15$graph->set_graph_height(500);16$graph->set_graph_width(500);17$graph->set_graph_line_color('#0000FF

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.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful