dark-mushroom.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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/lib/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. color: contrastColor
  58. },
  59. splitLine: {
  60. lineStyle: {
  61. type: 'dashed',
  62. color: '#aaa'
  63. }
  64. },
  65. splitArea: {
  66. areaStyle: {
  67. color: contrastColor
  68. }
  69. }
  70. };
  71. };
  72. var colorPalette = [
  73. '#cc0e00',
  74. '#ff1a0a',
  75. '#ff8880',
  76. '#ffc180',
  77. '#ffc2b0',
  78. '#ffffff',
  79. '#ff8880',
  80. '#ffe6e6'
  81. ];
  82. var theme = {
  83. color: colorPalette,
  84. backgroundColor: '#333',
  85. tooltip: {
  86. axisPointer: {
  87. lineStyle: {
  88. color: contrastColor
  89. },
  90. crossStyle: {
  91. color: contrastColor
  92. }
  93. }
  94. },
  95. legend: {
  96. textStyle: {
  97. color: contrastColor
  98. }
  99. },
  100. title: {
  101. textStyle: {
  102. color: contrastColor
  103. }
  104. },
  105. toolbox: {
  106. iconStyle: {
  107. borderColor: contrastColor
  108. }
  109. },
  110. // Area scaling controller
  111. dataZoom: {
  112. dataBackgroundColor: '#eee', // Data background color
  113. fillerColor: 'rgba(200,200,200,0.2)', // Fill the color
  114. handleColor: '#cc0e00' // Handle color
  115. },
  116. timeline: {
  117. itemStyle: {
  118. color: colorPalette[1]
  119. },
  120. lineStyle: {
  121. color: contrastColor
  122. },
  123. controlStyle: {
  124. color: contrastColor,
  125. borderColor: contrastColor
  126. },
  127. label: {
  128. color: contrastColor
  129. }
  130. },
  131. timeAxis: axisCommon(),
  132. logAxis: axisCommon(),
  133. valueAxis: axisCommon(),
  134. categoryAxis: axisCommon(),
  135. line: {
  136. symbol: 'circle'
  137. },
  138. graph: {
  139. color: colorPalette
  140. },
  141. gauge: {
  142. axisLine: {
  143. lineStyle: {
  144. color: [
  145. [0.2, '#ff1a0a'],
  146. [0.8, '#cc0e00'],
  147. [1, '#ffc2b0']
  148. ],
  149. width: 8
  150. }
  151. }
  152. }
  153. };
  154. theme.categoryAxis.splitLine.show = false;
  155. echarts.registerTheme('dark-mushroom', theme);
  156. });