pieTest2.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. $(document).ready(function(){
  2. $.jqplot.config.enablePlugins = true;
  3. s1 = [['a',2], ['b',6], ['c',7], ['d',10]];
  4. s2 = [['a', 4], ['b', 7], ['c', 6], ['d', 3]];
  5. s3 = [['a', 2], ['b', 1], ['c', 3], ['d', 3]];
  6. s4 = [['a', 4], ['b', 3], ['c', 2], ['d', 1]];
  7. s5 = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];
  8. plot1 = $.jqplot('chart1', [s1], {
  9. seriesDefaults:{
  10. renderer:$.jqplot.PieRenderer
  11. },
  12. legend: {show:true}
  13. });
  14. plot2 = $.jqplot('chart2', [s2], {
  15. seriesDefaults: {
  16. renderer:$.jqplot.PieRenderer,
  17. rendererOptions:{
  18. sliceMargin: 4,
  19. startAngle: -90
  20. }
  21. }
  22. });
  23. plot3 = $.jqplot('chart3', [s3], {
  24. captureRightClick: true,
  25. seriesDefaults:{
  26. renderer:$.jqplot.PieRenderer,
  27. shadow: false,
  28. rendererOptions:{
  29. startAngle: 90,
  30. sliceMargin: 4,
  31. highlightMouseDown: true
  32. }
  33. },
  34. legend: {
  35. show: true,
  36. location: 'e',
  37. placement: 'outside'
  38. }
  39. });
  40. plot5 = $.jqplot('chart5', [s5], {
  41. seriesDefaults:{
  42. renderer:$.jqplot.PieRenderer
  43. }
  44. });
  45. plot6 = $.jqplot('chart6', [[1,2,3,4]]);
  46. $('#chart1').bind('jqplotDataClick',
  47. function (ev, seriesIndex, pointIndex, data) {
  48. $('#info1').html('series: '+seriesIndex+', point: '+pointIndex+', data: '+data);
  49. }
  50. );
  51. $('#chart2').bind('jqplotDataHighlight',
  52. function (ev, seriesIndex, pointIndex, data) {
  53. $('#info2').html('series: '+seriesIndex+', point: '+pointIndex+', data: '+data);
  54. }
  55. );
  56. $('#chart2').bind('jqplotDataUnhighlight',
  57. function (ev) {
  58. $('#info2').html('Nothing');
  59. }
  60. );
  61. $('#chart3').bind('jqplotDataRightClick',
  62. function (ev, seriesIndex, pointIndex, data) {
  63. $('#info3').html('series: '+seriesIndex+', point: '+pointIndex+', data: '+data);
  64. }
  65. );
  66. $(document).unload(function() {$('*').unbind(); });
  67. });