How to use render_graph_finish method of pts_SideViewTable class

Best Phoronix-test-suite code snippet using pts_SideViewTable.render_graph_finish

pts_SideViewTable.php

Source:pts_SideViewTable.php Github

copy

Full Screen

...49 {50 return false;51 }52 $this->render_graph_start();53 $this->render_graph_finish();54 return $this->svg_dom->output($save_as);55 }56 public function render_graph_start()57 {58 // Needs to be at least 86px wide for the PTS logo59 $this->i['left_start'] = ceil(max(86, ($this->text_string_width($this->longest_row_identifier, $this->i['identifier_size']) * 1.09) + 8));60 // Needs to be at least 46px tall for the PTS logo61 $top_identifier_height = max(($this->text_string_height($this->longest_column_identifier, $this->i['identifier_size']) + 8), 48);62 $this->i['top_heading_height'] = 1;63 if($this->graph_title != null)64 {65 $this->i['top_heading_height'] += round(self::$c['size']['headers'] + (count($this->graph_sub_titles) * (self::$c['size']['sub_headers'] + 4)));66 }67 $column_widths = array();68 $row_heights = array_fill(0, count($this->rows), (ceil($this->i['identifier_size'] * 2.2)));69 foreach($this->columns as $i => $column)70 {71 $column_width = strlen($column);72 $column_index = -1;73 // See if any of the contained values in that column are longer than the column title itself74 foreach($this->table_data[$i] as $row => &$column_data)75 {76 if(isset($column_data[$column_width]))77 {78 $column = $column_data;79 $column_width = strlen($column_data);80 $column_index = $row;81 }82 if(strlen($column_data) > 64)83 {84 // If it's too long break it into multiple rows85 $row_heights[$row] = ceil($this->i['identifier_size'] * ceil(strlen($column_data) / 64)) + 18;86 $column = substr($column, 0, 64);87 }88 }89 $column_widths[$i] = ceil($this->text_string_width($column, $this->i['identifier_size']) * 1.02) + 14;90 }91 $table_width = $this->longest_row_identifier + array_sum($column_widths);92 $table_height = array_sum($row_heights);93 $table_proper_height = $this->i['top_heading_height'] + $table_height + $top_identifier_height;94 $this->i['graph_width'] = $table_width + $this->i['left_start'] + 1;95 $this->i['graph_height'] = round($table_proper_height + 16);96 if(!empty($this->i['notes']))97 {98 $this->i['graph_height'] += $this->note_display_height();99 }100 // Do the actual work101 $this->render_graph_pre_init();102 $this->render_graph_init();103 $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));104 // Start drawing105 if($this->i['left_start'] >= 170 && $top_identifier_height >= 90)106 {107 $this->svg_dom->add_element('image', array('http_link' => 'http://www.phoronix-test-suite.com/', 'xlink:href' => 'https://openbenchmarking.org/static/images/pts-160x83.png', 'x' => round($this->i['left_start'] / 2 - 80), 'y' => round(($top_identifier_height / 2 - 41.5) + $this->i['top_heading_height']), 'width' => 160, 'height' => 83));108 }109 else110 {111 $this->svg_dom->add_element('image', array('http_link' => 'http://www.phoronix-test-suite.com/', 'xlink:href' => 'https://openbenchmarking.org/static/images/pts-80x42.png', 'x' => round($this->i['left_start'] / 2 - 40), 'y' => round($top_identifier_height / 2 - 21 + $this->i['top_heading_height']), 'width' => 80, 'height' => 42));112 }113 // Draw the vertical table lines114 $v = round((($top_identifier_height + $table_height) / 2) + $this->i['top_heading_height']);115 // Heading116 if($this->graph_title != null)117 {118 $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']));119 foreach($this->graph_sub_titles as $i => $sub_title)120 {121 $vertical_offset = 16 + self::$c['size']['headers'] + ($i * (self::$c['size']['sub_headers']));122 $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'));123 }124 $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);125 }126 // Write the rows127 $horizontal_offset = $top_identifier_height + $this->i['top_heading_height'];128 foreach($this->rows as $i => $row_string)129 {130 if($i % 2 == 0)131 {132 $this->svg_dom->add_element('rect', array('x' => 1, 'y' => $horizontal_offset, 'width' => $this->i['left_start'], 'height' => $row_heights[$i], 'fill' => self::$c['color']['body_light'], 'stroke' => self::$c['color']['border'], 'stroke-width' => 1));133 }134 $this->svg_dom->add_text_element($row_string, array('x' => ($this->i['left_start'] - 4), 'y' => ($horizontal_offset + 16), 'font-size' => $this->i['identifier_size'], 'fill' => self::$c['color']['text'], 'font-weight' => 'bold', 'text-anchor' => 'end'));135 $horizontal_offset += $row_heights[$i];136 }137 // Write the columns138 $y = $this->i['top_heading_height'] + ($top_identifier_height / 2) - 6;139 $column_width_offset = $this->i['left_start'];140 foreach($this->columns as $i => $col_string)141 {142 if($i % 2 == 0)143 {144 $this->svg_dom->add_element('rect', array('x' => $column_width_offset, 'y' => $this->i['top_heading_height'], 'width' => $column_widths[$i], 'height' => $top_identifier_height, 'fill' => self::$c['color']['body_light'], 'stroke' => self::$c['color']['border'], 'stroke-width' => 1));145 }146 $this->svg_dom->add_text_element($col_string, array('x' => $column_width_offset + round($column_widths[$i] / 2) , 'y' => $y, 'font-size' => $this->i['identifier_size'], 'fill' => self::$c['color']['text'], 'font-weight' => 'bold', 'text-anchor' => 'middle', 'dominant-baseline' => 'text-before-edge'));147 $column_width_offset += $column_widths[$i];148 }149 // Write the values150 $column_width_offset = $this->i['left_start'];151 $column_count = 0;152 foreach($this->table_data as $column => &$column_data)153 {154 $x = $column_width_offset + round($column_widths[$column_count] / 2);155 $row_count = 0;156 $row_offset = $top_identifier_height + $this->i['top_heading_height'];157 foreach($column_data as $row => &$value)158 {159 if(true || $column % 2 == 0 || $row % 2 != 1)160 {161 $this->svg_dom->add_element('rect', array('x' => $column_width_offset, 'y' => $row_offset, 'width' => $column_widths[$column_count], 'height' => $row_heights[$row], 'fill' => self::$c['color'][($row % 2 == 0 ? 'body' : 'body_light')], 'stroke' => self::$c['color']['border'], 'stroke-width' => 1));162 }163 if(isset($value[64]))164 {165 // If it's a long string that needs to be broken to multiple linesd we need textarea to do automatic word wrapping166 $this->svg_dom->add_textarea_element($value, array('x' => $x, 'y' => ($row_offset + 16), 'font-size' => $this->i['identifier_size'], 'fill' => self::$c['color']['text'], 'text-anchor' => 'middle', 'width' => ($column_widths[$column_count] - 8)));167 }168 else169 {170 $this->svg_dom->add_text_element($value, array('x' => $x, 'y' => ($row_offset + 16), 'font-size' => $this->i['identifier_size'], 'fill' => self::$c['color']['text'], 'text-anchor' => 'middle'));171 }172 $row_count++;173 $row_offset += $row_heights[$row];174 }175 $column_width_offset += $column_widths[$column_count];176 $column_count++;177 }178 // Bottom part179 $this->svg_dom->add_element('rect', array('x' => 0, 'y' => $table_proper_height, 'width' => $this->i['graph_width'], 'height' => ($this->i['graph_height'] - $table_proper_height), 'fill' => self::$c['color']['headers']));180 $this->svg_dom->add_text_element(self::$c['text']['watermark'], array('x' => ($this->i['graph_width'] - 2), 'y' => ($this->i['graph_height'] - 3), 'font-size' => $this->i['identifier_size'], 'fill' => self::$c['color']['body_text'], 'text-anchor' => 'end', 'xlink:show' => 'new', 'xlink:href' => self::$c['text']['watermark_url']));181 if(!empty($this->i['notes']))182 {183 $estimated_height = 0;184 $previous_section = null;185 foreach($this->i['notes'] as $i => $note_r)186 {187 if($note_r['section'] != null && $note_r['section'] !== $previous_section)188 {189 $estimated_height += 2;190 $this->svg_dom->add_textarea_element($note_r['section'] . ' Details', array('x' => 6, 'y' => ($table_proper_height + 14 + $estimated_height), 'font-size' => (self::$c['size']['key'] - 1), 'fill' => self::$c['color']['background'], 'text-anchor' => 'start', 'xlink:title' => $note_r['hover-title'], 'style' => 'font-weight: bold'), $estimated_height);191 $estimated_height += 2;192 $previous_section = $note_r['section'];193 }194 $this->svg_dom->add_textarea_element('- ' . $note_r['note'], array('x' => 6, 'y' => ($table_proper_height + 14 + $estimated_height), 'font-size' => (self::$c['size']['key'] - 1), 'fill' => self::$c['color']['background'], 'text-anchor' => 'start', 'xlink:title' => $note_r['hover-title']), $estimated_height);195 }196 }197 }198 public function render_graph_finish()199 {200 return true;201 }202}203?>...

Full Screen

Full Screen

render_graph_finish

Using AI Code Generation

copy

Full Screen

1$graph = new pts_SideViewTable();2$graph->set_title('Graph 2');3$graph->set_header(array('Test', 'Result'));4$graph->set_header_color(array('white', 'white'));5$graph->set_header_background_color(array('blue', 'blue'));6$graph->set_data($data);7$graph->render_graph_finish();8$graph = new pts_SideViewTable();9$graph->set_title('Graph 3');10$graph->set_header(array('Test', 'Result'));11$graph->set_header_color(array('white', 'white'));12$graph->set_header_background_color(array('blue', 'blue'));13$graph->set_data($data);14$graph->render_graph_start();15$graph = new pts_SideViewTable();16$graph->set_title('Graph 4');17$graph->set_header(array('Test', 'Result'));18$graph->set_header_color(array('white', 'white'));19$graph->set_header_background_color(array('blue', 'blue'));20$graph->set_data($data);21$graph->render_graph_start();

Full Screen

Full Screen

render_graph_finish

Using AI Code Generation

copy

Full Screen

1$svt->render_graph_finish();2$svt->render_graph_finish();3$svt->render_graph_finish();4$svt->render_graph_finish();5$svt->render_graph_finish();6$svt->render_graph_finish();7$svt->render_graph_finish();8$svt->render_graph_finish();9$svt->render_graph_finish();

Full Screen

Full Screen

render_graph_finish

Using AI Code Generation

copy

Full Screen

1$graph->render_graph_finish();2include 'phptopdf.php';3$graph = new pts_Graph();4$graph->set_title("Graph Title");5$graph->set_width(500);6$graph->set_height(300);7$graph->set_x_title("X Axis Title");8$graph->set_y_title("Y Axis Title");9$graph->set_x_data(array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"));10$graph->set_y_data(array(30,40,50,60,70,80,90,100,110,120,130,140));11$graph->set_colors(array("red","green","blue","yellow","orange"));12$graph->set_legend(array("legend 1","legend 2","legend 3","legend 4","legend 5"));13$graph->set_x_range(0,11);14$graph->set_y_range(0,140);15$graph->set_x_step(1);16$graph->set_y_step(10);17$graph->set_x_labels(array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"));18$graph->set_y_labels(array("30","40","50","60","70","80","90","100","110","120","130","140"));19$graph->set_x_label_step(1);20$graph->set_y_label_step(10);

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.

Most used method in pts_SideViewTable

Trigger render_graph_finish code on LambdaTest Cloud Grid

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