dark-bold.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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. '#458c6b',
  76. '#f2da87',
  77. '#d9a86c',
  78. '#d94436',
  79. '#a62424',
  80. '#76bc9b',
  81. '#cce6da',
  82. '#eeeeee'
  83. ];
  84. var theme = {
  85. color: colorPalette,
  86. backgroundColor: '#333',
  87. tooltip: {
  88. axisPointer: {
  89. lineStyle: {
  90. color: contrastColor
  91. },
  92. crossStyle: {
  93. color: contrastColor
  94. }
  95. }
  96. },
  97. legend: {
  98. textStyle: {
  99. color: contrastColor
  100. }
  101. },
  102. title: {
  103. textStyle: {
  104. color: contrastColor
  105. }
  106. },
  107. toolbox: {
  108. iconStyle: {
  109. normal: {
  110. borderColor: contrastColor
  111. }
  112. }
  113. },
  114. // Area scaling controller
  115. dataZoom: {
  116. dataBackgroundColor: '#eee', // Data background color
  117. fillerColor: 'rgba(200,200,200,0.2)', // Fill the color
  118. handleColor: '#458c6b' // Handle color
  119. },
  120. timeline: {
  121. itemStyle: {
  122. color: colorPalette[1]
  123. },
  124. lineStyle: {
  125. color: contrastColor
  126. },
  127. controlStyle: {
  128. color: contrastColor,
  129. borderColor: contrastColor
  130. },
  131. label: {
  132. color: contrastColor
  133. }
  134. },
  135. timeAxis: axisCommon(),
  136. logAxis: axisCommon(),
  137. valueAxis: axisCommon(),
  138. categoryAxis: axisCommon(),
  139. line: {
  140. symbol: 'circle'
  141. },
  142. graph: {
  143. color: colorPalette
  144. },
  145. gauge: {
  146. axisLine: {
  147. lineStyle: {
  148. color: [
  149. [0.2, '#f2da87'],
  150. [0.8, '#458c6b'],
  151. [1, '#a62424']
  152. ],
  153. width: 8
  154. }
  155. }
  156. }
  157. };
  158. theme.categoryAxis.splitLine.show = false;
  159. echarts.registerTheme('dark-bold', theme);
  160. });