Created
August 5, 2012 10:44
-
-
Save fankay/3263836 to your computer and use it in GitHub Desktop.
Flot画饼图
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="persons" style="width:300px;height:300px"></div> | |
<div id="moneys" style="width:300px;height:300px"></div> | |
<script src="js/jquery.js" type="text/javascript"></script> | |
<script src="js/bootstrap.min.js" type="text/javascript"></script> | |
<script src="js/flot/jquery.flot.min.js" type="text/javascript"></script> | |
<script src="js/flot/jquery.flot.pie.min.js" type="text/javascript"></script> | |
<script type="text/javascript"> | |
$(document).ready(function(){ | |
var data = [ | |
{ label: "单点", data: 225}, | |
{ label: "自助", data: 67} | |
]; | |
var data2 = [ | |
{ label: "单点", data: 3455}, | |
{ label: "自助", data: 56000} | |
]; | |
$.plot($("#persons"), data, | |
{ | |
series: { | |
pie: { | |
show: true, | |
label: { | |
show: true, | |
formatter: function(label, series){ | |
return '<div style="font-size:8pt;text-align:center;padding:2px;color:'+series.color+';">'+label+series.data[0][1]+'人</div>'; | |
} | |
} | |
} | |
}, | |
legend: { | |
show: false | |
} | |
}); | |
$.plot($("#moneys"), data2, | |
{ | |
series: { | |
pie: { | |
show: true, | |
label: { | |
show: true, | |
formatter: function(label, series){ | |
return '<div style="font-size:8pt;text-align:center;padding:2px;color:'+series.color+';">'+label+series.data[0][1]+'元</div>'; | |
} | |
} | |
} | |
}, | |
legend: { | |
show: false | |
} | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment