You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

110 lines
3.3 KiB

1 year ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. "use strict";
  2. $(document).ready(function() {
  3. /*Line*/
  4. $(".linechart").sparkline([5, 6, 7, 9, 9, 5, 3, 2, 2, 4, 6, 7], {
  5. type: 'line',
  6. width: '100%',
  7. height: '300px',
  8. tooltipClassname: 'chart-sparkline',
  9. lineColor: 'rgba(249, 123, 85, 0.92)',
  10. fillColor: 'rgba(251, 154, 125, 0.50)',
  11. spotColor: '#bdc3c7'
  12. });
  13. /*Bar*/
  14. $(".barchart").sparkline([5, 2, 2, 4, 9, 5, 7, 5, 2, 2, 6], {
  15. type: 'bar',
  16. barWidth: '40px',
  17. height: '300px',
  18. tooltipClassname: 'chart-sparkline',
  19. barColor: 'rgba(153, 214, 131, 0.80)'
  20. });
  21. /*Pie*/
  22. $(".piechart").sparkline([1, 1, 2, 5], {
  23. type: 'pie',
  24. width: '100%',
  25. height: '300px',
  26. sliceColors: ['#9675CE', '#83D6DE', '#FEC107', '#4C5667', '#FB9678', '#01C0C8', '#F3F3F3', '#B4C1D7'],
  27. tooltipClassname: 'chart-sparkline'
  28. });
  29. /*Mouse Speed*/
  30. var mrefreshinterval = 500; // update display every 500ms
  31. var lastmousex = -1;
  32. var lastmousey = -1;
  33. var lastmousetime;
  34. var mousetravel = 0;
  35. var mpoints = [];
  36. var mpoints_max = 30;
  37. $('body').mousemove(function(e) {
  38. var mousex = e.pageX;
  39. var mousey = e.pageY;
  40. if (lastmousex > -1)
  41. mousetravel += Math.max(Math.abs(mousex - lastmousex), Math.abs(mousey - lastmousey));
  42. lastmousex = mousex;
  43. lastmousey = mousey;
  44. });
  45. var mdraw = function() {
  46. var md = new Date();
  47. var timenow = md.getTime();
  48. if (lastmousetime && lastmousetime != timenow) {
  49. var pps = Math.round(mousetravel / (timenow - lastmousetime) * 1000);
  50. mpoints.push(pps);
  51. if (mpoints.length > mpoints_max)
  52. mpoints.splice(0, 1);
  53. mousetravel = 0;
  54. var mouse_wid = $('#mousespeed').parent('.card-block').parent().width();
  55. var a = mpoints - mouse_wid;
  56. $('#mousespeed').sparkline(mpoints, {
  57. width: '100%',
  58. height: '300px',
  59. tooltipClassname: 'chart-sparkline',
  60. tooltipSuffix: 'pixels per second',
  61. lineColor: 'rgb(1, 192, 200)',
  62. fillColor: 'rgba(1, 192, 200, 0.38)'
  63. });
  64. }
  65. lastmousetime = timenow;
  66. mtimer = setTimeout(mdraw, mrefreshinterval);
  67. }
  68. var mtimer = setTimeout(mdraw, mrefreshinterval); // We could use setInterval instead, but I prefer To Do it this way
  69. $.sparkline_display_visible();
  70. /*custom line chart*/
  71. $(".customchart").sparkline([15, 30, 27, 35, 50, 71, 60], {
  72. type: 'line',
  73. width: '100%',
  74. height: '300px',
  75. tooltipClassname: 'chart-sparkline',
  76. chartRangeMax: '50',
  77. lineColor: '#4ddbf5',
  78. fillColor: '#B8F4FF'
  79. });
  80. $(".customchart").sparkline([0, 5, 10, 7, 25, 35, 30], {
  81. type: 'line',
  82. width: '100%',
  83. height: '300px',
  84. composite: '!0',
  85. tooltipClassname: 'chart-sparkline',
  86. chartRangeMax: '40',
  87. lineColor: '#48a3ec',
  88. fillColor: '#9FCAED'
  89. });
  90. /* Tristate chart */
  91. $(".tristate").sparkline([1, 1, 0, 1, -1, -1, 1, -1, 0, 0, 1, 1], {
  92. type: 'tristate',
  93. height: '300',
  94. posBarColor: '#4CD4B0',
  95. negBarColor: '#FDCDBE',
  96. zeroBarColor: '#E7DF86',
  97. barWidth: 30
  98. });
  99. });