egroupware_official/phpgwapi/js/jquery/jqplot/examples/example.js
Nathan Gray f8489c0ed1 Update jqplot to
jquery.jqplot.1.0.0b2_r947
2011-11-07 20:37:55 +00:00

61 lines
2.2 KiB
JavaScript

$(document).ready(function(){
$('script.code').each(function(index) {
if ($('pre.code').eq(index).length ) {
$('pre.code').eq(index).text($(this).html());
}
else {
var str = $(this).html();
$('div.jqplot-target').eq(index).after($('<pre class="code">'+str+'</pre>'));
}
});
$(document).unload(function() {$('*').unbind(); });
if (!$.jqplot.use_excanvas) {
$('div.jqplot-target').each(function(){
var outerDiv = $(document.createElement('div'));
var header = $(document.createElement('div'));
var div = $(document.createElement('div'));
outerDiv.append(header);
outerDiv.append(div);
outerDiv.addClass('jqplot-image-container');
header.addClass('jqplot-image-container-header');
div.addClass('jqplot-image-container-content');
header.html('Right Click to Save Image As...');
var close = $(document.createElement('a'));
close.addClass('jqplot-image-container-close');
close.html('Close');
close.attr('href', '#');
close.click(function() {
$(this).parents('div.jqplot-image-container').hide(500);
})
header.append(close);
$(this).after(outerDiv);
outerDiv.hide();
outerDiv = header = div = close = null;
if (!$.jqplot._noToImageButton) {
var btn = $(document.createElement('button'));
btn.text('View Plot Image');
btn.addClass('jqplot-image-button');
btn.bind('click', {chart: $(this)}, function(evt) {
var imgelem = evt.data.chart.jqplotToImageElem();
var div = $(this).nextAll('div.jqplot-image-container').first();
div.children('div.jqplot-image-container-content').empty();
div.children('div.jqplot-image-container-content').append(imgelem);
div.show(500);
div = null;
});
$(this).after(btn);
btn.after('<br />');
btn = null;
}
});
}
});