信通院-灾备 图表源码(在产品图表库基础上进行修改),开发逻辑和产品图表库一致
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. import ChartDigit2 from '../../../src/chart/gauge/ChartGauge2/ChartGauge2.js';
  2. let chart=new ChartDigit2(document.getElementsByClassName('c1')[0],{});
  3. window.addEventListener('resize',()=>{
  4. chart.resize();
  5. });
  6. let option = {
  7. title: {},
  8. bg:{
  9. backgroundColor:"#000000"
  10. },
  11. grid: {
  12. left:'18%',
  13. top:'48%',
  14. right:'18%',
  15. bottom:'48%',
  16. containLabel: false,
  17. },
  18. legend:{
  19. left: "28%",
  20. top: '80%',
  21. name1: '差',
  22. name2: '良',
  23. name3: '优',
  24. itemWidth: 12,
  25. textStyle: {
  26. fontSize: 16,
  27. // color: '#50a7bd'
  28. }
  29. },
  30. gauge:{
  31. name:'图表',
  32. min: 10,
  33. mid: 15,
  34. max: 30,
  35. splitNumber: 10,
  36. lineWidth: 1,
  37. curLineWidth: 8,
  38. axisLine: {
  39. show: true,
  40. lineStyle: {
  41. color: '#f83d3d',
  42. lineWidth: 2,
  43. }
  44. },
  45. axisTick: {
  46. show: true,
  47. length: 6,
  48. lineStyle: {
  49. color: '#ffffff',
  50. lineWidth: 1,
  51. }
  52. },
  53. axisLabel: {
  54. distance: 0,
  55. color: '#bdbdbd',
  56. fontSize: 16,
  57. fontWeight: 'normal',
  58. },
  59. title: { // 仪表盘标题
  60. show: true,
  61. // x, y,单位px 相对于仪表盘中心的偏移位置,数组第一项是水平方向的偏移,第二项是垂直方向的偏移。可以是绝对的数值,也可以是相对于仪表盘半径的百分比。
  62. offsetCenter: {
  63. x: 0,
  64. y: '12%'
  65. },
  66. color: '#ffffff',
  67. fontSize: 20,
  68. fontWeight: 'normal',
  69. },
  70. },
  71. color:['#f83d3d','#fa8444','#3fffa7','#125fc9','#ffffff'],
  72. series: [{
  73. name: '利润',
  74. data: [{
  75. name: '实际值',
  76. value: 12.5
  77. },{
  78. name: '目标值',
  79. value: 12
  80. }],
  81. z: 2,
  82. }]
  83. };
  84. let option1 = {
  85. title: {},
  86. bg:{
  87. backgroundColor:"#000000"
  88. },
  89. grid: {
  90. left:'18%',
  91. top:'48%',
  92. right:'18%',
  93. bottom:'48%',
  94. containLabel: false,
  95. },
  96. legend:{
  97. left: "28%",
  98. top: '80%',
  99. name1: '差',
  100. name2: '良',
  101. name3: '优',
  102. itemWidth: 12,
  103. textStyle: {
  104. fontSize: 16,
  105. // color: '#50a7bd'
  106. }
  107. },
  108. gauge:{
  109. name:'图表',
  110. min: 10,
  111. mid: 15,
  112. max: 40,
  113. splitNumber: 10,
  114. lineWidth: 1,
  115. curLineWidth: 8,
  116. axisLine: {
  117. show: true,
  118. lineStyle: {
  119. color: '#f83d3d',
  120. lineWidth: 2,
  121. }
  122. },
  123. axisTick: {
  124. show: true,
  125. length: 6,
  126. lineStyle: {
  127. color: '#ffffff',
  128. lineWidth: 1,
  129. }
  130. },
  131. axisLabel: {
  132. distance: 0,
  133. color: '#bdbdbd',
  134. fontSize: 16,
  135. fontWeight: 'normal',
  136. },
  137. title: { // 仪表盘标题
  138. show: true,
  139. // x, y,单位px 相对于仪表盘中心的偏移位置,数组第一项是水平方向的偏移,第二项是垂直方向的偏移。可以是绝对的数值,也可以是相对于仪表盘半径的百分比。
  140. offsetCenter: {
  141. x: 0,
  142. y: '12%'
  143. },
  144. color: '#ffffff',
  145. fontSize: 20,
  146. fontWeight: 'normal',
  147. },
  148. },
  149. color:['#f83d3d','#fa8444','#3fffa7','#125fc9','#ffffff'],
  150. series: [{
  151. name: '利润',
  152. data: [{
  153. name: '实际值',
  154. value: 12.5
  155. },{
  156. name: '目标值',
  157. value: 12
  158. }],
  159. z: 2,
  160. }]
  161. };
  162. let option2 = {
  163. title: {},
  164. bg:{
  165. backgroundColor:"#000000"
  166. },
  167. grid: {
  168. left:'18%',
  169. top:'48%',
  170. right:'18%',
  171. bottom:'48%',
  172. containLabel: false,
  173. },
  174. legend:{
  175. left: "28%",
  176. top: '80%',
  177. name1: '差',
  178. name2: '良',
  179. name3: '优',
  180. itemWidth: 12,
  181. textStyle: {
  182. fontSize: 16,
  183. // color: '#50a7bd'
  184. }
  185. },
  186. gauge:{
  187. name:'图表',
  188. min: 10,
  189. mid: 15,
  190. max: 40,
  191. splitNumber: 5,
  192. lineWidth: 1,
  193. curLineWidth: 8,
  194. axisLine: {
  195. show: true,
  196. lineStyle: {
  197. color: '#f83d3d',
  198. lineWidth: 2,
  199. }
  200. },
  201. axisTick: {
  202. show: true,
  203. length: 6,
  204. lineStyle: {
  205. color: '#ffffff',
  206. lineWidth: 1,
  207. }
  208. },
  209. axisLabel: {
  210. distance: 0,
  211. color: '#bdbdbd',
  212. fontSize: 16,
  213. fontWeight: 'normal',
  214. },
  215. title: { // 仪表盘标题
  216. show: true,
  217. // x, y,单位px 相对于仪表盘中心的偏移位置,数组第一项是水平方向的偏移,第二项是垂直方向的偏移。可以是绝对的数值,也可以是相对于仪表盘半径的百分比。
  218. offsetCenter: {
  219. x: 0,
  220. y: '12%'
  221. },
  222. color: '#ffffff',
  223. fontSize: 20,
  224. fontWeight: 'normal',
  225. },
  226. },
  227. color:['#f83d3d','#fa8444','#3fffa7','#125fc9','#ffffff'],
  228. series: [{
  229. name: '利润',
  230. data: [{
  231. name: '实际值',
  232. value: 12.5
  233. },{
  234. name: '目标值',
  235. value: 12
  236. }],
  237. z: 2,
  238. }]
  239. };
  240. setTimeout(()=>{
  241. chart.setOption(option)
  242. },3000)
  243. setTimeout(()=>{
  244. chart.setOption(option1)
  245. },3000)
  246. setTimeout(()=>{
  247. chart.setOption(option2)
  248. },3000)