Вход Регистрация
Файл: admin/skins/lib/flot/examples/selection.html
Строк: 113
<?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.selection.js"></script>
 </
head>
    <
body>
    <
h1>Flot Examples</h1>

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

    <
p>1000 kgCO<sub>2</subemissions per year per capita for various countries (source: <a href="http://en.wikipedia.org/wiki/List_of_countries_by_carbon_dioxide_emissions_per_capita">Wikipedia</a>).</p>

    <
p>Flot supports selections through the selection plugin.
       
You can enable rectangular selection
       
or one-dimensional selection if the user should only be able to
       select on one axis
. Try left-click and drag on the plot above
       where selection on the x axis is enabled
.</p>

    <
p>You selected: <span id="selection"></span></p>

    <
p>The plot command returns a plot object you can use to control
       the selection
Click the buttons below.</p>

    <
p><input id="clearSelection" type="button" value="Clear selection" />
       <
input id="setSelection" type="button" value="Select year 1994" /></p>

    <
p>Selections are really useful for zoomingJust replot the
       chart with min 
and max values for the axes set to the values
       in the 
"plotselected" event triggeredEnable the checkbox
       below 
and select a region again.</p>

    <
p><label><input id="zoom" type="checkbox" />Zoom to selection.</label></p>

<
script type="text/javascript">
$(function () {
    var 
data = [
        {
            
label"United States",
            
data: [[199018.9], [199118.7], [199218.4], [199319.3], [199419.5], [199519.3], [199619.4], [199720.2], [199819.8], [199919.9], [200020.4], [200120.1], [200220.0], [200319.8], [200420.4]]
        },
        {
            
label"Russia"
            
data: [[199213.4], [199312.2], [199410.6], [199510.2], [199610.1], [19979.7], [19989.5], [19999.7], [20009.9], [20019.9], [20029.9], [200310.3], [200410.5]]
        },
        {
            
label"United Kingdom",
            
data: [[199010.0], [199111.3], [19929.9], [19939.6], [19949.5], [19959.5], [19969.9], [19979.3], [19989.2], [19999.2], [20009.5], [20019.6], [20029.3], [20039.4], [20049.79]]
        },
        {
            
label"Germany",
            
data: [[199012.4], [199111.2], [199210.8], [199310.5], [199410.4], [199510.2], [199610.5], [199710.2], [199810.1], [19999.6], [20009.7], [200110.0], [20029.7], [20039.8], [20049.79]]
        },
        {
            
label"Denmark",
         
data: [[19909.7], [199112.1], [199210.3], [199311.3], [199411.7], [199510.6], [199612.8], [199710.8], [199810.3], [19999.4], [20008.7], [20019.0], [20028.9], [200310.1], [20049.80]]
        },
        {
            
label"Sweden",
            
data: [[19905.8], [19916.0], [19925.9], [19935.5], [19945.7], [19955.3], [19966.1], [19975.4], [19985.4], [19995.1], [20005.2], [20015.4], [20026.2], [20035.9], [20045.89]]
        },
        {
            
label"Norway",
            
data: [[19908.3], [19918.3], [19927.8], [19938.3], [19948.4], [19955.9], [19966.4], [19976.7], [19986.9], [19997.6], [20007.4], [20018.1], [200212.5], [20039.9], [200419.0]]
        }
    ];

    var 
options = {
        
series: {
            
lines: { showtrue },
            
points: { showtrue }
        },
        
legend: { noColumns},
        
xaxis: { tickDecimals},
        
yaxis: { min},
        
selection: { mode"x" }
    };

    var 
placeholder = $("#placeholder");

    
placeholder.bind("plotselected", function (eventranges) {
        $(
"#selection").text(ranges.xaxis.from.toFixed(1) + " to " ranges.xaxis.to.toFixed(1));

        var 
zoom = $("#zoom").attr("checked");
        if (
zoom)
            
plot = $.plot(placeholderdata,
                          $.
extend(true, {}, options, {
                              
xaxis: { minranges.xaxis.frommaxranges.xaxis.to }
                          }));
    });

    
placeholder.bind("plotunselected", function (event) {
        $(
"#selection").text("");
    });
    
    var 
plot = $.plot(placeholderdataoptions);

    $(
"#clearSelection").click(function () {
        
plot.clearSelection();
    });

    $(
"#setSelection").click(function () {
        
plot.setSelection({ xaxis: { from1994to1995 } });
    });
});
</
script>

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