gauges.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. (function (global, factory) {
  2. if (typeof define === "function" && define.amd) {
  3. define("/charts/gauges", ["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.chartsGauges = 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 Gauge Dynamic
  19. // ---------------------
  20. (0, _jquery.default)(document).ready(function ($$$1) {
  21. var dynamicGauge = $$$1("#exampleDynamicGauge").data('gauge');
  22. setInterval(function () {
  23. var random = Math.round(Math.random() * 1000);
  24. var options = {
  25. strokeColor: Config.colors("primary", 500)
  26. };
  27. if (random > 700) {
  28. options.strokeColor = Config.colors("pink", 500);
  29. } else if (random < 300) {
  30. options.strokeColor = Config.colors("green", 500);
  31. }
  32. dynamicGauge.setOptions(options).set(random);
  33. }, 1500);
  34. }); // Example Donut Dynamic
  35. // ---------------------
  36. (0, _jquery.default)(document).ready(function ($$$1) {
  37. var dynamicDonut = $$$1("#exampleDynamicDonut").data('donut');
  38. setInterval(function () {
  39. var random = Math.round(Math.random() * 1000);
  40. var options = {
  41. strokeColor: Config.colors("primary", 500)
  42. };
  43. if (random > 700) {
  44. options.strokeColor = Config.colors("pink", 500);
  45. } else if (random < 300) {
  46. options.strokeColor = Config.colors("green", 500);
  47. }
  48. dynamicDonut.setOptions(options).set(random);
  49. }, 1500);
  50. });
  51. });