信通院-灾备 图表源码(在产品图表库基础上进行修改),开发逻辑和产品图表库一致
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. import ChartBar from '../../../src/chart/bar/ChartBar34/ChartBar34.js';
  2. var chart = new ChartBar(document.getElementsByClassName("chartContainer")[0], {});
  3. window.chart = chart;
  4. window.addEventListener("resize", function () {
  5. chart.resize();
  6. });
  7. window.addEventListener('elementClick', (a, b) => {
  8. console.log('触发', a.detail)
  9. });
  10. let option = {
  11. type: "p1",
  12. bg: {
  13. backgroundColor: '#000000'
  14. },
  15. title: {},
  16. tooltip: {
  17. bgStyle: {
  18. backgroundColor: 'rgba(0,0,0,0.7)',
  19. // borderColor:'#888e0e',
  20. // borderWidth:1
  21. },
  22. },
  23. legend: {
  24. left: "18%",
  25. top: '6%',
  26. itemWidth: 12,
  27. circleSize: 4,
  28. textStyle: {
  29. fontSize: 16,
  30. // color: '#50a7bd'
  31. }
  32. },
  33. grid: {
  34. left: '18%',
  35. top: '20%',
  36. right: '18%',
  37. bottom: '18%',
  38. containLabel: false,
  39. },
  40. // legend: Legend.option,
  41. xAxis: {
  42. type: "category",
  43. lastLabel: '总花费',
  44. data: ["类别一", "类别二", "类别三", "类别四", "类别五", "类别六", "类别七", "类别八", "类别六", "类别七", "类别八"],
  45. // min:0,
  46. axisLine: {
  47. show: false,
  48. lineStyle: {
  49. color: '#333333',
  50. width: 2,
  51. type: 'solid'
  52. }
  53. },
  54. axisTick: {
  55. show: false,
  56. alignWithLabel: false,
  57. interval: 'auto',
  58. length: 5,
  59. lineStyle: {
  60. color: '#333333',
  61. width: 1
  62. }
  63. },
  64. splitLine: {
  65. show: false,
  66. lineStyle: {
  67. color: '#333333',
  68. width: 1,
  69. type: 'solid'
  70. }
  71. },
  72. axisLabel: {
  73. show: true,
  74. textStyle: {
  75. fontSize: 14,
  76. color: '#bdbdbd',
  77. backgroundColor: 'rgba(255,255,255,0.05)',
  78. highlightColor: 'rgba(255,255,255,0.4)',
  79. }
  80. }
  81. },
  82. yAxis: {
  83. type: 'value',
  84. axisLine: {
  85. show: true,
  86. lineStyle: {
  87. color: '#333333',
  88. width: 2,
  89. type: 'solid',
  90. distance: 2, //偏移距离
  91. }
  92. },
  93. axisTick: {
  94. show: true,
  95. alignWithLabel: true,
  96. interval: 'auto',
  97. length: -4,
  98. lineStyle: {
  99. color: '#333333',
  100. width: 2
  101. }
  102. },
  103. splitLine: {
  104. show: true,
  105. lineStyle: {
  106. color: '#333333',
  107. width: 1,
  108. type: 'solid'
  109. }
  110. },
  111. axisLabel: {
  112. show: true,
  113. textStyle: {
  114. fontSize: 16,
  115. color: '#797979'
  116. }
  117. },
  118. bgColor: 'rgba(255,255,255,0.05)',
  119. },
  120. shape: {
  121. barCategoryGap: '60%',
  122. // barGap: '8%',
  123. label: {
  124. show: false,
  125. textStyle: {
  126. fontSize: 12,
  127. fontWeight: 'normal',
  128. color: '#00f4fe'
  129. },
  130. positionX: 5
  131. },
  132. circleSize: 5,
  133. },
  134. series: [
  135. {
  136. name: '花费',
  137. type: 'bar',
  138. data: [[220, 1450], [50, 1000], [100, 1500], [250, 1300], [450, 800], [200, 1600], [600, 1800], [580, 1300], [250, 1300], [450, 800], [200, 1600]],
  139. }
  140. ],
  141. color: ["#3fffa7", "#3f90ff"],
  142. };
  143. let option2 = {
  144. type: "p1",
  145. bg: {
  146. backgroundColor: '#000000'
  147. },
  148. title: {},
  149. tooltip: {
  150. bgStyle: {
  151. backgroundColor: 'rgba(0,0,0,0.7)',
  152. // borderColor:'#888e0e',
  153. // borderWidth:1
  154. },
  155. },
  156. legend: {
  157. left: "18%",
  158. top: '6%',
  159. itemWidth: 12,
  160. circleSize: 4,
  161. textStyle: {
  162. fontSize: 16,
  163. // color: '#50a7bd'
  164. }
  165. },
  166. grid: {
  167. left: '18%',
  168. top: '20%',
  169. right: '18%',
  170. bottom: '18%',
  171. containLabel: false,
  172. },
  173. // legend: Legend.option,
  174. xAxis: {
  175. type: "category",
  176. lastLabel: '总花费',
  177. data: ["类别一", "类别二", "类别三"],
  178. // min:0,
  179. axisLine: {
  180. show: false,
  181. lineStyle: {
  182. color: '#333333',
  183. width: 2,
  184. type: 'solid'
  185. }
  186. },
  187. axisTick: {
  188. show: false,
  189. alignWithLabel: false,
  190. interval: 'auto',
  191. length: 5,
  192. lineStyle: {
  193. color: '#333333',
  194. width: 1
  195. }
  196. },
  197. splitLine: {
  198. show: false,
  199. lineStyle: {
  200. color: '#333333',
  201. width: 1,
  202. type: 'solid'
  203. }
  204. },
  205. axisLabel: {
  206. show: true,
  207. textStyle: {
  208. fontSize: 14,
  209. color: '#bdbdbd',
  210. backgroundColor: 'rgba(255,255,255,0.05)',
  211. highlightColor: 'rgba(255,255,255,0.4)',
  212. }
  213. }
  214. },
  215. yAxis: {
  216. type: 'value',
  217. axisLine: {
  218. show: true,
  219. lineStyle: {
  220. color: '#333333',
  221. width: 2,
  222. type: 'solid',
  223. distance: 2, //偏移距离
  224. }
  225. },
  226. axisTick: {
  227. show: true,
  228. alignWithLabel: true,
  229. interval: 'auto',
  230. length: -4,
  231. lineStyle: {
  232. color: '#333333',
  233. width: 2
  234. }
  235. },
  236. splitLine: {
  237. show: true,
  238. lineStyle: {
  239. color: '#333333',
  240. width: 1,
  241. type: 'solid'
  242. }
  243. },
  244. axisLabel: {
  245. show: true,
  246. textStyle: {
  247. fontSize: 16,
  248. color: '#797979'
  249. }
  250. },
  251. bgColor: 'rgba(255,255,255,0.05)',
  252. },
  253. shape: {
  254. barCategoryGap: '60%',
  255. // barGap: '8%',
  256. label: {
  257. show: false,
  258. textStyle: {
  259. fontSize: 12,
  260. fontWeight: 'normal',
  261. color: '#00f4fe'
  262. },
  263. positionX: 5
  264. },
  265. circleSize: 5,
  266. },
  267. series: [
  268. {
  269. name: '花费',
  270. type: 'bar',
  271. data: [[220, 1450], [50, 1000], [100, 1500]],
  272. }
  273. ],
  274. color: ["#3fffa7", "#3f90ff"],
  275. };
  276. // setTimeout(() => {
  277. // chart.setOption(option2)
  278. // }, 2000)
  279. // setTimeout(() => {
  280. // chart.setOption(option)
  281. // }, 4000)