Hey,
Thanks. The js files are right at the top and jquery is before flot.
Remember that the graph draws when it's a completely new window or a
control F5 refresh, but not on a regular refresh or from the onchange
method of a select on the same page.
I'll post my code in case there's something obvious that I'm missing.
If it didn't work all the time I'd understand but not why in one
situation it works and not others. I'll try firebug like you suggest
too.
Code below:
<head>
<script type="text/javascript" src="/js/jquery.min.js"></script>
<script type="text/javascript" src="/js/jquery.flot.min.js"></script>
<script type="text/javascript" src="/js/excanvas.min.js"></script>
<script type="text/javascript" src="/js/date.js"></script>
<script type="text/javascript" src="/js/jquery.datePicker.js"></
script>
<script type="text/javascript" src="/js/jquery.getUrlParam.js"></
script>
<link rel="stylesheet" type="text/css" media="screen" href="/css/
datePicker.css">
<link rel="stylesheet" type="text/css" media="screen" href="/css/
imdba.css">
<link rel="stylesheet" type="text/css" media="screen"
href="capacity_graphs.css">
<script type="text/javascript">
var ds;
$(function(){
$("#menu").load('/menu.html');
var db=$(document).getUrlParam('db');
ds=$(document).getUrlParam('ds');
populateStats(ds,db);
$.getJSON("/sybase/get_used_data.php",{db: db, ds: ds, ajax:
'true'},function(data) {
$.plot($("#graph"), data, { xaxis: { mode: "time" }, legend:
{position: "nw",opacity: 0.5} });});
$('.date-pick').datePicker({startDate:$
("input#datefrom").val(),endDate:$("input#dateto").val()});
$.getJSON("get_db_by_ds.php",{server: ds, ajax: 'true'},
function(j){
var options = '';
for (var i = 0; i < j.length; i++) {
if (j[i].optionValue != db) {
options += '<option value="' + j[i].optionValue + '">' +
j[i].optionDisplay + '</option>';
}
else {
options += '<option value="' + j[i].optionValue + '"
selected>' + j[i].optionDisplay + '</option>';
}
}
$("select#database").html(options);
changeGraph('yes');
});
});
function populateStats(arg1,arg2,arg3) {
$.getJSON("get_db_stats.php",{server: arg1,db: arg2,ajax: 'true'},
function(j){
$('td#dataused').html(j[0].data_used);
$('td#datatotal').html(j[0].data_total);
$('td#pctused').html(j[0].percent_used+"%");
if (j[0].days_remaining == "0") {
$('td#daysremaining').html("No Growth");
}
else {
$('td#daysremaining').html(j[0].days_remaining);
};
if (arg3 == "yes") {
$('input#datefrom').val(j[0].mindate);
$('input#dateto').val(j[0].maxdate);
};
});
}
function detachGraph() {
window.open($('#graph img').attr('src'),$
('#database').val(),'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=720,height=520,left=290,top=100');
}
function changeGraph(arg1) {
$.getJSON("/sybase/get_used_data.php",{db: $('#database').val(), ds:
ds, ajax: 'true'},function(data) {
$.plot($("#graph"), data, { xaxis: { mode: "time" }, legend:
{position: "nw",opacity: 0.5} });});
populateStats(ds,$('#database').val(),arg1);
}
</script>
</head>
<body>
<div id=menu></div>
<div id=main class=main>
<div id="graph" style="width:650px;height:450px;">
</div>
<div id=inputs>
<form id=dates>
<li><label for="datefrom" class="shortwidth">Date From:</label>
<input id=datefrom name=datefrom class="date-pick" value="$datefrom"
onChange="changeGraph('no');"></li>
<li><label for="dateto" class="shortwidth">Date To:</label>
<input id=dateto name=dateto class="date-pick" value="$dateto"
onChange="changeGraph('no');"></li>
<li><label for="database" class="shortwidth">Database:</label>
<select id=database name=database style="width:185px"
onChange="changeGraph('yes');">
</select></li>
</form>
</div>
<div id=info>
<font class=heading>Current Stats</font>
<table>
<tr><td>Data Used (MB):</td><td id=dataused></td></tr>
<tr><td>Data Total (MB):</td><td id=datatotal></td></tr>
<tr><td>Utilisation:</td><td id=pctused></td></tr>
<tr><td>Days Remaining:</td><td id=daysremaining></td></tr>
</table>
</div>
</div>
</body>
On May 12, 10:01 pm, "George Roberts" <
gr-googlegrp...@spamarrest.com>
wrote:
> There's just too many possibilities. Most of which involve some kind of
> javascript error occurring that blocks javascript from including flot (or
> possibly jquery). I recommend putting the .js files as high as possible in your
> code and also getting firebug in firefox and stopping on error. Make sure the
> jquery line is above the flot line.
>
> - George Robertshttp://
gr5.org