dark.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. (function (root, factory) {
  2. if (typeof define === 'function' && define.amd) {
  3. // AMD. Register as an anonymous module.
  4. define(['exports', 'echarts'], factory);
  5. } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
  6. // CommonJS
  7. factory(exports, require('echarts'));
  8. } else {
  9. // Browser globals
  10. factory({}, root.echarts);
  11. }
  12. }(this, function (exports, echarts) {
  13. var log = function (msg) {
  14. if (typeof console !== 'undefined') {
  15. console && console.error && console.error(msg);
  16. }
  17. };
  18. if (!echarts) {
  19. log('ECharts is not Loaded');
  20. return;
  21. }
  22. var contrastColor = '#eee';
  23. var axisCommon = function () {
  24. return {
  25. axisLine: {
  26. lineStyle: {
  27. color: contrastColor
  28. }
  29. },
  30. axisTick: {
  31. lineStyle: {
  32. color: contrastColor
  33. }
  34. },
  35. axisLabel: {
  36. textStyle: {
  37. color: contrastColor
  38. }
  39. },
  40. splitLine: {
  41. lineStyle: {
  42. type: 'dashed',
  43. color: '#aaa'
  44. }
  45. },
  46. splitArea: {
  47. areaStyle: {
  48. color: contrastColor
  49. }
  50. }
  51. };
  52. };
  53. var colorPalette = ['#dd6b66','#759aa0','#e69d87','#8dc1a9','#ea7e53','#eedd78','#73a373','#73b9bc','#7289ab', '#91ca8c','#f49f42'];
  54. var theme = {
  55. color: colorPalette,
  56. backgroundColor: '#333',
  57. tooltip: {
  58. axisPointer: {
  59. lineStyle: {
  60. color: contrastColor
  61. },
  62. crossStyle: {
  63. color: contrastColor
  64. }
  65. }
  66. },
  67. legend: {
  68. textStyle: {
  69. color: contrastColor
  70. }
  71. },
  72. textStyle: {
  73. color: contrastColor
  74. },
  75. title: {
  76. textStyle: {
  77. color: contrastColor
  78. }
  79. },
  80. toolbox: {
  81. iconStyle: {
  82. normal: {
  83. borderColor: contrastColor
  84. }
  85. }
  86. },
  87. timeline: {
  88. lineStyle: {
  89. color: contrastColor
  90. },
  91. itemStyle: {
  92. normal: {
  93. color: colorPalette[1]
  94. }
  95. },
  96. label: {
  97. normal: {
  98. textStyle: {
  99. color: contrastColor
  100. }
  101. }
  102. },
  103. controlStyle: {
  104. normal: {
  105. color: contrastColor,
  106. borderColor: contrastColor
  107. }
  108. }
  109. },
  110. timeAxis: axisCommon(),
  111. logAxis: axisCommon(),
  112. valueAxis: axisCommon(),
  113. categoryAxis: axisCommon(),
  114. line: {
  115. symbol: 'circle'
  116. },
  117. graph: {
  118. color: colorPalette
  119. },
  120. gauge: {
  121. title: {
  122. textStyle: {
  123. color: contrastColor
  124. }
  125. }
  126. }
  127. };
  128. theme.categoryAxis.splitLine.show = false;
  129. echarts.registerTheme('dark', theme);
  130. }));