dark.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing,
  13. * software distributed under the License is distributed on an
  14. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. * KIND, either express or implied. See the License for the
  16. * specific language governing permissions and limitations
  17. * under the License.
  18. */
  19. (function (root, factory) {
  20. /* eslint-disable */
  21. if (typeof define === 'function' && define.amd) {
  22. // AMD. Register as an anonymous module.
  23. define(['exports', 'echarts'], factory);
  24. } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
  25. // CommonJS
  26. factory(exports, require('echarts'));
  27. } else {
  28. // Browser globals
  29. factory({}, root.echarts);
  30. }
  31. /* eslint-enable */
  32. }(this, function (exports, echarts) {
  33. var log = function (msg) {
  34. if (typeof console !== 'undefined') {
  35. console && console.error && console.error(msg);
  36. }
  37. };
  38. if (!echarts) {
  39. log('ECharts is not Loaded');
  40. return;
  41. }
  42. var contrastColor = '#eee';
  43. var axisCommon = function () {
  44. return {
  45. axisLine: {
  46. lineStyle: {
  47. color: contrastColor
  48. }
  49. },
  50. axisTick: {
  51. lineStyle: {
  52. color: contrastColor
  53. }
  54. },
  55. axisLabel: {
  56. textStyle: {
  57. color: contrastColor
  58. }
  59. },
  60. splitLine: {
  61. lineStyle: {
  62. type: 'dashed',
  63. color: '#aaa'
  64. }
  65. },
  66. splitArea: {
  67. areaStyle: {
  68. color: contrastColor
  69. }
  70. }
  71. };
  72. };
  73. var colorPalette = [
  74. '#dd6b66', '#759aa0', '#e69d87', '#8dc1a9', '#ea7e53',
  75. '#eedd78', '#73a373', '#73b9bc', '#7289ab', '#91ca8c', '#f49f42'
  76. ];
  77. var theme = {
  78. color: colorPalette,
  79. backgroundColor: '#333',
  80. tooltip: {
  81. axisPointer: {
  82. lineStyle: {
  83. color: contrastColor
  84. },
  85. crossStyle: {
  86. color: contrastColor
  87. }
  88. }
  89. },
  90. legend: {
  91. textStyle: {
  92. color: contrastColor
  93. }
  94. },
  95. textStyle: {
  96. color: contrastColor
  97. },
  98. title: {
  99. textStyle: {
  100. color: contrastColor
  101. }
  102. },
  103. toolbox: {
  104. iconStyle: {
  105. normal: {
  106. borderColor: contrastColor
  107. }
  108. }
  109. },
  110. dataZoom: {
  111. textStyle: {
  112. color: contrastColor
  113. }
  114. },
  115. visualMap: {
  116. textStyle: {
  117. color: contrastColor
  118. }
  119. },
  120. timeline: {
  121. lineStyle: {
  122. color: contrastColor
  123. },
  124. itemStyle: {
  125. normal: {
  126. color: colorPalette[1]
  127. }
  128. },
  129. label: {
  130. normal: {
  131. textStyle: {
  132. color: contrastColor
  133. }
  134. }
  135. },
  136. controlStyle: {
  137. normal: {
  138. color: contrastColor,
  139. borderColor: contrastColor
  140. }
  141. }
  142. },
  143. timeAxis: axisCommon(),
  144. logAxis: axisCommon(),
  145. valueAxis: axisCommon(),
  146. categoryAxis: axisCommon(),
  147. line: {
  148. symbol: 'circle'
  149. },
  150. graph: {
  151. color: colorPalette
  152. },
  153. gauge: {
  154. title: {
  155. textStyle: {
  156. color: contrastColor
  157. }
  158. }
  159. },
  160. candlestick: {
  161. itemStyle: {
  162. normal: {
  163. color: '#FD1050',
  164. color0: '#0CF49B',
  165. borderColor: '#FD1050',
  166. borderColor0: '#0CF49B'
  167. }
  168. }
  169. }
  170. };
  171. theme.categoryAxis.splitLine.show = false;
  172. echarts.registerTheme('dark', theme);
  173. }));