Вход Регистрация
Файл: admin/skins/lib/flot/examples/navigate.html
Строк: 115
<?php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<
html>
 <
head>
    <
meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <
title>Flot Examples</title>
    <
link href="layout.css" rel="stylesheet" type="text/css">
    <!--[if 
lte IE 8]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->
    <
script language="javascript" type="text/javascript" src="../jquery.js"></script>
    <
script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>
    <
script language="javascript" type="text/javascript" src="../jquery.flot.navigate.js"></script>
    <
style type="text/css">
    
#placeholder .button {
        
positionabsolute;
        
cursorpointer;
    }
    
#placeholder div.button {
        
font-sizesmaller;
        
color#999;
        
background-color#eee;
        
padding2px;
    }
    .
message {
        
padding-left50px;
        
font-sizesmaller;
    }
    </
style>
 </
head>
 <
body>
    <
h1>Flot Examples</h1>

    <
div id="placeholder" style="width:600px;height:300px;"></div>

    <
class="message"></p>

    <
p>With the navigate plugin it is easy to add panning and zooming.
    
Drag to pandouble click to zoom (or use the mouse scrollwheel).</p>

    <
p>The plugin fires events (useful for synchronizing several
    plots
) and adds a couple of public methods so you can easily build
    a little user 
interface around itlike the little buttons at the
    top right in the plot
.</p>
    

<
script type="text/javascript">
$(function () {
    
// generate data set from a parametric function with a fractal
    // look
    
function sumf(ftm) {
        var 
res 0;
        for (var 
1m; ++i)
            
res += f(t) / (i);
        return 
res;
    }
    
    var 
d1 = [];
    for (var 
0<= Math.PI+= 0.01)
        
d1.push([sumf(Math.cost10), sumf(Math.sint10)]);
    var 
data = [ d1 ];

    
    var 
placeholder = $("#placeholder");
    var 
options = {
        
series: { lines: { showtrue }, shadowSize},
        
xaxis: { zoomRange: [0.110], panRange: [-1010] },
        
yaxis: { zoomRange: [0.110], panRange: [-1010] },
        
zoom: {
            
interactivetrue
        
},
        
pan: {
            
interactivetrue
        
}
    };

    var 
plot = $.plot(placeholderdataoptions);

    
// show pan/zoom messages to illustrate events 
    
placeholder.bind('plotpan', function (eventplot) {
        var 
axes plot.getAxes();
        $(
".message").html("Panning to x: "  axes.xaxis.min.toFixed(2)
                           + 
" &ndash; " axes.xaxis.max.toFixed(2)
                           + 
" and y: " axes.yaxis.min.toFixed(2)
                           + 
" &ndash; " axes.yaxis.max.toFixed(2));
    });

    
placeholder.bind('plotzoom', function (eventplot) {
        var 
axes plot.getAxes();
        $(
".message").html("Zooming to x: "  axes.xaxis.min.toFixed(2)
                           + 
" &ndash; " axes.xaxis.max.toFixed(2)
                           + 
" and y: " axes.yaxis.min.toFixed(2)
                           + 
" &ndash; " axes.yaxis.max.toFixed(2));
    });

    
// add zoom out button 
    
$('<div class="button" style="right:20px;top:20px">zoom out</div>').appendTo(placeholder).click(function (e) {
        
e.preventDefault();
        
plot.zoomOut();
    });

    
// and add panning buttons
    
    // little helper for taking the repetitive work out of placing
    // panning arrows
    
function addArrow(dirrighttopoffset) {
        $(
'<img class="button" src="arrow-' dir '.gif" style="right:' right 'px;top:' top 'px">').appendTo(placeholder).click(function (e) {
            
e.preventDefault();
            
plot.pan(offset);
        });
    }

    
addArrow('left'5560, { left: -100 });
    
addArrow('right'2560, { left100 });
    
addArrow('up'4045, { top: -100 });
    
addArrow('down'4075, { top100 });
});
</
script>

 </
body>
</
html>
?>
Онлайн: 1
Реклама