xx.html 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. .xxs{ position: fixed; margin: 15px; right: 0; float: right; width: 400px; z-index: 4000; bottom: 0 } .dsp_none{ display: none; }
  2. <!-- flot -->
  3. <script type="text/javascript">
  4. //define chart clolors ( you maybe add more colors if you want or flot will add it automatic )
  5. var chartColours = ['#96CA59', '#3F97EB', '#72c380', '#6f7a8a', '#f7cb38', '#5a8022', '#2c7282'];
  6. //generate random number for charts
  7. randNum = function() {
  8. return (Math.floor(Math.random() * (1 + 40 - 20))) + 20;
  9. }
  10. $(function() {
  11. var d1 = [];
  12. //var d2 = [];
  13. //here we generate data for chart
  14. for (var i = 0; i < 30; i++) {
  15. d1.push([new Date(Date.today().add(i).days()).getTime(), randNum() + i + i + 10]);
  16. // d2.push([new Date(Date.today().add(i).days()).getTime(), randNum()]);
  17. }
  18. var chartMinDate = d1[0][0]; //first day
  19. var chartMaxDate = d1[20][0]; //last day
  20. var tickSize = [1, "day"];
  21. var tformat = "%d/%m/%y";
  22. //graph options
  23. var options = {
  24. grid: {
  25. show: true,
  26. aboveData: true,
  27. color: "#3f3f3f",
  28. labelMargin: 10,
  29. axisMargin: 0,
  30. borderWidth: 0,
  31. borderColor: null,
  32. minBorderMargin: 5,
  33. clickable: true,
  34. hoverable: true,
  35. autoHighlight: true,
  36. mouseActiveRadius: 100
  37. },
  38. series: {
  39. lines: {
  40. show: true,
  41. fill: true,
  42. lineWidth: 2,
  43. steps: false
  44. },
  45. points: {
  46. show: true,
  47. radius: 4.5,
  48. symbol: "circle",
  49. lineWidth: 3.0
  50. }
  51. },
  52. legend: {
  53. position: "ne",
  54. margin: [0, -25],
  55. noColumns: 0,
  56. labelBoxBorderColor: null,
  57. labelFormatter: function(label, series) {
  58. // just add some space to labes
  59. return label + '&nbsp;&nbsp;';
  60. },
  61. width: 40,
  62. height: 1
  63. },
  64. colors: chartColours,
  65. shadowSize: 0,
  66. tooltip: true, //activate tooltip
  67. tooltipOpts: {
  68. content: "%s: %y.0",
  69. xDateFormat: "%d/%m",
  70. shifts: {
  71. x: -30,
  72. y: -50
  73. },
  74. defaultTheme: false
  75. },
  76. yaxis: {
  77. min: 0
  78. },
  79. xaxis: {
  80. mode: "time",
  81. minTickSize: tickSize,
  82. timeformat: tformat,
  83. min: chartMinDate,
  84. max: chartMaxDate
  85. }
  86. };
  87. var plot = $.plot($("#placeholder33x"), [{
  88. label: "Email Sent",
  89. data: d1,
  90. lines: {
  91. fillColor: "rgba(150, 202, 89, 0.12)"
  92. }, //#96CA59 rgba(150, 202, 89, 0.42)
  93. points: {
  94. fillColor: "#fff"
  95. }
  96. }], options);
  97. });
  98. </script>
  99. <!-- /flot -->