dark.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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. if (typeof define === 'function' && define.amd) {
  21. // AMD. Register as an anonymous module.
  22. define(['exports', 'echarts'], factory);
  23. } else if (
  24. typeof exports === 'object' &&
  25. typeof exports.nodeName !== 'string'
  26. ) {
  27. // CommonJS
  28. factory(exports, require('echarts'));
  29. } else {
  30. // Browser globals
  31. factory({}, root.echarts);
  32. }
  33. })(this, function(exports, echarts) {
  34. var log = function(msg) {
  35. if (typeof console !== 'undefined') {
  36. console && console.error && console.error(msg);
  37. }
  38. };
  39. if (!echarts) {
  40. log('ECharts is not Loaded');
  41. return;
  42. }
  43. var contrastColor = '#eee';
  44. var axisCommon = function() {
  45. return {
  46. axisLine: {
  47. lineStyle: {
  48. color: contrastColor
  49. }
  50. },
  51. axisTick: {
  52. lineStyle: {
  53. color: contrastColor
  54. }
  55. },
  56. axisLabel: {
  57. textStyle: {
  58. color: contrastColor
  59. }
  60. },
  61. splitLine: {
  62. lineStyle: {
  63. type: 'dashed',
  64. color: '#aaa'
  65. }
  66. },
  67. splitArea: {
  68. areaStyle: {
  69. color: contrastColor
  70. }
  71. }
  72. };
  73. };
  74. var colorPalette = [
  75. '#dd6b66',
  76. '#759aa0',
  77. '#e69d87',
  78. '#8dc1a9',
  79. '#ea7e53',
  80. '#eedd78',
  81. '#73a373',
  82. '#73b9bc',
  83. '#7289ab',
  84. '#91ca8c',
  85. '#f49f42'
  86. ];
  87. var theme = {
  88. color: colorPalette,
  89. backgroundColor: '#333',
  90. tooltip: {
  91. axisPointer: {
  92. lineStyle: {
  93. color: contrastColor
  94. },
  95. crossStyle: {
  96. color: contrastColor
  97. },
  98. label: {
  99. color: '#000'
  100. }
  101. }
  102. },
  103. legend: {
  104. textStyle: {
  105. color: contrastColor
  106. }
  107. },
  108. title: {
  109. textStyle: {
  110. color: contrastColor
  111. }
  112. },
  113. toolbox: {
  114. iconStyle: {
  115. normal: {
  116. borderColor: contrastColor
  117. }
  118. }
  119. },
  120. // Area scaling controller
  121. dataZoom: {
  122. dataBackgroundColor: '#eee', // Data background color
  123. fillerColor: 'rgba(200,200,200,0.2)', // Fill the color
  124. handleColor: '#dd6b66' // Handle color
  125. },
  126. timeline: {
  127. itemStyle: {
  128. color: colorPalette[1]
  129. },
  130. lineStyle: {
  131. color: contrastColor
  132. },
  133. controlStyle: {
  134. color: contrastColor,
  135. borderColor: contrastColor
  136. },
  137. label: {
  138. color: contrastColor
  139. }
  140. },
  141. timeAxis: axisCommon(),
  142. logAxis: axisCommon(),
  143. valueAxis: axisCommon(),
  144. categoryAxis: axisCommon(),
  145. line: {
  146. symbol: 'circle'
  147. },
  148. graph: {
  149. color: colorPalette
  150. },
  151. gauge: {
  152. axisLine: {
  153. lineStyle: {
  154. color: [
  155. [0.2, '#dd6b66'],
  156. [0.8, '#759aa0'],
  157. [1, '#ea7e53']
  158. ],
  159. width: 8
  160. }
  161. }
  162. },
  163. candlestick: {
  164. itemStyle: {
  165. color: '#FD1050',
  166. color0: '#0CF49B',
  167. borderColor: '#FD1050',
  168. borderColor0: '#0CF49B'
  169. }
  170. }
  171. };
  172. theme.categoryAxis.splitLine.show = false;
  173. echarts.registerTheme('dark', theme);
  174. });