source: trunk/xgraph/jpgraph/Examples/csim_in_html_ex1.php

Last change on this file was 42, checked in by marrucho, 10 years ago
File size: 1.4 KB
Line 
1<html>
2<body>
3
4<?php
5$_graphfilename = 'csim_in_html_graph_ex1.php';
6// This is the filename of this HTML file
7global $_wrapperfilename;
8$_wrapperfilename = basename (__FILE__);
9
10// Create a random mapname used to connect the image map with the image
11$_mapname = '__mapname'.rand(0,1000000).'__';
12
13// This is the first graph script
14require_once ($_graphfilename);
15
16// This line gets the image map and inserts it on the page
17$imgmap = $graph->GetHTMLImageMap($_mapname);
18echo $imgmap;
19
20?>
21
22<h2>This is an example page with CSIM graphs with arbitrary HTML text</h2>
23
24<?php
25if( empty($_GET['clickedon']) ) {
26   echo '<b style="color:darkred;">Clicked on bar: &lt;none></b>';
27}
28else {
29   echo '<b style="color:darkred;">Clicked on bar: '.$_GET['clickedon'].'</b>';
30}
31echo '<p />';
32?>
33
34<p>First we need to get hold of the image map and include it in the HTML
35  page.</p>
36<p>For this graph it is:</p>
37<?php
38
39// The we display the image map as well
40echo '<pre><b>'.htmlentities($imgmap).'</b></pre>';?>
41
42<?php
43// Construct the <img> tag and rebuild the
44$imgtag = $graph->GetCSIMImgHTML($_mapname,$_graphfilename);
45?>
46<p>The graph is then be displayed as shown in figure 1. With the following
47  created &lt;img> tag:</p>
48<pre><b>
49<?php echo htmlentities($imgtag); ?>
50</b></pre>
51
52
53<p>
54<?php
55echo $imgtag;
56?>
57<br><b>Figure 1. </b>The included CSIM graph.
58</p>
59
60</body>
61</html>
Note: See TracBrowser for help on using the repository browser.