| 1 |
<html> |
| 2 |
<head> |
| 3 |
<title>Batik demo</title> |
| 4 |
<style type="text/css"> |
| 5 |
body, table { |
| 6 |
font-family: sans-serif; |
| 7 |
font-size: 12px; |
| 8 |
} |
| 9 |
#data { |
| 10 |
background: #ffe; |
| 11 |
border: 1px solid #cca; |
| 12 |
border-collapse: collapse; |
| 13 |
} |
| 14 |
#data td, #data th { |
| 15 |
padding: 4px; |
| 16 |
} |
| 17 |
#data th { |
| 18 |
text-align: left; |
| 19 |
background: #cca; |
| 20 |
} |
| 21 |
#layout { |
| 22 |
text-align: center; |
| 23 |
} |
| 24 |
</style> |
| 25 |
</head> |
| 26 |
<body> |
| 27 |
<table id="layout"> |
| 28 |
<tr> |
| 29 |
<td> |
| 30 |
<applet id="chart" code="AppletDemo.class" width="400" height="300" |
| 31 |
mayscript="mayscript" |
| 32 |
archive="batik-all.jar,xml-apis-dom3.jar"> |
| 33 |
Your browser doesn't seem to support Java applets, which is required |
| 34 |
for this demo. |
| 35 |
</applet> |
| 36 |
</td> |
| 37 |
<td> |
| 38 |
<table id="data"> |
| 39 |
<tr> |
| 40 |
<th>Expense</th><th>Amount</th> |
| 41 |
</tr> |
| 42 |
<tr> |
| 43 |
<td>Shoe</th> |
| 44 |
<td><input id="ShoeBar" type="text" value="10"></td> |
| 45 |
</tr> |
| 46 |
<tr> |
| 47 |
<td>Car</th> |
| 48 |
<td><input id="CarBar" type="text" value="20"></td> |
| 49 |
</tr> |
| 50 |
<tr> |
| 51 |
<td>Travel</th> |
| 52 |
<td><input id="TravelBar" type="text" value="10"></td> |
| 53 |
</tr> |
| 54 |
<tr> |
| 55 |
<td>Computer</th> |
| 56 |
<td><input id="ComputerBar" type="text" value="60"></td> |
| 57 |
</tr> |
| 58 |
</table> |
| 59 |
<p> |
| 60 |
<button onclick="update()">Update chart</button> |
| 61 |
</p> |
| 62 |
</td> |
| 63 |
</tr> |
| 64 |
</div> |
| 65 |
<script> |
| 66 |
var chart = document.getElementById("chart"); |
| 67 |
|
| 68 |
function update() { |
| 69 |
updateBar("ShoeBar"); |
| 70 |
updateBar("CarBar"); |
| 71 |
updateBar("TravelBar"); |
| 72 |
updateBar("ComputerBar"); |
| 73 |
} |
| 74 |
|
| 75 |
function updateBar(name) { |
| 76 |
var value = Number(document.getElementById(name).value); |
| 77 |
if (!isNaN(value) && value >= 0) { |
| 78 |
chart.updateBar(name, value); |
| 79 |
} |
| 80 |
} |
| 81 |
</script> |
| 82 |
</body> |
| 83 |
</html> |