[42] | 1 | <html> |
---|
| 2 | <body> |
---|
| 3 | |
---|
| 4 | <?php |
---|
| 5 | // The names of the graph scripts |
---|
| 6 | $_graphfilename1 = 'csim_in_html_graph_ex1.php'; |
---|
| 7 | $_graphfilename2 = 'csim_in_html_graph_ex2.php'; |
---|
| 8 | |
---|
| 9 | // This is the filename of this HTML file |
---|
| 10 | global $_wrapperfilename; |
---|
| 11 | $_wrapperfilename = basename (__FILE__); |
---|
| 12 | |
---|
| 13 | // Create a random mapname used to connect the image map with the image |
---|
| 14 | $_mapname1 = '__mapname'.rand(0,1000000).'__'; |
---|
| 15 | $_mapname2 = '__mapname'.rand(0,1000000).'__'; |
---|
| 16 | |
---|
| 17 | // Get the graph scripts |
---|
| 18 | require_once ($_graphfilename1); |
---|
| 19 | require_once ($_graphfilename2); |
---|
| 20 | |
---|
| 21 | // This line gets the image map and inserts it on the page |
---|
| 22 | $imgmap1 = $graph->GetHTMLImageMap($_mapname1); |
---|
| 23 | $imgmap2 = $piegraph->GetHTMLImageMap($_mapname2); |
---|
| 24 | echo $imgmap1; |
---|
| 25 | echo $imgmap2; |
---|
| 26 | |
---|
| 27 | ?> |
---|
| 28 | |
---|
| 29 | <h2>This is an example page with CSIM graphs with arbitrary HTML text</h2> |
---|
| 30 | |
---|
| 31 | <?php |
---|
| 32 | if( empty($_GET['clickedon']) ) { |
---|
| 33 | echo '<b style="color:darkred;">Clicked on bar: <none></b>'; |
---|
| 34 | } |
---|
| 35 | else { |
---|
| 36 | echo '<b style="color:darkred;">Clicked on bar: '.$_GET['clickedon'].'</b>'; |
---|
| 37 | } |
---|
| 38 | echo '<p />'; |
---|
| 39 | if( empty($_GET['pie_clickedon']) ) { |
---|
| 40 | echo '<b style="color:darkred;">Clicked on pie slice: <none></b>'; |
---|
| 41 | } |
---|
| 42 | else { |
---|
| 43 | echo '<b style="color:darkred;">Clicked on pie slice: '.$_GET['pie_clickedon'].'</b>'; |
---|
| 44 | } |
---|
| 45 | echo '<p />'; |
---|
| 46 | ?> |
---|
| 47 | |
---|
| 48 | <p>First we need to get hold of the image maps and include them in the HTML |
---|
| 49 | page.</p> |
---|
| 50 | <p>For these graphs the maps are:</p> |
---|
| 51 | <?php |
---|
| 52 | // The we display the image map as well |
---|
| 53 | echo '<small><pre>'.htmlentities($imgmap1).'</pre></small>'; |
---|
| 54 | ?> |
---|
| 55 | <p> |
---|
| 56 | and |
---|
| 57 | </p> |
---|
| 58 | <?php |
---|
| 59 | // The we display the image map as well |
---|
| 60 | echo '<small><pre>'.htmlentities($imgmap2).'</pre></small>'; |
---|
| 61 | ?> |
---|
| 62 | |
---|
| 63 | <?php |
---|
| 64 | // Construct the <img> tags for Figure 1 & 2 and rebuild the URL arguments |
---|
| 65 | $imgtag1 = $graph->GetCSIMImgHTML($_mapname1,$_graphfilename1); |
---|
| 66 | $imgtag2 = $piegraph->GetCSIMImgHTML($_mapname2,$_graphfilename2); |
---|
| 67 | ?> |
---|
| 68 | <p>The graphs are then displayed as shown in figure 1 & 2. With the following |
---|
| 69 | created <img> tags:</p> |
---|
| 70 | <small><pre> |
---|
| 71 | <?php |
---|
| 72 | echo htmlentities($imgtag1); |
---|
| 73 | echo htmlentities($imgtag2); |
---|
| 74 | ?> |
---|
| 75 | </pre></small> |
---|
| 76 | |
---|
| 77 | <p> |
---|
| 78 | Note: For the Pie the center is counted as the first slice. |
---|
| 79 | </p> |
---|
| 80 | |
---|
| 81 | <p> |
---|
| 82 | <table border=0> |
---|
| 83 | <tr><td valign="bottom"> |
---|
| 84 | <?php |
---|
| 85 | echo $imgtag1; |
---|
| 86 | ?> |
---|
| 87 | <br><b>Figure 1. </b>The included Bar CSIM graph. |
---|
| 88 | </p> |
---|
| 89 | </td> |
---|
| 90 | <td valign="bottom"> |
---|
| 91 | <?php |
---|
| 92 | echo $imgtag2; |
---|
| 93 | ?> |
---|
| 94 | <br><b>Figure 2. </b>The included Pie CSIM graph. |
---|
| 95 | </p> |
---|
| 96 | </td> |
---|
| 97 | </tr> |
---|
| 98 | </table> |
---|
| 99 | </body> |
---|
| 100 | </html> |
---|