egroupware/phpgwapi/js/jquery/jqplot/examples/donutTest.html

200 lines
7.0 KiB
HTML
Raw Normal View History

2011-08-10 01:10:50 +02:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Donut Chart Test</title>
<!--[if lt IE 9]><script language="javascript" type="text/javascript" src="../excanvas.js"></script><![endif]-->
<link rel="stylesheet" type="text/css" href="../jquery.jqplot.min.css" />
2011-08-10 01:10:50 +02:00
<link rel="stylesheet" type="text/css" href="examples.css" />
<!-- BEGIN: load jquery -->
<script language="javascript" type="text/javascript" src="../jquery.min.js"></script>
2011-08-10 01:10:50 +02:00
<!-- END: load jquery -->
<!-- BEGIN: load jqplot -->
<script language="javascript" type="text/javascript" src="../jquery.jqplot.min.js"></script>
<script language="javascript" type="text/javascript" src="../plugins/jqplot.donutRenderer.min.js"></script>
2011-08-10 01:10:50 +02:00
<!-- END: load jqplot -->
<script type="text/javascript" src="donutTest.js"></script>
<style type="text/css">
#code {
font: 10pt "Andale Mono", Monaco, "Courier New", sans-serif ;
white-space: pre;
}
</style>
<script type="text/javascript" class="code">
$(document).ready(function(){
2011-08-10 01:10:50 +02:00
$.jqplot.config.enablePlugins = true;
s1 = [['a',2], ['b',8], ['c',14], ['d',20]];
s2 = [['a', 4], ['b', 12], ['c', 6], ['d', 3]];
s3 = [['a', 2], ['b', 1], ['c', 3], ['d', 3]];
s4 = [['a', 4], ['b', 3], ['c', 2], ['d', 1]];
s5 = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];
plot1 = $.jqplot('chart1', [s1], {
seriesDefaults:{
renderer:$.jqplot.DonutRenderer
},
legend: {show:true}
});
$('#chart1').bind('jqplotDataClick',
function (ev, seriesIndex, pointIndex, data) {
$('#info1').html('series: '+seriesIndex+', point: '+pointIndex+', data: '+data);
}
);
$(document).unload(function() {$('*').unbind(); });
});
</script>
<script type="text/javascript" class="code">
$(document).ready(function(){
plot2 = $.jqplot('chart2', [s1, s2], {
seriesDefaults: {
renderer:$.jqplot.DonutRenderer,
rendererOptions:{
sliceMargin: 2,
innerDiameter: 110,
startAngle: -90
}
}
});
$('#chart2').bind('jqplotDataHighlight',
function (ev, seriesIndex, pointIndex, data) {
$('#info2').html('series: '+seriesIndex+', point: '+pointIndex+', data: '+data);
}
);
$('#chart2').bind('jqplotDataUnhighlight',
function (ev) {
$('#info2').html('Nothing');
}
);
});
</script>
<script type="text/javascript" class="code">
$(document).ready(function(){
plot3 = $.jqplot('chart3', [s1, s2, s3], {
captureRightClick: true,
seriesDefaults:{
renderer:$.jqplot.DonutRenderer,
shadow: false,
rendererOptions:{
innerDiameter: 110,
startAngle: -90,
sliceMargin: 2,
highlightMouseDown: true
}
},
legend: {
show: true,
location: 'e',
placement: 'outside'
}
2011-08-10 01:10:50 +02:00
});
$('#chart3').bind('jqplotDataRightClick',
function (ev, seriesIndex, pointIndex, data) {
$('#info3').html('series: '+seriesIndex+', point: '+pointIndex+', data: '+data);
}
);
});
</script>
<script type="text/javascript" class="code">
$(document).ready(function(){
plot4 = $.jqplot('chart4', [s1, s2, s3, s4], {
seriesDefaults:{
renderer:$.jqplot.DonutRenderer
},
legend: {
show: true,
location: 's',
placement: 'outside',
rendererOptions:{
numberRows: 1
}
}
});
});
</script>
<script type="text/javascript" class="code">
$(document).ready(function(){
plot5 = $.jqplot('chart5', [s5], {
seriesDefaults:{
renderer:$.jqplot.DonutRenderer
}
});
});
</script>
<script type="text/javascript" class="code">
$(document).ready(function(){
plot6 = $.jqplot('chart6', [[1,2,3,4]]);
});
</script>
<script type="text/javascript" src="example.js"></script>
2011-08-10 01:10:50 +02:00
</head>
<body>
<?php include "topbanner.inc"; ?>
<div class="example-content">
<?php include "nav.inc"; ?>
2011-08-10 01:10:50 +02:00
<div id="code"></div>
<p>To create donut plots, you have to include the "jqplot.donutRenderer.min.js" file in your source.</p>
2011-08-10 01:10:50 +02:00
<p>Below is a default donut plot. Slices will highlight on mouseover. Events are triggered when you mouseover a slice and also when you click on a slice. Here We capture the 'jqplotDataClick' event and display the clicked series index, point index and data values.<p>
<div><span>You Clicked: </span><span id="info1">Nothing yet</span></div>
<div id="chart1" style="margin-top:20px; margin-left:20px; width:300px; height:300px;"></div>
<p>Below is a customized donut plot with 2 series. Renderer options for sliceMargin, innerDiameter, and startAngle have been specified. Here We capture the 'jqplotDataHighlight' event and display the currently highlighted series index, point index and data values.<p>
<p>The plot target also fires a 'jqplotDataMouseOver' when the cursor is moused over a slice even if highlighting is turned off. This event will fire continuously as the user mouses over the slice. 'jqplotDataHighlight' fires only once when the user first passes over the slice. Additionally, a 'jqplotDataUnhighlight' event is fired when the user moves out of a slice (if highlighting is enabled).<p>
<div><span>Moused Over: </span><span id="info2">Nothing</span></div>
<div id="chart2" style="margin-top:20px; margin-left:20px; width:300px; height:300px;"></div>
<p>The next example has the plot's 'captureRightClick' option set to true. This causes the plot to fire a 'jqplotRightClick' event the the user clicks the right mouse button over a slice. Note, click highlighting is the same for both right and left clicks, although separate events are triggered.<p>
<div><span>You Right Clicked: </span><span id="info3">Nothing yet</span></div>
<div id="chart3" style="margin-top:20px; margin-left:20px; width:300px; height:300px;"></div>
<p>The fourth example shows a plot with no sliceMargin and with the shadow turned on.</p>
<div id="chart4" style="margin-top:20px; margin-left:20px; width:300px; height:300px;"></div>
<p style="margin-top:40px;">The last example shows a donut with all of the default colors. Mouse over to see the default highlight colors. Series colors can be specified with the "seriesColors" option on the plot or on the series. The highlight colors are specified with the 'highlightColors' option on the series renderer.</p>
<div id="chart5" style="margin-top:20px; margin-left:20px; width:400px; height:400px;"></div>
<p>A simple line chart is added to test for imcompatabilities.</p>
<div id="chart6" style="margin-top:20px; margin-left:20px; width:100px; height:100px;"></div>
</div>
</body>
2011-08-10 01:10:50 +02:00
</html>