/administrator/components/com_easysocial/themes/default/easysocial/widget.registration.js

https://gitlab.com/vnsoftdev/swc · JavaScript · 117 lines · 99 code · 16 blank · 2 comment · 9 complexity · c9be87f6820ad0ce41f3008b0647f539 MD5 · raw file

  1. EasySocial.require()
  2. .library( 'flot' )
  3. .done(function($){
  4. var data = new Array;
  5. <?php for( $i = 0; $i < count($signupData->profiles ); $i++ ){ ?>
  6. var tmp = new Array;
  7. <?php for($x = 0; $x < count( $signupData->profiles[ $i ]->items ); $x++ ){ ?>
  8. tmp.push( [<?php echo $x;?>, <?php echo $signupData->profiles[ $i ]->items[ $x ];?>] );
  9. <?php } ?>
  10. var obj = {
  11. data : tmp,
  12. label : "<?php echo $signupData->profiles[ $i ]->title;?>"
  13. };
  14. data.push( obj );
  15. <?php } ?>
  16. $( '[data-chart-registration]' ).plot( data ,
  17. {
  18. lines:
  19. {
  20. show : true,
  21. fill : true,
  22. lineWidth : 2
  23. },
  24. legend:
  25. {
  26. sorted: "asc",
  27. noColumns: 7,
  28. container: $("[data-chart-registration-legend]" ),
  29. backgroundColor: "#fff",
  30. backgroundOpacity: 1
  31. },
  32. xaxis:
  33. {
  34. ticks:
  35. [
  36. <?php for( $i = 0; $i < count( $axes ); $i++ ){ ?>
  37. [ <?php echo $i;?> , '<?php echo $axes[ $i ];?>' ]<?php echo ($i + 1) != 7 ? ',' : '';?>
  38. <?php } ?>
  39. ]
  40. },
  41. points:
  42. {
  43. show : true,
  44. fill : true,
  45. lineWidth : 4
  46. },
  47. grid:
  48. {
  49. clickable: true,
  50. hoverable: true,
  51. autoHighlight: true,
  52. mouseActiveRadius: 10,
  53. aboveData: true,
  54. backgroundColor: "#fff",
  55. borderWidth: 0,
  56. borderColor: "#fc0",
  57. minBorderMargin: 25,
  58. },
  59. // colors: [ "rgba(77,175,140,0.5)", "rgba(178,189,199,0.5)", "#609", "#900"],
  60. shadowSize: 0
  61. });
  62. var previousPoint = null,
  63. previousLabel = null;
  64. $( '[data-chart-registration]' ).bind( 'plothover' , function( event , pos , item )
  65. {
  66. if( item )
  67. {
  68. if( previousPoint != item.dataIndex || previousLabel != item.series.label )
  69. {
  70. previousPoint = item.dataIndex;
  71. previousLabel = item.series.label;
  72. $("#tooltip").remove();
  73. var x = item.datapoint[0],
  74. y = item.datapoint[1];
  75. window.showTooltip( item.pageX, item.pageY, y + ' ' + '<?php echo JText::_('COM_EASYSOCIAL_USERS');?>' );
  76. }
  77. }
  78. else
  79. {
  80. $( '#tooltip' ).remove();
  81. previousPoint = null;
  82. }
  83. });
  84. // Show tooltip
  85. window.showTooltip = function( x , y , contents )
  86. {
  87. $( '<div id="tooltip">' + contents + '</div>' )
  88. .css(
  89. {
  90. position: "absolute",
  91. display: "none",
  92. top: y + 5,
  93. left: x + 5,
  94. padding: "5px",
  95. 'background-color' : '#000',
  96. 'font-size' : '10',
  97. color: '#fff',
  98. opacity: 0.80
  99. }).appendTo( 'body' ).fadeIn( 200 );
  100. };
  101. });