Best Phoronix-test-suite code snippet using pts_graph_ir_value.get_value
pts_Table.php
Source:pts_Table.php
...73 foreach($column as &$row)74 {75 if($row instanceof pts_graph_ir_value)76 {77 $value = $row->get_value();78 if(($spans_col = $row->get_attribute('spans_col')) > 1)79 {80 // Since the txt will be spread over multiple columns, it doesn't need to all fit into one81 $value = substr($value, 0, ceil(strlen($value) / $spans_col));82 }83 }84 else85 {86 $value = $row;87 }88 if(isset($value[$longest_string_length]))89 {90 $longest_string = $value;91 $longest_string_length = strlen($value);92 }93 }94 }95 return $longest_string;96 }97 public function renderChart($save_as = null)98 {99 $this->render_graph_start();100 $this->render_graph_finish();101 return $this->svg_dom->output($save_as);102 }103 public function render_graph_start()104 {105 // Needs to be at least 86px wide for the PTS logo106 $this->i['left_start'] = ceil(max(86, ($this->text_string_width($this->longest_row_identifier, $this->i['identifier_size']) * 1.1) + 12));107 if($this->column_heading_vertical)108 {109 $top_identifier_height = round($this->text_string_width($this->longest_column_identifier, $this->i['identifier_size']) * 1.1) + 12;110 $table_identifier_width = $this->text_string_width($this->longest_column_identifier, $this->i['identifier_size']);111 }112 else113 {114 $top_identifier_height = $this->text_string_height($this->longest_column_identifier, $this->i['identifier_size']) + 8;115 $table_identifier_width = round($this->text_string_width($this->longest_column_identifier, $this->i['identifier_size']) * 1.1) + 8;116 }117 // Needs to be at least 46px tall for the PTS logo118 $top_identifier_height = max($top_identifier_height, 48);119 if(defined('PHOROMATIC_TRACKER') || $this->is_multi_way)120 {121 $extra_heading_height = round($this->text_string_height($this->longest_column_identifier, self::$c['size']['headers']) * 1.25);122 $top_identifier_height += 6 + $extra_heading_height;123 }124 $this->i['top_heading_height'] = 8;125 if($this->graph_title != null)126 {127 $this->i['top_heading_height'] += round(self::$c['size']['headers'] + (count($this->graph_sub_titles) * (self::$c['size']['sub_headers'] + 4)));128 }129 $table_max_value_width = ceil($this->text_string_width($this->i['graph_max_value'], $this->i['identifier_size']) * 1.02) + 2;130 $table_item_width = max($table_max_value_width, $table_identifier_width) + 2;131 $table_width = max(($table_item_width * count($this->columns)), floor($this->text_string_width($this->graph_title, 12) / $table_item_width) * $table_item_width);132 //$table_width = $table_item_width * count($this->columns);133 $table_line_height = round($this->text_string_height($this->i['graph_max_value'], $this->i['identifier_size']) + 8);134 $table_line_height_half = round($table_line_height / 2);135 $table_height = $table_line_height * count($this->rows);136 $table_proper_height = $this->i['top_heading_height'] + $table_height + $top_identifier_height;137 $this->i['graph_width'] = $table_width + $this->i['left_start'];138 $this->i['graph_height'] = round($table_proper_height + $table_line_height);139 if(!empty($this->i['notes']))140 {141 $this->i['graph_height'] += $this->note_display_height();142 }143 // Do the actual work144 $this->render_graph_pre_init();145 $this->render_graph_init();146 $this->svg_dom->add_element('rect', array('x' => 1, 'y' => 1, 'width' => ($this->i['graph_width'] - 1), 'height' => ($this->i['graph_height'] - 1), 'fill' => self::$c['color']['background'], 'stroke' => self::$c['color']['border'], 'stroke-width' => 1));147 // Start drawing148 $this->svg_dom->add_element('path', array('d' => 'm74 22v9m-5-16v16m-5-28v28m-23-2h12.5c2.485281 0 4.5-2.014719 4.5-4.5s-2.014719-4.5-4.5-4.5h-8c-2.485281 0-4.5-2.014719-4.5-4.5s2.014719-4.5 4.5-4.5h12.5m-21 5h-11m11 13h-2c-4.970563 0-9-4.029437-9-9v-20m-24 40v-20c0-4.970563 4.0294373-9 9-9 4.970563 0 9 4.029437 9 9s-4.029437 9-9 9h-9', 'stroke' => '#000000', 'stroke-width' => 4, 'fill' => 'none', 'transform' => 'translate(' . round($this->i['left_start'] / 2 - 40) . ',' . round($top_identifier_height / 2 - 21 + $this->i['top_heading_height']) . ')'));149 // Draw the vertical table lines150 $v = round((($top_identifier_height + $table_height) / 2) + $this->i['top_heading_height']);151 $table_columns_end = $this->i['left_start'] + ($table_item_width * count($this->columns));152 $this->svg_dom->draw_svg_line($this->i['left_start'], $v, $table_columns_end, $v, self::$c['color']['body'], $table_height + $top_identifier_height, array('stroke-dasharray' => $table_item_width . ',' . $table_item_width));153 if($table_columns_end < $this->i['graph_width'])154 {155 $this->svg_dom->add_element('rect', array('x' => $table_columns_end, 'y' => $this->i['top_heading_height'], 'width' => ($this->i['graph_width'] - $table_columns_end), 'height' => ($table_height + $top_identifier_height), 'fill' => self::$c['color']['body_light']));156 }157 // Background horizontal158 $this->svg_dom->draw_svg_line(round($table_columns_end / 2), ($top_identifier_height + $this->i['top_heading_height']), round($table_columns_end / 2), $table_proper_height, self::$c['color']['body_light'], $table_columns_end, array('stroke-dasharray' => $table_line_height . ',' . $table_line_height));159 // Draw the borders160 $this->svg_dom->draw_svg_line($this->i['left_start'], $v, $table_columns_end + ($table_columns_end < $this->i['graph_width'] ? $table_item_width : 0), $v, self::$c['color']['border'], $table_height + $top_identifier_height, array('stroke-dasharray' => '1,' . ($table_item_width - 1)));161 // Heading162 if($this->graph_title != null)163 {164 $this->svg_dom->add_element('rect', array('x' => 1, 'y' => 1, 'width' => ($this->i['graph_width'] - 2), 'height' => $this->i['top_heading_height'], 'fill' => self::$c['color']['main_headers']));165 $this->svg_dom->add_text_element($this->graph_title, array('x' => 5, 'y' => (self::$c['size']['headers'] + 2), 'font-size' => self::$c['size']['headers'], 'fill' => self::$c['color']['background'], 'text-anchor' => 'start'));166 foreach($this->graph_sub_titles as $i => $sub_title)167 {168 $vertical_offset = 16 + self::$c['size']['headers'] + ($i * (self::$c['size']['sub_headers']));169 $this->svg_dom->add_text_element($sub_title, array('x' => 5, 'y' => $vertical_offset, 'font-size' => self::$c['size']['sub_headers'], 'fill' => self::$c['color']['background'], 'text-anchor' => 'start'));170 }171 $this->svg_dom->draw_svg_line(1, $this->i['top_heading_height'], $this->i['graph_width'] - 1, $this->i['top_heading_height'], self::$c['color']['border'], 1);172 }173 // Write the rows174 $row = 1;175 $g = $this->svg_dom->make_g(array('font-size' => $this->i['identifier_size'], 'font-weight' => 'bold', 'fill' => self::$c['color']['text'], 'text-anchor' => 'end'));176 foreach($this->rows as $i => $row_string)177 {178 if(($row_string instanceof pts_graph_ir_value) == false)179 {180 $row_string = new pts_graph_ir_value($row_string);181 }182 $v = round($top_identifier_height + $this->i['top_heading_height'] + ($row * $table_line_height) - 4);183 $r = array('x' => ($this->i['left_start'] - 2), 'y' => $v, 'xlink:href' => $row_string->get_attribute('href'));184 if($row_string->get_attribute('alert'))185 {186 $r['fill'] = self::$c['color']['alert'];187 }188 $this->svg_dom->add_text_element($row_string, $r, $g);189 $row++;190 }191 // Write the identifiers192 if(defined('PHOROMATIC_TRACKER') || $this->is_multi_way)193 {194 $last_identifier = null;195 $last_changed_col = 0;196 $show_keys = array_keys($this->table_data);197 $show_keys[] = 'Temp: Temp';198 $g1 = $this->svg_dom->make_g(array());199 $g2 = $this->svg_dom->make_g(array('font-size' => self::$c['size']['axis_headers'], 'fill' => self::$c['color']['background'], 'font-weight' => 'bold', 'text-anchor' => 'middle'));200 foreach($show_keys as $current_col => $system_identifier)201 {202 $identifier = pts_strings::colon_explode($system_identifier);203 if(isset($identifier[0]) && $identifier[0] != $last_identifier)204 {205 if($current_col == $last_changed_col)206 {207 $last_identifier = $identifier[0];208 continue;209 }210 $paint_color = $this->get_paint_color($identifier[0]);211 if($this->i['top_heading_height'] > 0)212 {213 $extra_heading_height = $this->i['top_heading_height'];214 }215 $x = $this->i['left_start'] + 1 + ($last_changed_col * $table_item_width);216 $x_end = ($this->i['left_start'] + ($last_changed_col * $table_item_width)) + ($table_item_width * ($current_col - $last_changed_col));217 $this->svg_dom->add_element('rect', array('x' => $x, 'y' => 0, 'width' => ($table_item_width * ($current_col - $last_changed_col)) - 2, 'height' => $extra_heading_height, 'fill' => $paint_color), $g1);218 if($identifier[0] != 'Temp')219 {220 $this->svg_dom->draw_svg_line(($this->i['left_start'] + ($current_col * $table_item_width) + 1), 1, ($this->i['left_start'] + ($current_col * $table_item_width) + 1), $table_proper_height, $paint_color, 1);221 }222 //$x = $this->i['left_start'] + ($last_changed_col * $table_item_width) + ($this->i['left_start'] + ($current_col * $table_item_width) - $this->i['left_start'] + ($last_changed_col * $table_item_width));223 $this->svg_dom->add_text_element($last_identifier, array('x' => round($x + (($x_end - $x) / 2)), 'y' => (self::$c['size']['axis_headers'] + 4)), $g2);224 $last_identifier = $identifier[0];225 $last_changed_col = $current_col;226 }227 }228 }229 $table_identifier_offset = ($table_item_width / 2) + ($table_identifier_width / 2) - 1;230 $g_opts = array('font-size' => $this->i['identifier_size'], 'fill' => self::$c['color']['text'], 'font-weight' => 'bold');231 if($this->column_heading_vertical)232 {233 $g_opts['text-anchor'] = 'end';234 }235 else236 {237 $g_opts['text-anchor'] = 'middle';238 $g_opts['dominant-baseline'] = 'text-before-edge';239 }240 $g = $this->svg_dom->make_g($g_opts);241 foreach($this->columns as $i => $col_string)242 {243 if($this->column_heading_vertical)244 {245 $x = $this->i['left_start'] + ($i * $table_item_width) + $table_identifier_offset;246 $y = $this->i['top_heading_height'] + $top_identifier_height - 4;247 $this->svg_dom->add_text_element($col_string, array('x' => $x, 'y' => $y, 'transform' => 'rotate(90 ' . $x . ' ' . $y . ')'), $g);248 }249 else250 {251 $x = round($this->i['left_start'] + ($i * $table_item_width) + ($table_item_width / 2));252 $y = round($this->i['top_heading_height'] + ($top_identifier_height / 2));253 $this->svg_dom->add_text_element($col_string, array('x' => $x, 'y' => $y), $g);254 }255 }256 // Write the columns257 $g_background = $this->svg_dom->make_g(array('fill' => self::$c['color']['body']));258 $g = $this->svg_dom->make_g(array('text-anchor' => 'middle', 'font-size' => $this->i['identifier_size'], 'fill' => self::$c['color']['text']));259 foreach($this->table_data as $index => &$table_values)260 {261 if(!is_array($table_values))262 {263 // TODO: determine why sometimes $table_values is empty or not an array264 continue;265 }266 if($this->is_multi_way && ($c = strpos($index, ':')) !== false)267 {268 $index = substr($index, $c + 1);269 }270 $col = array_search(strval($index), $this->columns);271 if($col === false)272 {273 continue;274 }275 else276 {277 // unset this since it shouldn't be needed anymore and will then wipe out it from where multiple results have same name278 unset($this->columns[$col]);279 }280 foreach($table_values as $i => &$result_table_value)281 {282 $row = $i - 1; // if using $row, the alignment may be off sometimes283 $hover = array();284 $text_color = null;285 $bold = false;286 if($result_table_value == null)287 {288 continue;289 }290 if($result_table_value instanceof pts_graph_ir_value)291 {292 if(($t = $result_table_value->get_attribute('std_percent')) > 0)293 {294 $hover[] = 'STD Dev: ' . $t . '%';295 }296 if(($t = $result_table_value->get_attribute('std_error')) != 0)297 {298 $hover[] = ' STD Error: ' . $t;299 }300 if(defined('PHOROMATIC_TRACKER') && ($t = $result_table_value->get_attribute('delta')) != 0)301 {302 $bold = true;303 $text_color = $t < 0 ? self::$c['color']['alert'] : self::$c['color']['headers'];304 $hover[] = ' Change: ' . pts_math::set_precision(100 * $t, 2) . '%';305 }306 else if($result_table_value->get_attribute('highlight') == true)307 {308 $text_color = self::$c['color']['highlight'];309 }310 else if($result_table_value->get_attribute('alert') == true)311 {312 $text_color = self::$c['color']['alert'];313 }314 $value = $result_table_value->get_value();315 $spans_col = $result_table_value->get_attribute('spans_col');316 }317 else318 {319 $value = $result_table_value;320 $spans_col = 1;321 }322 $left_bounds = $this->i['left_start'] + ($col * $table_item_width);323 $right_bounds = $this->i['left_start'] + (($col + max(1, $spans_col)) * $table_item_width);324 if($spans_col > 1)325 {326 if($col == 1)327 {328 $background_paint = $i % 2 == 1 ? self::$c['color']['background'] : self::$c['color']['body'];...
pts_graph_ir_value.php
Source:pts_graph_ir_value.php
...35 public function get_attribute($attribute)36 {37 return isset($this->attributes[$attribute]) ? $this->attributes[$attribute] : null;38 }39 public function get_value()40 {41 return $this->value_string;42 }43 public function set_value_string($value)44 {45 $this->value_string = $value;46 }47}48?>...
get_value
Using AI Code Generation
1$ir_value = new pts_graph_ir_value();2$ir_value->set_value(100);3echo $ir_value->get_value();4$ir_value = new pts_graph_ir_value();5$ir_value->set_value(100);6echo $ir_value->get_value();7$ir_value = new pts_graph_ir_value();8$ir_value->set_value(100);9echo $ir_value->get_value();10$ir_value = new pts_graph_ir_value();11$ir_value->set_value(100);12echo $ir_value->get_value();13$ir_value = new pts_graph_ir_value();14$ir_value->set_value(100);15echo $ir_value->get_value();16$ir_value = new pts_graph_ir_value();17$ir_value->set_value(100);18echo $ir_value->get_value();19$ir_value = new pts_graph_ir_value();20$ir_value->set_value(100);21echo $ir_value->get_value();22$ir_value = new pts_graph_ir_value();23$ir_value->set_value(100);24echo $ir_value->get_value();25$ir_value = new pts_graph_ir_value();26$ir_value->set_value(100);27echo $ir_value->get_value();28$ir_value = new pts_graph_ir_value();29$ir_value->set_value(100);30echo $ir_value->get_value();31$ir_value = new pts_graph_ir_value();32$ir_value->set_value(100
get_value
Using AI Code Generation
1$graph = new pts_graph_ir_value();2$graph->set_value(2);3echo $graph->get_value();4$graph = new pts_graph_ir_value();5$graph->set_value(3);6echo $graph->get_value();7$graph = new pts_graph_ir_value();8$graph->set_value(4);9echo $graph->get_value();10$graph = new pts_graph_ir_value();11$graph->set_value(5);12echo $graph->get_value();13$graph = new pts_graph_ir_value();14$graph->set_value(6);15echo $graph->get_value();16$graph = new pts_graph_ir_value();17$graph->set_value(7);18echo $graph->get_value();19$graph = new pts_graph_ir_value();20$graph->set_value(8);21echo $graph->get_value();22$graph = new pts_graph_ir_value();23$graph->set_value(9);24echo $graph->get_value();25$graph = new pts_graph_ir_value();26$graph->set_value(10);27echo $graph->get_value();28$graph = new pts_graph_ir_value();29$graph->set_value(11);30echo $graph->get_value();31$graph = new pts_graph_ir_value();32$graph->set_value(12);33echo $graph->get_value();
get_value
Using AI Code Generation
1$graph = new pts_graph_ir_value();2$graph->get_value('foo', 'bar');3$graph = new pts_graph_ir_value();4$graph->get_value('foo', 'bar');5$graph = new pts_graph_ir_value();6$graph->get_value('foo', 'bar');7$graph = new pts_graph_ir_value();8$graph->get_value('foo', 'bar');9$graph = new pts_graph_ir_value();10$graph->get_value('foo', 'bar');11$graph = new pts_graph_ir_value();12$graph->get_value('foo', 'bar');13$graph = new pts_graph_ir_value();14$graph->get_value('foo', 'bar');15$graph = new pts_graph_ir_value();16$graph->get_value('foo', 'bar');17$graph = new pts_graph_ir_value();18$graph->get_value('foo', 'bar');19$graph = new pts_graph_ir_value();20$graph->get_value('foo', 'bar');21$graph = new pts_graph_ir_value();22$graph->get_value('foo', 'bar');23$graph = new pts_graph_ir_value();24$graph->get_value('foo', 'bar');
get_value
Using AI Code Generation
1$b = $a->get_value();2$c = $b->get_value();3$d = $c->get_value();4$e = $d->get_value();5$f = $e->get_value();6$g = $f->get_value();7$h = $g->get_value();8$i = $h->get_value();9$j = $i->get_value();10$k = $j->get_value();
get_value
Using AI Code Generation
1$ir_value = new pts_graph_ir_value();2$ir_value->set_value(100);3$ir_value->set_label('100');4$ir_value->set_color('red');5$ir_value->set_tooltip('tooltip');6$ir_value->set_id('1');7$ir_value->set_image_width(100);8$ir_value->set_image_height(100);9$ir_value->set_image_x(100);10$ir_value->set_image_y(100);11$ir_value->set_image_tooltip('image tooltip');12$ir_value->set_image_id('image id');13$ir_value->set_image_map('image map');14$ir_value->set_image_map_id('image map id');15$ir_value->set_image_map_tooltip('image map tooltip');16$ir_value->set_image_map_id('image map id');17$ir_value->set_image_map_tooltip('image map tooltip');18echo $ir_value->get_value()."19";20echo $ir_value->get_label()."21";22echo $ir_value->get_color()."23";24echo $ir_value->get_url()."25";26echo $ir_value->get_tooltip()."27";28echo $ir_value->get_link()."29";30echo $ir_value->get_id()."31";32echo $ir_value->get_image()."33";34echo $ir_value->get_image_width()."35";36echo $ir_value->get_image_height()."37";38echo $ir_value->get_image_x()."39";40echo $ir_value->get_image_y()."41";42echo $ir_value->get_image_tooltip()."43";44echo $ir_value->get_image_link()."45";46echo $ir_value->get_image_id()."47";48echo $ir_value->get_image_url()."49";50echo $ir_value->get_image_map()."51";52echo $ir_value->get_image_map_id()."53";
get_value
Using AI Code Generation
1$my_var = $my_graph->get_value('my_var');2echo $my_var;3$my_graph->set_value('my_var', 10);4echo $my_var;5$my_var = $my_graph->get_value('my_var');6echo $my_var;7$my_graph->set_value('my_var', 5);8echo $my_var;9$my_var = $my_graph->get_value('my_var');10echo $my_var;11$my_graph->set_value('my_var', 15);12echo $my_var;13$my_var = $my_graph->get_value('my_var');14echo $my_var;15$my_graph->set_value('my_var', 20);16echo $my_var;17$my_var = $my_graph->get_value('my_var');18echo $my_var;19$my_graph->set_value('my_var', 25);20echo $my_var;
get_value
Using AI Code Generation
1$graph->get_value($value_name, $value_type);2$graph->get_value('CPU', 'AVG');3$graph->get_value($value_name, $value_type);4$graph->get_value('CPU', 'AVG');5$graph->get_value($value_name, $value_type);6$graph->get_value('CPU', 'AVG');7$graph->get_value($value_name, $value_type);8$graph->get_value('CPU', 'AVG');9$graph->get_value($value_name, $value_type);10$graph->get_value('CPU', 'AVG');11$graph->get_value($value_name, $value_type);12$graph->get_value('CPU', 'AVG');13$graph->get_value($value_name, $value_type);14$graph->get_value('CPU', 'AVG');15$graph->get_value($value_name, $value_type);16$graph->get_value('CPU', 'AVG');17$graph->get_value($value_name, $value_type);18$graph->get_value('CPU', 'AVG');19$graph->get_value($value_name, $value_type);20$graph->get_value('CPU', 'AVG');21$graph->get_value($value_name
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Execute automation tests with get_value on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.
Test now for FreeGet 100 minutes of automation test minutes FREE!!