peity.js 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. (function (global, factory) {
  2. if (typeof define === "function" && define.amd) {
  3. define("/charts/peity", ["jquery", "Site"], factory);
  4. } else if (typeof exports !== "undefined") {
  5. factory(require("jquery"), require("Site"));
  6. } else {
  7. var mod = {
  8. exports: {}
  9. };
  10. factory(global.jQuery, global.Site);
  11. global.chartsPeity = mod.exports;
  12. }
  13. })(this, function (_jquery, _Site) {
  14. "use strict";
  15. _jquery = babelHelpers.interopRequireDefault(_jquery);
  16. (0, _jquery.default)(document).ready(function ($$$1) {
  17. (0, _Site.run)();
  18. }); // Example Peity Default
  19. // ---------------------
  20. (function () {
  21. /* dynamic example */
  22. var dynamicChart = (0, _jquery.default)("#examplePeityDynamic").peity("line", {
  23. width: 64,
  24. fill: [Config.colors("primary", 200)],
  25. stroke: Config.colors("primary", 500),
  26. height: 22
  27. });
  28. setInterval(function () {
  29. var random = Math.round(Math.random() * 10);
  30. var values = dynamicChart.text().split(",");
  31. values.shift();
  32. values.push(random);
  33. dynamicChart.text(values.join(",")).change();
  34. }, 1000);
  35. })(); // Example Peity Red
  36. // -------------------
  37. (function () {
  38. /* dynamic example */
  39. var dynamicRedChart = (0, _jquery.default)("#examplePeityDynamicRed").peity("line", {
  40. width: 64,
  41. fill: [Config.colors("red", 200)],
  42. stroke: Config.colors("red", 500),
  43. height: 22
  44. });
  45. setInterval(function () {
  46. var random = Math.round(Math.random() * 10);
  47. var values = dynamicRedChart.text().split(",");
  48. values.shift();
  49. values.push(random);
  50. dynamicRedChart.text(values.join(",")).change();
  51. }, 1000);
  52. })(); // Example Peity Green
  53. // -------------------
  54. (function () {
  55. /* dynamic example */
  56. var dynamicGreenChart = (0, _jquery.default)("#examplePeityDynamicGreen").peity("line", {
  57. width: 64,
  58. fill: [Config.colors("green", 200)],
  59. stroke: Config.colors("green", 500),
  60. height: 22
  61. });
  62. setInterval(function () {
  63. var random = Math.round(Math.random() * 10);
  64. var values = dynamicGreenChart.text().split(",");
  65. values.shift();
  66. values.push(random);
  67. dynamicGreenChart.text(values.join(",")).change();
  68. }, 1000);
  69. })(); // Example Peity Orange
  70. // --------------------
  71. (function () {
  72. /* dynamic example */
  73. var dynamicOrangeChart = (0, _jquery.default)("#examplePeityDynamicOrange").peity("line", {
  74. width: 64,
  75. fill: [Config.colors("orange", 200)],
  76. stroke: Config.colors("orange", 500),
  77. height: 22
  78. });
  79. setInterval(function () {
  80. var random = Math.round(Math.random() * 10);
  81. var values = dynamicOrangeChart.text().split(",");
  82. values.shift();
  83. values.push(random);
  84. dynamicOrangeChart.text(values.join(",")).change();
  85. }, 1000);
  86. })();
  87. });