dark.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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. dataZoom: {
  88. textStyle: {
  89. color: contrastColor
  90. }
  91. },
  92. visualMap: {
  93. textStyle: {
  94. color: contrastColor
  95. }
  96. },
  97. timeline: {
  98. lineStyle: {
  99. color: contrastColor
  100. },
  101. itemStyle: {
  102. normal: {
  103. color: colorPalette[1]
  104. }
  105. },
  106. label: {
  107. normal: {
  108. textStyle: {
  109. color: contrastColor
  110. }
  111. }
  112. },
  113. controlStyle: {
  114. normal: {
  115. color: contrastColor,
  116. borderColor: contrastColor
  117. }
  118. }
  119. },
  120. timeAxis: axisCommon(),
  121. logAxis: axisCommon(),
  122. valueAxis: axisCommon(),
  123. categoryAxis: axisCommon(),
  124. line: {
  125. symbol: 'circle'
  126. },
  127. graph: {
  128. color: colorPalette
  129. },
  130. gauge: {
  131. title: {
  132. textStyle: {
  133. color: contrastColor
  134. }
  135. }
  136. },
  137. candlestick: {
  138. itemStyle: {
  139. normal: {
  140. color: '#FD1050',
  141. color0: '#0CF49B',
  142. borderColor: '#FD1050',
  143. borderColor0: '#0CF49B'
  144. }
  145. }
  146. }
  147. };
  148. theme.categoryAxis.splitLine.show = false;
  149. echarts.registerTheme('dark', theme);
  150. }));