您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

config-ucharts.js 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  1. /*
  2. * uCharts®
  3. * 高性能跨平台图表库,支持H5、APP、小程序(微信/支付宝/百度/头条/QQ/360)、Vue、Taro等支持canvas的框架平台
  4. * Copyright (c) 2021 QIUN®秋云 https://www.ucharts.cn All rights reserved.
  5. * Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  6. * 复制使用请保留本段注释,感谢支持开源!
  7. *
  8. * uCharts®官方网站
  9. * https://www.uCharts.cn
  10. *
  11. * 开源地址:
  12. * https://gitee.com/uCharts/uCharts
  13. *
  14. * uni-app插件市场地址:
  15. * http://ext.dcloud.net.cn/plugin?id=271
  16. *
  17. */
  18. // 主题颜色配置:如每个图表类型需要不同主题,请在对应图表类型上更改color属性
  19. const color = ['#1890FF', '#91CB74', '#FAC858', '#EE6666', '#73C0DE', '#3CA272', '#FC8452', '#9A60B4', '#ea7ccc'];
  20. const colorMap = ['#1890FF'];
  21. //事件转换函数,主要用作格式化x轴为时间轴,根据需求自行修改
  22. const formatDateTime = (timeStamp, returnType)=>{
  23. var date = new Date();
  24. date.setTime(timeStamp * 1000);
  25. var y = date.getFullYear();
  26. var m = date.getMonth() + 1;
  27. m = m < 10 ? ('0' + m) : m;
  28. var d = date.getDate();
  29. d = d < 10 ? ('0' + d) : d;
  30. var h = date.getHours();
  31. h = h < 10 ? ('0' + h) : h;
  32. var minute = date.getMinutes();
  33. var second = date.getSeconds();
  34. minute = minute < 10 ? ('0' + minute) : minute;
  35. second = second < 10 ? ('0' + second) : second;
  36. if(returnType == 'full'){return y + '-' + m + '-' + d + ' '+ h +':' + minute + ':' + second;}
  37. if(returnType == 'y-m-d'){return y + '-' + m + '-' + d;}
  38. if(returnType == 'h:m'){return h +':' + minute;}
  39. if(returnType == 'h:m:s'){return h +':' + minute +':' + second;}
  40. return [y, m, d, h, minute, second];
  41. }
  42. const cfu = {
  43. //demotype为自定义图表类型,一般不需要自定义图表类型,只需要改根节点上对应的类型即可
  44. "type":["pie","ring","rose","word","funnel","map","arcbar","line","column","mount","bar","area","radar","gauge","candle","mix","tline","tarea","scatter","bubble","demotype"],
  45. "range":["饼状图","圆环图","玫瑰图","词云图","漏斗图","地图","圆弧进度条","折线图","柱状图","山峰图","条状图","区域图","雷达图","仪表盘","K线图","混合图","时间轴折线","时间轴区域","散点图","气泡图","自定义类型"],
  46. //增加自定义图表类型,如果需要categories,请在这里加入您的图表类型,例如最后的"demotype"
  47. //自定义类型时需要注意"tline","tarea","scatter","bubble"等时间轴(矢量x轴)类图表,没有categories,不需要加入categories
  48. "categories":["line","column","mount","bar","area","radar","gauge","candle","mix","demotype"],
  49. //instance为实例变量承载属性,不要删除
  50. "instance":{},
  51. //option为opts及eopts承载属性,不要删除
  52. "option":{},
  53. //下面是自定义format配置,因除H5端外的其他端无法通过props传递函数,只能通过此属性对应下标的方式来替换
  54. "formatter":{
  55. "yAxisDemo1":function(val, index, opts){return val+'元'},
  56. "yAxisDemo2":function(val, index, opts){return val.toFixed(2)},
  57. "xAxisDemo1":function(val, index, opts){return val+'年';},
  58. "xAxisDemo2":function(val, index, opts){return formatDateTime(val,'h:m')},
  59. "seriesDemo1":function(val, index, series, opts){return val+'元'},
  60. "tooltipDemo1":function(item, category, index, opts){
  61. if(index==0){
  62. return '随便用'+item.data+'年'
  63. }else{
  64. return '其他我没改'+item.data+'天'
  65. }
  66. },
  67. "pieDemo":function(val, index, series, opts){
  68. if(index !== undefined){
  69. return series[index].name+':'+series[index].data+'元'
  70. }
  71. },
  72. },
  73. //这里演示了自定义您的图表类型的option,可以随意命名,之后在组件上 type="demotype" 后,组件会调用这个花括号里的option,如果组件上还存在opts参数,会将demotype与opts中option合并后渲染图表。
  74. "demotype":{
  75. //我这里把曲线图当做了自定义图表类型,您可以根据需要随意指定类型或配置
  76. "type": "line",
  77. "color": color,
  78. "padding": [15,10,0,15],
  79. "xAxis": {
  80. "disableGrid": true,
  81. },
  82. "yAxis": {
  83. "gridType": "dash",
  84. "dashLength": 2,
  85. },
  86. "legend": {
  87. },
  88. "extra": {
  89. "line": {
  90. "type": "curve",
  91. "width": 2
  92. },
  93. }
  94. },
  95. //下面是自定义配置,请添加项目所需的通用配置
  96. "pie":{
  97. "type": "pie",
  98. "color": color,
  99. "padding": [5,5,5,5],
  100. "extra": {
  101. "pie": {
  102. "activeOpacity": 0.5,
  103. "activeRadius": 10,
  104. "offsetAngle": 0,
  105. "labelWidth": 15,
  106. "border": true,
  107. "borderWidth": 3,
  108. "borderColor": "#FFFFFF"
  109. },
  110. }
  111. },
  112. "ring":{
  113. "type": "ring",
  114. "color": color,
  115. "padding": [5,5,5,5],
  116. "rotate": false,
  117. "dataLabel": true,
  118. "legend": {
  119. "show": true,
  120. "position": "right",
  121. "lineHeight": 25,
  122. },
  123. "title": {
  124. "name": "收益率",
  125. "fontSize": 15,
  126. "color": "#666666"
  127. },
  128. "subtitle": {
  129. "name": "70%",
  130. "fontSize": 25,
  131. "color": "#7cb5ec"
  132. },
  133. "extra": {
  134. "ring": {
  135. "ringWidth":30,
  136. "activeOpacity": 0.5,
  137. "activeRadius": 10,
  138. "offsetAngle": 0,
  139. "labelWidth": 15,
  140. "border": true,
  141. "borderWidth": 3,
  142. "borderColor": "#FFFFFF"
  143. },
  144. },
  145. },
  146. "rose":{
  147. "type": "rose",
  148. "color": color,
  149. "padding": [5,5,5,5],
  150. "legend": {
  151. "show": true,
  152. "position": "left",
  153. "lineHeight": 25,
  154. },
  155. "extra": {
  156. "rose": {
  157. "type": "area",
  158. "minRadius": 50,
  159. "activeOpacity": 0.5,
  160. "activeRadius": 10,
  161. "offsetAngle": 0,
  162. "labelWidth": 15,
  163. "border": false,
  164. "borderWidth": 2,
  165. "borderColor": "#FFFFFF"
  166. },
  167. }
  168. },
  169. "word":{
  170. "type": "word",
  171. "color": color,
  172. "extra": {
  173. "word": {
  174. "type": "normal",
  175. "autoColors": false
  176. }
  177. }
  178. },
  179. "funnel":{
  180. "type": "funnel",
  181. "color": color,
  182. "padding": [15,15,0,15],
  183. "extra": {
  184. "funnel": {
  185. "activeOpacity": 0.3,
  186. "activeWidth": 10,
  187. "border": true,
  188. "borderWidth": 2,
  189. "borderColor": "#FFFFFF",
  190. "fillOpacity": 1,
  191. "labelAlign": "right"
  192. },
  193. }
  194. },
  195. "map":{
  196. "type": "map",
  197. "color": colorMap,
  198. "padding": [0,0,0,0],
  199. "dataLabel": true,
  200. "extra": {
  201. "map": {
  202. "border": true,
  203. "borderWidth": 1,
  204. "borderColor": "#666666",
  205. "fillOpacity": 0.6,
  206. "activeBorderColor": "#F04864",
  207. "activeFillColor": "#FACC14",
  208. "activeFillOpacity": 1
  209. },
  210. }
  211. },
  212. "arcbar":{
  213. "type": "arcbar",
  214. "color": color,
  215. "title": {
  216. "name": "百分比",
  217. "fontSize": 25,
  218. "color": "#00FF00"
  219. },
  220. "subtitle": {
  221. "name": "默认标题",
  222. "fontSize": 15,
  223. "color": "#666666"
  224. },
  225. "extra": {
  226. "arcbar": {
  227. "type": "default",
  228. "width": 12,
  229. "backgroundColor": "#E9E9E9",
  230. "startAngle": 0.75,
  231. "endAngle": 0.25,
  232. "gap": 2
  233. }
  234. }
  235. },
  236. "line":{
  237. "type": "line",
  238. "color": color,
  239. "padding": [15,10,0,15],
  240. "xAxis": {
  241. "disableGrid": true,
  242. },
  243. "yAxis": {
  244. "gridType": "dash",
  245. "dashLength": 2,
  246. },
  247. "legend": {
  248. },
  249. "extra": {
  250. "line": {
  251. "type": "straight",
  252. "width": 2,
  253. "activeType": "hollow"
  254. },
  255. }
  256. },
  257. "tline":{
  258. "type": "line",
  259. "color": color,
  260. "padding": [15,10,0,15],
  261. "xAxis": {
  262. "disableGrid": false,
  263. "boundaryGap":"justify",
  264. },
  265. "yAxis": {
  266. "gridType": "dash",
  267. "dashLength": 2,
  268. "data":[
  269. {
  270. "min":0,
  271. "max":80
  272. }
  273. ]
  274. },
  275. "legend": {
  276. },
  277. "extra": {
  278. "line": {
  279. "type": "curve",
  280. "width": 2,
  281. "activeType": "hollow"
  282. },
  283. }
  284. },
  285. "tarea":{
  286. "type": "area",
  287. "color": color,
  288. "padding": [15,10,0,15],
  289. "xAxis": {
  290. "disableGrid": true,
  291. "boundaryGap":"justify",
  292. },
  293. "yAxis": {
  294. "gridType": "dash",
  295. "dashLength": 2,
  296. "data":[
  297. {
  298. "min":0,
  299. "max":80
  300. }
  301. ]
  302. },
  303. "legend": {
  304. },
  305. "extra": {
  306. "area": {
  307. "type": "curve",
  308. "opacity": 0.2,
  309. "addLine": true,
  310. "width": 2,
  311. "gradient": true,
  312. "activeType": "hollow"
  313. },
  314. }
  315. },
  316. "column":{
  317. "type": "column",
  318. "color": color,
  319. "padding": [15,15,0,5],
  320. "xAxis": {
  321. "disableGrid": true,
  322. },
  323. "yAxis": {
  324. "data":[{"min":0}]
  325. },
  326. "legend": {
  327. },
  328. "extra": {
  329. "column": {
  330. "type": "group",
  331. "width": 30,
  332. "activeBgColor": "#000000",
  333. "activeBgOpacity": 0.08
  334. },
  335. }
  336. },
  337. "mount":{
  338. "type": "mount",
  339. "color": color,
  340. "padding": [15,15,0,5],
  341. "xAxis": {
  342. "disableGrid": true,
  343. },
  344. "yAxis": {
  345. "data":[{"min":0}]
  346. },
  347. "legend": {
  348. },
  349. "extra": {
  350. "mount": {
  351. "type": "mount",
  352. "widthRatio": 1.5,
  353. },
  354. }
  355. },
  356. "bar":{
  357. "type": "bar",
  358. "color": color,
  359. "padding": [15,30,0,5],
  360. "xAxis": {
  361. "boundaryGap":"justify",
  362. "disableGrid":false,
  363. "min":0,
  364. "axisLine":false
  365. },
  366. "yAxis": {
  367. },
  368. "legend": {
  369. },
  370. "extra": {
  371. "bar": {
  372. "type": "group",
  373. "width": 30,
  374. "meterBorde": 1,
  375. "meterFillColor": "#FFFFFF",
  376. "activeBgColor": "#000000",
  377. "activeBgOpacity": 0.08
  378. },
  379. }
  380. },
  381. "area":{
  382. "type": "area",
  383. "color": color,
  384. "padding": [15,15,0,15],
  385. "xAxis": {
  386. "disableGrid": true,
  387. },
  388. "yAxis": {
  389. "gridType": "dash",
  390. "dashLength": 2,
  391. },
  392. "legend": {
  393. },
  394. "extra": {
  395. "area": {
  396. "type": "straight",
  397. "opacity": 0.2,
  398. "addLine": true,
  399. "width": 2,
  400. "gradient": false,
  401. "activeType": "hollow"
  402. },
  403. }
  404. },
  405. "radar":{
  406. "type": "radar",
  407. "color": color,
  408. "padding": [5,5,5,5],
  409. "dataLabel": false,
  410. "legend": {
  411. "show": true,
  412. "position": "right",
  413. "lineHeight": 25,
  414. },
  415. "extra": {
  416. "radar": {
  417. "gridType": "radar",
  418. "gridColor": "#CCCCCC",
  419. "gridCount": 3,
  420. "opacity": 0.2,
  421. "max": 200,
  422. "labelShow": true
  423. },
  424. }
  425. },
  426. "gauge":{
  427. "type": "gauge",
  428. "color": color,
  429. "title": {
  430. "name": "66Km/H",
  431. "fontSize": 25,
  432. "color": "#2fc25b",
  433. "offsetY": 50
  434. },
  435. "subtitle": {
  436. "name": "实时速度",
  437. "fontSize": 15,
  438. "color": "#1890ff",
  439. "offsetY": -50
  440. },
  441. "extra": {
  442. "gauge": {
  443. "type": "default",
  444. "width": 30,
  445. "labelColor": "#666666",
  446. "startAngle": 0.75,
  447. "endAngle": 0.25,
  448. "startNumber": 0,
  449. "endNumber": 100,
  450. "labelFormat": "",
  451. "splitLine": {
  452. "fixRadius": 0,
  453. "splitNumber": 10,
  454. "width": 30,
  455. "color": "#FFFFFF",
  456. "childNumber": 5,
  457. "childWidth": 12
  458. },
  459. "pointer": {
  460. "width": 24,
  461. "color": "auto"
  462. }
  463. }
  464. }
  465. },
  466. "candle":{
  467. "type": "candle",
  468. "color": color,
  469. "padding": [15,15,0,15],
  470. "enableScroll": true,
  471. "enableMarkLine": true,
  472. "dataLabel": false,
  473. "xAxis": {
  474. "labelCount": 4,
  475. "itemCount": 40,
  476. "disableGrid": true,
  477. "gridColor": "#CCCCCC",
  478. "gridType": "solid",
  479. "dashLength": 4,
  480. "scrollShow": true,
  481. "scrollAlign": "left",
  482. "scrollColor": "#A6A6A6",
  483. "scrollBackgroundColor": "#EFEBEF"
  484. },
  485. "yAxis": {
  486. },
  487. "legend": {
  488. },
  489. "extra": {
  490. "candle": {
  491. "color": {
  492. "upLine": "#f04864",
  493. "upFill": "#f04864",
  494. "downLine": "#2fc25b",
  495. "downFill": "#2fc25b"
  496. },
  497. "average": {
  498. "show": true,
  499. "name": ["MA5","MA10","MA30"],
  500. "day": [5,10,20],
  501. "color": ["#1890ff","#2fc25b","#facc14"]
  502. }
  503. },
  504. "markLine": {
  505. "type": "dash",
  506. "dashLength": 5,
  507. "data": [
  508. {
  509. "value": 2150,
  510. "lineColor": "#f04864",
  511. "showLabel": true
  512. },
  513. {
  514. "value": 2350,
  515. "lineColor": "#f04864",
  516. "showLabel": true
  517. }
  518. ]
  519. }
  520. }
  521. },
  522. "mix":{
  523. "type": "mix",
  524. "color": color,
  525. "padding": [15,15,0,15],
  526. "xAxis": {
  527. "disableGrid": true,
  528. },
  529. "yAxis": {
  530. "disabled": false,
  531. "disableGrid": false,
  532. "splitNumber": 5,
  533. "gridType": "dash",
  534. "dashLength": 4,
  535. "gridColor": "#CCCCCC",
  536. "padding": 10,
  537. "showTitle": true,
  538. "data": []
  539. },
  540. "legend": {
  541. },
  542. "extra": {
  543. "mix": {
  544. "column": {
  545. "width": 20
  546. }
  547. },
  548. }
  549. },
  550. "scatter":{
  551. "type": "scatter",
  552. "color":color,
  553. "padding":[15,15,0,15],
  554. "dataLabel":false,
  555. "xAxis": {
  556. "disableGrid": false,
  557. "gridType":"dash",
  558. "splitNumber":5,
  559. "boundaryGap":"justify",
  560. "min":0
  561. },
  562. "yAxis": {
  563. "disableGrid": false,
  564. "gridType":"dash",
  565. },
  566. "legend": {
  567. },
  568. "extra": {
  569. "scatter": {
  570. },
  571. }
  572. },
  573. "bubble":{
  574. "type": "bubble",
  575. "color":color,
  576. "padding":[15,15,0,15],
  577. "xAxis": {
  578. "disableGrid": false,
  579. "gridType":"dash",
  580. "splitNumber":5,
  581. "boundaryGap":"justify",
  582. "min":0,
  583. "max":250
  584. },
  585. "yAxis": {
  586. "disableGrid": false,
  587. "gridType":"dash",
  588. "data":[{
  589. "min":0,
  590. "max":150
  591. }]
  592. },
  593. "legend": {
  594. },
  595. "extra": {
  596. "bubble": {
  597. "border":2,
  598. "opacity": 0.5,
  599. },
  600. }
  601. }
  602. }
  603. export default cfu;