config-ucharts.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751
  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. module.exports = {
  21. //demotype为自定义图表类型
  22. "type": ["pie", "ring", "rose", "word", "funnel", "map", "arcbar", "line", "column", "area", "radar", "gauge",
  23. "candle", "mix", "demotype"
  24. ],
  25. "range": ["饼状图", "圆环图", "玫瑰图", "词云图", "漏斗图", "地图", "圆弧进度条", "折线图", "柱状图", "区域图", "雷达图", "仪表盘", "K线图", "混合图",
  26. "自定义类型"
  27. ],
  28. //增加自定义图表类型,如果需要categories,请在这里加入您的图表类型例如最后的"demotype"
  29. "categories": ["line", "column", "area", "radar", "gauge", "candle", "mix", "demotype"],
  30. //instance为实例变量承载属性,option为eopts承载属性,不要删除
  31. "instance": {},
  32. "option": {},
  33. //下面是自定义format配置,因除H5端外的其他端无法通过props传递函数,只能通过此属性对应下标的方式来替换
  34. "formatter": {
  35. "yAxisDemo1": function(val) {
  36. if (val > 1000) {
  37. return (val / 1000) + 'k'
  38. } else {
  39. return val
  40. }
  41. },
  42. "yAxisDemo2": function(val) {
  43. return val.toFixed(2)
  44. },
  45. "seriesDemo1": function(val) {
  46. return val + '元'
  47. },
  48. "tooltipDemo1": function(item, category, index, opts) {
  49. if (index == 0) {
  50. return '随便用' + item.data + '年'
  51. } else {
  52. return '其他我没改' + item.data + '天'
  53. }
  54. },
  55. "pieDemo": function(val, index, series) {
  56. if (index !== undefined) {
  57. return series[index].name + ':' + series[index].data + '元'
  58. }
  59. },
  60. },
  61. //这里演示了自定义您的图表类型的option,可以随意命名,之后在组件上 type="demotype" 后,组件会调用这个花括号里的option,如果组件上还存在opts参数,会将demotype与opts中option合并后渲染图表。
  62. "demotype": {
  63. //我这里把曲线图当做了自定义图表类型,您可以根据需要随意指定类型或配置
  64. "type": "line",
  65. "color": color,
  66. "padding": [15, 10, 0, 15],
  67. "xAxis": {
  68. "disableGrid": true,
  69. },
  70. "yAxis": {
  71. "gridType": "dash",
  72. "dashLength": 2,
  73. },
  74. "legend": {},
  75. "extra": {
  76. "line": {
  77. "type": "curve",
  78. "width": 2
  79. },
  80. }
  81. },
  82. //下面是自定义配置,请添加项目所需的通用配置
  83. // "pie": {
  84. // "type": "pie",
  85. // "color": color,
  86. // "padding": [5, 5, 5, 5],
  87. // "extra": {
  88. // "pie": {
  89. // "activeOpacity": 0.5,
  90. // "activeRadius": 10,
  91. // "offsetAngle": 0,
  92. // "labelWidth": 15,
  93. // "border": true,
  94. // "borderWidth": 3,
  95. // "borderColor": "#FFFFFF"
  96. // },
  97. // }
  98. // },
  99. "pie": {
  100. "type": "pie",
  101. "canvasId": "",
  102. "canvas2d": false,
  103. "background": "none",
  104. "animation": true,
  105. "timing": "easeOut",
  106. "duration": 1000,
  107. "color": [
  108. "#1890FF",
  109. "#91CB74",
  110. "#FAC858",
  111. "#EE6666",
  112. "#73C0DE",
  113. "#3CA272",
  114. "#FC8452",
  115. "#9A60B4",
  116. "#ea7ccc"
  117. ],
  118. "padding": [
  119. 5,
  120. 5,
  121. 5,
  122. 5
  123. ],
  124. "rotate": false,
  125. "reserve": false,
  126. "fontSize": 13,
  127. "fontColor": "#666666",
  128. "enableScroll": false,
  129. "touchMoveLimit": 60,
  130. "enableMarkLine": false,
  131. "dataLabel": true,
  132. "dataPointShape": true,
  133. "dataPointShapeType": "solid",
  134. "legend": {
  135. "show": true,
  136. "position": "left",
  137. "float": "top",
  138. "padding": 5,
  139. "margin": 5,
  140. "backgroundColor": "rgba(0,0,0,0)",
  141. "borderColor": "rgba(0,0,0,0)",
  142. "borderWidth": 0,
  143. "fontSize": 10,
  144. "fontColor": "#666666",
  145. "lineHeight": 20,
  146. "hiddenColor": "#CECECE",
  147. "itemGap": 10
  148. },
  149. "extra": {
  150. "pie": {
  151. "activeOpacity": 0.5,
  152. "activeRadius": 10,
  153. "offsetAngle": 0,
  154. "customRadius": 0,
  155. "labelWidth": 15,
  156. "border": true,
  157. "borderWidth": 3,
  158. "borderColor": "#FFFFFF",
  159. "linearType": "none"
  160. },
  161. "tooltip": {
  162. "showBox": true,
  163. "showArrow": true,
  164. "borderWidth": 0,
  165. "borderRadius": 0,
  166. "borderColor": "#000000",
  167. "borderOpacity": 0.7,
  168. "bgColor": "#000000",
  169. "bgOpacity": 0.7,
  170. "gridType": "solid",
  171. "dashLength": 4,
  172. "gridColor": "#CCCCCC",
  173. "fontColor": "#FFFFFF",
  174. "splitLine": true,
  175. "horizentalLine": false,
  176. "xAxisLabel": false,
  177. "yAxisLabel": false,
  178. "labelBgColor": "#FFFFFF",
  179. "labelBgOpacity": 0.7,
  180. "labelFontColor": "#666666"
  181. }
  182. }
  183. },
  184. "ring": {
  185. "type": "ring",
  186. "color": color,
  187. "padding": [5, 5, 5, 5],
  188. "rotate": false,
  189. "dataLabel": true,
  190. "legend": {
  191. "show": true,
  192. "position": "right",
  193. "lineHeight": 25,
  194. },
  195. "title": {
  196. "name": "收益率",
  197. "fontSize": 15,
  198. "color": "#666666"
  199. },
  200. "subtitle": {
  201. "name": "70%",
  202. "fontSize": 25,
  203. "color": "#7cb5ec"
  204. },
  205. "extra": {
  206. "ring": {
  207. "ringWidth": 30,
  208. "activeOpacity": 0.5,
  209. "activeRadius": 10,
  210. "offsetAngle": 0,
  211. "labelWidth": 15,
  212. "border": true,
  213. "borderWidth": 3,
  214. "borderColor": "#FFFFFF"
  215. },
  216. },
  217. },
  218. "rose": {
  219. "type": "rose",
  220. "color": color,
  221. "padding": [5, 5, 5, 5],
  222. "legend": {
  223. "show": true,
  224. "position": "left",
  225. "lineHeight": 25,
  226. },
  227. "extra": {
  228. "rose": {
  229. "type": "area",
  230. "minRadius": 50,
  231. "activeOpacity": 0.5,
  232. "activeRadius": 10,
  233. "offsetAngle": 0,
  234. "labelWidth": 15,
  235. "border": false,
  236. "borderWidth": 2,
  237. "borderColor": "#FFFFFF"
  238. },
  239. }
  240. },
  241. "word": {
  242. "type": "word",
  243. "color": color,
  244. "extra": {
  245. "word": {
  246. "type": "normal",
  247. "autoColors": false
  248. }
  249. }
  250. },
  251. "funnel": {
  252. "type": "funnel",
  253. "color": color,
  254. "padding": [15, 15, 0, 15],
  255. "extra": {
  256. "funnel": {
  257. "activeOpacity": 0.3,
  258. "activeWidth": 10,
  259. "border": true,
  260. "borderWidth": 2,
  261. "borderColor": "#FFFFFF",
  262. "fillOpacity": 1,
  263. "labelAlign": "right"
  264. },
  265. }
  266. },
  267. "map": {
  268. "type": "map",
  269. "color": color,
  270. "padding": [0, 0, 0, 0],
  271. "dataLabel": true,
  272. "extra": {
  273. "map": {
  274. "border": true,
  275. "borderWidth": 1,
  276. "borderColor": "#666666",
  277. "fillOpacity": 0.6,
  278. "activeBorderColor": "#F04864",
  279. "activeFillColor": "#FACC14",
  280. "activeFillOpacity": 1
  281. },
  282. }
  283. },
  284. "arcbar": {
  285. "type": "arcbar",
  286. "color": color,
  287. "title": {
  288. "name": "百分比",
  289. "fontSize": 25,
  290. "color": "#00FF00"
  291. },
  292. "subtitle": {
  293. "name": "默认标题",
  294. "fontSize": 15,
  295. "color": "#666666"
  296. },
  297. "extra": {
  298. "arcbar": {
  299. "type": "default",
  300. "width": 12,
  301. "backgroundColor": "#E9E9E9",
  302. "startAngle": 0.75,
  303. "endAngle": 0.25,
  304. "gap": 2
  305. }
  306. }
  307. },
  308. "line": {
  309. "type": "line",
  310. "color": color,
  311. "padding": [15, 10, 0, 15],
  312. "xAxis": {
  313. "disableGrid": true,
  314. },
  315. "yAxis": {
  316. "gridType": "dash",
  317. "dashLength": 2,
  318. },
  319. "legend": {},
  320. "extra": {
  321. "line": {
  322. "type": "straight",
  323. "width": 2
  324. },
  325. }
  326. },
  327. "column": {
  328. "type": "column",
  329. "color": color,
  330. "padding": [15, 15, 0, 5],
  331. "xAxis": {
  332. "disableGrid": true,
  333. },
  334. "yAxis": {},
  335. "legend": {},
  336. "extra": {
  337. "column": {
  338. "type": "group",
  339. "width": 30,
  340. "meterBorde": 1,
  341. "meterFillColor": "#FFFFFF",
  342. "activeBgColor": "#000000",
  343. "activeBgOpacity": 0.08
  344. },
  345. }
  346. },
  347. "area": {
  348. "type": "area",
  349. "canvasId": "",
  350. "canvas2d": false,
  351. "background": "none",
  352. "animation": true,
  353. "timing": "easeOut",
  354. "duration": 1000,
  355. "color": [
  356. "#FA6400",
  357. "#7747EE",
  358. "#FF6979",
  359. "#EE6666",
  360. "#73C0DE",
  361. "#3CA272",
  362. "#FC8452",
  363. "#9A60B4",
  364. "#ea7ccc"
  365. ],
  366. "padding": [
  367. 15,
  368. 15,
  369. 8,
  370. 8
  371. ],
  372. "rotate": false,
  373. "reserve": false,
  374. "fontSize": 12,
  375. "fontColor": "#B8C0C8",
  376. "enableScroll": false,
  377. "touchMoveLimit": 60,
  378. "enableMarkLine": false,
  379. "dataLabel": false,
  380. "dataPointShape": true,
  381. "dataPointShapeType": "solid",
  382. "xAxis": {
  383. "disabled": false,
  384. "axisLine": true,
  385. "axisLineColor": "#CCCCCC",
  386. "calibration": false,
  387. "fontColor": "#2D405E",
  388. "fontSize": 10,
  389. "rotateLabel": false,
  390. "itemCount": 5,
  391. "boundaryGap": "justify",
  392. "disableGrid": false,
  393. "gridColor": "#ECF0F7",
  394. "gridType": "solid",
  395. "dashLength": 4,
  396. "gridEval": 1,
  397. "scrollShow": false,
  398. "scrollAlign": "left",
  399. "scrollColor": "#A6A6A6",
  400. "scrollBackgroundColor": "#EFEBEF"
  401. },
  402. "yAxis": {
  403. "disabled": false,
  404. "disableGrid": false,
  405. "splitNumber": 5,
  406. "gridType": "dash",
  407. "dashLength": 2,
  408. "gridColor": "#ECF0F7",
  409. "padding": 10,
  410. "showTitle": false,
  411. "data": []
  412. },
  413. "legend": {
  414. "show": true,
  415. "position": "bottom",
  416. "float": "center",
  417. "padding": 5,
  418. "margin": 5,
  419. "backgroundColor": "rgba(0,0,0,0)",
  420. "borderColor": "rgba(0,0,0,0)",
  421. "borderWidth": 0,
  422. "fontSize": 13,
  423. "fontColor": "#666666",
  424. "lineHeight": 11,
  425. "hiddenColor": "#CECECE",
  426. "itemGap": 20
  427. },
  428. "extra": {
  429. "area": {
  430. "type": "curve",
  431. "opacity": 0.2,
  432. "addLine": true,
  433. "width": 3,
  434. "gradient": true
  435. },
  436. "tooltip": {
  437. "showBox": true,
  438. "showArrow": true,
  439. "borderWidth": 0,
  440. "borderRadius": 0,
  441. "borderColor": "#000000",
  442. "borderOpacity": 0.7,
  443. "bgColor": "#000000",
  444. "bgOpacity": 0.7,
  445. "gridType": "solid",
  446. "dashLength": 4,
  447. "gridColor": "#CCCCCC",
  448. "fontColor": "#FFFFFF",
  449. "splitLine": true,
  450. "horizentalLine": false,
  451. "xAxisLabel": false,
  452. "yAxisLabel": false,
  453. "labelBgColor": "#FFFFFF",
  454. "labelBgOpacity": 0.7,
  455. "labelFontColor": "#666666"
  456. },
  457. "markLine": {
  458. "type": "solid",
  459. "dashLength": 4,
  460. "data": []
  461. }
  462. }
  463. },
  464. "radar": {
  465. "type": "radar",
  466. "color": color,
  467. "padding": [5, 5, 5, 5],
  468. "legend": {
  469. "show": true,
  470. "position": "right",
  471. "lineHeight": 25,
  472. },
  473. "extra": {
  474. "radar": {
  475. "gridType": "radar",
  476. "gridColor": "#CCCCCC",
  477. "gridCount": 3,
  478. "opacity": 0.2,
  479. "labelColor": "#666666",
  480. "max": 200
  481. },
  482. }
  483. },
  484. "gauge": {
  485. "type": "gauge",
  486. "color": color,
  487. "title": {
  488. "name": "66Km/H",
  489. "fontSize": 25,
  490. "color": "#2fc25b",
  491. "offsetY": 50
  492. },
  493. "subtitle": {
  494. "name": "实时速度",
  495. "fontSize": 15,
  496. "color": "#1890ff",
  497. "offsetY": -50
  498. },
  499. "extra": {
  500. "gauge": {
  501. "type": "default",
  502. "width": 30,
  503. "labelColor": "#666666",
  504. "startAngle": 0.75,
  505. "endAngle": 0.25,
  506. "startNumber": 0,
  507. "endNumber": 100,
  508. "labelFormat": "",
  509. "splitLine": {
  510. "fixRadius": 0,
  511. "splitNumber": 10,
  512. "width": 30,
  513. "color": "#FFFFFF",
  514. "childNumber": 5,
  515. "childWidth": 12
  516. },
  517. "pointer": {
  518. "width": 24,
  519. "color": "auto"
  520. }
  521. }
  522. }
  523. },
  524. "candle": {
  525. "type": "candle",
  526. "color": color,
  527. "padding": [15, 15, 0, 15],
  528. "enableScroll": true,
  529. "enableMarkLine": true,
  530. "dataLabel": false,
  531. "xAxis": {
  532. "labelCount": 4,
  533. "itemCount": 40,
  534. "disableGrid": true,
  535. "gridColor": "#CCCCCC",
  536. "gridType": "solid",
  537. "dashLength": 4,
  538. "scrollShow": true,
  539. "scrollAlign": "left",
  540. "scrollColor": "#A6A6A6",
  541. "scrollBackgroundColor": "#EFEBEF"
  542. },
  543. "yAxis": {},
  544. "legend": {},
  545. "extra": {
  546. "candle": {
  547. "color": {
  548. "upLine": "#f04864",
  549. "upFill": "#f04864",
  550. "downLine": "#2fc25b",
  551. "downFill": "#2fc25b"
  552. },
  553. "average": {
  554. "show": true,
  555. "name": ["MA5", "MA10", "MA30"],
  556. "day": [5, 10, 20],
  557. "color": ["#1890ff", "#2fc25b", "#facc14"]
  558. }
  559. },
  560. "markLine": {
  561. "type": "dash",
  562. "dashLength": 5,
  563. "data": [{
  564. "value": 2150,
  565. "lineColor": "#f04864",
  566. "showLabel": true
  567. },
  568. {
  569. "value": 2350,
  570. "lineColor": "#f04864",
  571. "showLabel": true
  572. }
  573. ]
  574. }
  575. }
  576. },
  577. "mix": {
  578. "type": "mix",
  579. "canvasId": "",
  580. "canvas2d": false,
  581. "background": "none",
  582. "animation": true,
  583. "timing": "easeOut",
  584. "duration": 1000,
  585. "color": [
  586. "#1890FF",
  587. "#91CB74",
  588. "#FAC858",
  589. "#EE6666",
  590. "#73C0DE",
  591. "#3CA272",
  592. "#FC8452",
  593. "#9A60B4",
  594. "#ea7ccc"
  595. ],
  596. "padding": [
  597. 15,
  598. 15,
  599. 0,
  600. 15
  601. ],
  602. "rotate": false,
  603. "reserve": false,
  604. "fontSize": 13,
  605. "fontColor": "#666666",
  606. "enableScroll": false,
  607. "touchMoveLimit": 60,
  608. "enableMarkLine": false,
  609. "dataLabel": false,
  610. "dataPointShape": false,
  611. "dataPointShapeType": "solid",
  612. "xAxis": {
  613. "disabled": false,
  614. "axisLine": true,
  615. "axisLineColor": "#CCCCCC",
  616. "calibration": false,
  617. "fontColor": "#666666",
  618. "fontSize": 12,
  619. "rotateLabel": false,
  620. "labelCount": 2,
  621. "itemCount": 8,
  622. "boundaryGap": "justify",
  623. "disableGrid": true,
  624. "gridColor": "#CCCCCC",
  625. "gridType": "solid",
  626. "dashLength": 4,
  627. "gridEval": 1,
  628. "scrollShow": false,
  629. "scrollAlign": "left",
  630. "scrollColor": "#A6A6A6",
  631. "scrollBackgroundColor": "#EFEBEF"
  632. },
  633. "yAxis": {
  634. "disabled": false,
  635. "disableGrid": false,
  636. "splitNumber": 5,
  637. "gridType": "dash",
  638. "dashLength": 4,
  639. "gridColor": "#CCCCCC",
  640. "padding": 10,
  641. "showTitle": false,
  642. "data": [{
  643. "position": "left",
  644. "disabled": false,
  645. "axisLine": true,
  646. "axisLineColor": "#CCCCCC",
  647. "calibration": false,
  648. "fontColor": "#333",
  649. "fontSize": 10,
  650. "textAlign": "right",
  651. "title": "",
  652. "titleFontSize": 12,
  653. "titleOffsetY": 0,
  654. "titleOffsetX": 0,
  655. "titleFontColor": "#666666",
  656. "min": null,
  657. "max": null,
  658. "tofix": null,
  659. "unit": "",
  660. "format": "yAxisDemo1"
  661. },
  662. {
  663. "position": "right",
  664. "disabled": false,
  665. "axisLine": true,
  666. "axisLineColor": "#CCCCCC",
  667. "calibration": false,
  668. "fontColor": "#666666",
  669. "fontSize": 10,
  670. "textAlign": "right",
  671. "title": "",
  672. "titleFontSize": 12,
  673. "titleOffsetY": 0,
  674. "titleOffsetX": 0,
  675. "titleFontColor": "#666666",
  676. "min": null,
  677. "max": null,
  678. "tofix": null,
  679. "unit": "",
  680. "format": "yAxisDemo1"
  681. }
  682. ]
  683. },
  684. "legend": {
  685. "show": true,
  686. "position": "bottom",
  687. "float": "center",
  688. "padding": 5,
  689. "margin": 5,
  690. "backgroundColor": "rgba(0,0,0,0)",
  691. "borderColor": "rgba(0,0,0,0)",
  692. "borderWidth": 0,
  693. "fontSize": 13,
  694. "fontColor": "#666666",
  695. "lineHeight": 11,
  696. "hiddenColor": "#CECECE",
  697. "itemGap": 10
  698. },
  699. "extra": {
  700. "mix": {
  701. "column": {
  702. "width": 20,
  703. "seriesGap": 2,
  704. "barBorderCircle": false,
  705. "linearType": "none",
  706. "linearOpacity": 1,
  707. "colorStop": 0
  708. }
  709. },
  710. "tooltip": {
  711. "showBox": true,
  712. "showArrow": true,
  713. "borderWidth": 0,
  714. "borderRadius": 0,
  715. "borderColor": "#000000",
  716. "borderOpacity": 0.7,
  717. "bgColor": "#000000",
  718. "bgOpacity": 0.7,
  719. "gridType": "solid",
  720. "dashLength": 4,
  721. "gridColor": "#CCCCCC",
  722. "fontColor": "#FFFFFF",
  723. "splitLine": true,
  724. "horizentalLine": false,
  725. "xAxisLabel": false,
  726. "yAxisLabel": false,
  727. "labelBgColor": "#FFFFFF",
  728. "labelBgOpacity": 0.7,
  729. "labelFontColor": "#666666"
  730. },
  731. "markLine": {
  732. "type": "solid",
  733. "dashLength": 4,
  734. "data": []
  735. }
  736. }
  737. },
  738. "point": {
  739. "type": "point",
  740. "color": color,
  741. "padding": [15, 15, 0, 15],
  742. },
  743. "bubble": {
  744. "type": "bubble",
  745. "color": color,
  746. "padding": [15, 15, 0, 15],
  747. }
  748. }