3D基础柱状图.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781
  1. // 配置版本号
  2. const version = '2023091901'
  3. // 标题
  4. const title = '3D基础柱状图'
  5. // 用于标识,唯一,和文件夹名称一致
  6. const name = '3D基础柱状图'
  7. // 右侧配置项
  8. const setting = [
  9. {
  10. label: '维度',
  11. type: 'select', // 设置组件类型
  12. field: 'xField', // 字段
  13. optionField: 'xField', // 对应options中的字段
  14. // 是否多选
  15. multiple: false,
  16. value: '',
  17. tabName: 'data'
  18. },
  19. {
  20. label: '指标',
  21. type: 'select', // 设置组件类型
  22. field: 'yField', // 字段
  23. optionField: 'yField', // 对应options中的字段
  24. // 是否多选
  25. multiple: false,
  26. value: '',
  27. tabName: 'data'
  28. },
  29. // 样式配置
  30. {
  31. label: '柱子宽度',
  32. type: 'inputNumber', // 设置组件类型
  33. field: 'seriesCustom_barWidth', // 字段
  34. optionField: 'seriesCustom.barWidth', // 对应options中的字段
  35. value: 30,
  36. tabName: 'custom',
  37. groupName: 'graph'
  38. },
  39. {
  40. label: '柱子顶部颜色',
  41. type: 'colorPicker', // 设置组件类型
  42. field: 'seriesCustom_barTopColor', // 字段
  43. optionField: 'seriesCustom.barTopColor', // 对应options中的字段
  44. value: '#2DB1EF',
  45. tabName: 'custom',
  46. groupName: 'graph'
  47. },
  48. {
  49. label: '柱子颜色',
  50. type: 'colorPicker', // 设置组件类型
  51. field: 'seriesCustom_barColor', // 字段
  52. optionField: 'seriesCustom.barColor', // 对应options中的字段
  53. value: '#115ba6',
  54. tabName: 'custom',
  55. groupName: 'graph'
  56. },
  57. {
  58. label: '柱子底部颜色',
  59. type: 'colorPicker', // 设置组件类型
  60. field: 'seriesCustom_barBottomColor', // 字段
  61. optionField: 'seriesCustom.barBottomColor', // 对应options中的字段
  62. value: '#187dcb',
  63. tabName: 'custom',
  64. groupName: 'graph'
  65. },
  66. {
  67. label: '阴影柱子颜色',
  68. type: 'colorPicker', // 设置组件类型
  69. field: 'seriesCustom_shadowColor', // 字段
  70. optionField: 'seriesCustom.shadowColor', // 对应options中的字段
  71. value: '#041133',
  72. tabName: 'custom',
  73. groupName: 'graph'
  74. },
  75. {
  76. label: '阴影柱子顶部颜色',
  77. type: 'colorPicker', // 设置组件类型
  78. field: 'seriesCustom_shadowTopColor', // 字段
  79. optionField: 'seriesCustom.shadowTopColor', // 对应options中的字段
  80. value: '#142f5a',
  81. tabName: 'custom',
  82. groupName: 'graph'
  83. },
  84. {
  85. label: '底部阴影颜色',
  86. // 设置组件类型
  87. type: 'colorPicker',
  88. // 字段
  89. field: 'graphic_children_style_fill',
  90. // 对应options中的字段
  91. optionField: 'graphic.children.style.fill',
  92. value: '#3f4867',
  93. tabName: 'custom',
  94. groupName: 'graph'
  95. },
  96. {
  97. label: '数据标签',
  98. type: 'switch', // 设置组件类型
  99. field: 'series_barColor_label_show', // 字段
  100. optionField: 'series.barColor.label.show', // 对应options中的字段
  101. value: 1,
  102. active: 1,
  103. inactive: 0,
  104. tabName: 'custom',
  105. groupName: 'graph'
  106. },
  107. {
  108. label: '数据标签位置',
  109. type: 'select', // 设置组件类型
  110. field: 'series_barColor_label_position', // 字段
  111. optionField: 'series.barColor.label.position', // 对应options中的字段
  112. // 是否多选
  113. multiple: false,
  114. value: 'inside',
  115. tabName: 'custom',
  116. options: [
  117. {
  118. label: '顶部',
  119. value: 'top'
  120. },
  121. {
  122. label: '居中',
  123. value: 'inside'
  124. },
  125. {
  126. label: '底部',
  127. value: 'bottom'
  128. }
  129. ],
  130. groupName: 'graph'
  131. },
  132. {
  133. label: '数据标签颜色',
  134. type: 'colorPicker', // 设置组件类型
  135. field: 'series_barColor_label_color', // 字段
  136. optionField: 'series.barColor.label.color', // 对应options中的字段
  137. value: '#ffffff',
  138. tabName: 'custom',
  139. groupName: 'graph'
  140. },
  141. {
  142. label: '数据标签大小',
  143. // 设置组件类型
  144. type: 'inputNumber',
  145. // 字段
  146. field: 'series_barColor_label_fontSize',
  147. // 对应options中的字段
  148. optionField: 'series.barColor.label.fontSize',
  149. value: 12,
  150. tabName: 'custom',
  151. groupName: 'graph'
  152. },
  153. // 网格线
  154. {
  155. label: '分隔线',
  156. type: 'switch',
  157. field: 'yAxis_splitLine_show',
  158. optionField: 'yAxis.splitLine.show',
  159. value: 0,
  160. active: 1,
  161. inactive: 0,
  162. tabName: 'custom',
  163. groupName: 'grid'
  164. },
  165. {
  166. label: '宽度',
  167. type: 'inputNumber',
  168. field: 'yAxis_splitLine_lineStyle_width',
  169. optionField: 'yAxis.splitLine.lineStyle.width',
  170. value: 2,
  171. tabName: 'custom',
  172. groupName: 'grid'
  173. },
  174. {
  175. label: '颜色',
  176. type: 'colorPicker',
  177. field: 'yAxis_splitLine_lineStyle_color',
  178. optionField: 'yAxis.splitLine.lineStyle.color',
  179. value: '#fff',
  180. tabName: 'custom',
  181. groupName: 'grid'
  182. },
  183. // x轴 xAxis
  184. {
  185. label: '显示',
  186. type: 'switch',
  187. field: 'xAxis_show',
  188. optionField: 'xAxis.show',
  189. value: 0,
  190. active: 1,
  191. inactive: 0,
  192. tabName: 'custom',
  193. groupName: 'xAxis'
  194. },
  195. {
  196. label: '标题',
  197. type: 'input',
  198. field: 'xAxis_name',
  199. optionField: 'xAxis.name',
  200. value: '',
  201. tabName: 'custom',
  202. groupName: 'xAxis'
  203. },
  204. {
  205. label: '标题位置',
  206. type: 'select',
  207. field: 'xAxis_nameLocation',
  208. optionField: 'xAxis.nameLocation',
  209. value: 'start',
  210. tabName: 'custom',
  211. options: [
  212. {
  213. label: '左',
  214. value: 'start'
  215. },
  216. {
  217. label: '中',
  218. value: 'center'
  219. },
  220. {
  221. label: '右',
  222. value: 'end'
  223. }],
  224. groupName: 'xAxis'
  225. },
  226. {
  227. label: '标题到轴线距离',
  228. type: 'inputNumber',
  229. field: 'xAxis_nameGap',
  230. optionField: 'xAxis.nameGap',
  231. value: 10,
  232. tabName: 'custom',
  233. groupName: 'xAxis'
  234. },
  235. {
  236. label: '标题字体大小',
  237. type: 'inputNumber',
  238. field: 'xAxis_nameTextStyle_fontSize',
  239. optionField: 'xAxis.nameTextStyle.fontSize',
  240. value: 12,
  241. tabName: 'custom',
  242. groupName: 'xAxis'
  243. },
  244. {
  245. label: '标题颜色',
  246. type: 'colorPicker',
  247. field: 'xAxis_nameTextStyle_color',
  248. optionField: 'xAxis.nameTextStyle.color',
  249. // 是否多选
  250. multiple: false,
  251. value: '#8C8C8C',
  252. tabName: 'custom',
  253. groupName: 'xAxis'
  254. },
  255. {
  256. label: '轴线显示',
  257. type: 'switch',
  258. field: 'xAxis_axisLine_show',
  259. optionField: 'xAxis.axisLine.show',
  260. value: 0,
  261. active: 1,
  262. inactive: 0,
  263. tabName: 'custom',
  264. groupName: 'xAxis'
  265. },
  266. {
  267. label: '轴线颜色',
  268. type: 'colorPicker',
  269. field: 'xAxis_axisLine_lineStyle_color',
  270. optionField: 'xAxis.axisLine.lineStyle.color',
  271. // 是否多选
  272. multiple: false,
  273. value: '#333',
  274. tabName: 'custom',
  275. groupName: 'xAxis'
  276. },
  277. {
  278. label: '轴线宽度',
  279. type: 'inputNumber',
  280. field: 'xAxis_axisLine_lineStyle_width',
  281. optionField: 'xAxis.axisLine.lineStyle.width',
  282. value: 1,
  283. tabName: 'custom',
  284. groupName: 'xAxis'
  285. },
  286. {
  287. label: '标签显示',
  288. type: 'switch',
  289. field: 'xAxis_axisLabel_show',
  290. optionField: 'xAxis.axisLabel.show',
  291. value: 1,
  292. active: 1,
  293. inactive: 0,
  294. tabName: 'custom',
  295. groupName: 'xAxis'
  296. },
  297. {
  298. label: '标签颜色',
  299. type: 'colorPicker',
  300. field: 'xAxis_axisLabel_textStyle_color',
  301. optionField: 'xAxis.axisLabel.textStyle.color',
  302. // 是否多选
  303. multiple: false,
  304. value: '#8C8C8C',
  305. tabName: 'custom',
  306. groupName: 'xAxis'
  307. },
  308. {
  309. label: '标签大小',
  310. type: 'inputNumber',
  311. field: 'xAxis_axisLabel_textStyle_fontSize',
  312. optionField: 'xAxis.axisLabel.textStyle.fontSize',
  313. value: 14,
  314. tabName: 'custom',
  315. groupName: 'xAxis'
  316. },
  317. {
  318. label: '标签距离',
  319. type: 'inputNumber',
  320. field: 'xAxis_axisLabel_margin',
  321. optionField: 'xAxis.axisLabel.margin',
  322. value: 30,
  323. tabName: 'custom',
  324. groupName: 'xAxis'
  325. },
  326. // Y轴 yAxis
  327. {
  328. label: '显示',
  329. type: 'switch',
  330. field: 'yAxis_show',
  331. optionField: 'yAxis.show',
  332. value: 1,
  333. active: 1,
  334. inactive: 0,
  335. tabName: 'custom',
  336. groupName: 'yAxis'
  337. },
  338. {
  339. label: '标题',
  340. type: 'input',
  341. field: 'yAxis_name',
  342. optionField: 'yAxis.name',
  343. value: '',
  344. tabName: 'custom',
  345. groupName: 'yAxis'
  346. },
  347. {
  348. label: '标题位置',
  349. type: 'select',
  350. field: 'yAxis_nameLocation',
  351. optionField: 'yAxis.nameLocation',
  352. value: 'end',
  353. tabName: 'custom',
  354. options: [
  355. {
  356. label: '下',
  357. value: 'start'
  358. },
  359. {
  360. label: '中',
  361. value: 'center'
  362. },
  363. {
  364. label: '上',
  365. value: 'end'
  366. }],
  367. groupName: 'yAxis'
  368. },
  369. {
  370. label: '标题到轴线距离',
  371. type: 'inputNumber',
  372. field: 'yAxis_nameGap',
  373. optionField: 'yAxis.nameGap',
  374. value: 10,
  375. tabName: 'custom',
  376. groupName: 'yAxis'
  377. },
  378. {
  379. label: '标题字体大小',
  380. type: 'inputNumber',
  381. field: 'yAxis_nameTextStyle_fontSize',
  382. optionField: 'yAxis.nameTextStyle.fontSize',
  383. value: 12,
  384. tabName: 'custom',
  385. groupName: 'yAxis'
  386. },
  387. {
  388. label: '标题颜色',
  389. type: 'colorPicker',
  390. field: 'yAxis_nameTextStyle_color',
  391. optionField: 'yAxis.nameTextStyle.color',
  392. // 是否多选
  393. multiple: false,
  394. value: '#8C8C8C',
  395. tabName: 'custom',
  396. groupName: 'yAxis'
  397. },
  398. {
  399. label: '轴线显示',
  400. type: 'switch',
  401. field: 'yAxis_axisLine_show',
  402. optionField: 'yAxis.axisLine.show',
  403. value: 1,
  404. active: 1,
  405. inactive: 0,
  406. tabName: 'custom',
  407. groupName: 'yAxis'
  408. },
  409. {
  410. label: '轴线颜色',
  411. type: 'colorPicker',
  412. field: 'yAxis_axisLine_lineStyle_color',
  413. optionField: 'yAxis.axisLine.lineStyle.color',
  414. // 是否多选
  415. multiple: false,
  416. value: '#333',
  417. tabName: 'custom',
  418. groupName: 'yAxis'
  419. },
  420. {
  421. label: '轴线宽度',
  422. type: 'inputNumber',
  423. field: 'yAxis_axisLine_lineStyle_width',
  424. optionField: 'yAxis.axisLine.lineStyle.width',
  425. value: 1,
  426. tabName: 'custom',
  427. groupName: 'yAxis'
  428. },
  429. {
  430. label: '标签显示',
  431. type: 'switch',
  432. field: 'yAxis_axisLabel_show',
  433. optionField: 'yAxis.axisLabel.show',
  434. value: 1,
  435. active: 1,
  436. inactive: 0,
  437. tabName: 'custom',
  438. groupName: 'yAxis'
  439. },
  440. {
  441. label: '标签颜色',
  442. type: 'colorPicker',
  443. field: 'yAxis_axisLabel_textStyle_color',
  444. optionField: 'yAxis.axisLabel.textStyle.color',
  445. // 是否多选
  446. multiple: false,
  447. value: '#8C8C8C',
  448. tabName: 'custom',
  449. groupName: 'yAxis'
  450. },
  451. {
  452. label: '标签大小',
  453. type: 'inputNumber',
  454. field: 'yAxis_axisLabel_textStyle_fontSize',
  455. optionField: 'yAxis.axisLabel.textStyle.fontSize',
  456. value: 14,
  457. tabName: 'custom',
  458. groupName: 'yAxis'
  459. },
  460. {
  461. label: '标签距离',
  462. type: 'inputNumber',
  463. field: 'yAxis_axisLabel_margin',
  464. optionField: 'yAxis.axisLabel.margin',
  465. value: 10,
  466. tabName: 'custom',
  467. groupName: 'yAxis'
  468. },
  469. {
  470. label: '刻度显示',
  471. type: 'switch',
  472. field: 'yAxis_axisTick_show',
  473. optionField: 'yAxis.axisTick.show',
  474. value: 1,
  475. active: 1,
  476. inactive: 0,
  477. tabName: 'custom',
  478. groupName: 'yAxis'
  479. },
  480. {
  481. label: '刻度颜色',
  482. type: 'colorPicker',
  483. field: 'yAxis_axisTick_lineStyle_color',
  484. optionField: 'yAxis.axisTick.lineStyle.color',
  485. // 是否多选
  486. multiple: false,
  487. value: '#fff',
  488. tabName: 'custom',
  489. groupName: 'yAxis'
  490. },
  491. {
  492. label: '刻度宽度',
  493. type: 'inputNumber',
  494. field: 'yAxis_axisTick_length',
  495. optionField: 'yAxis.axisTick.length',
  496. // 是否多选
  497. multiple: false,
  498. value: 1,
  499. tabName: 'custom',
  500. groupName: 'yAxis'
  501. }
  502. ]
  503. // 配置处理脚本
  504. const optionHandler = ''
  505. // 数据处理脚本
  506. const dataHandler = ''
  507. // 图表配置 new Line('domName', option)
  508. const xData = ['本年话务总量', '本年人工话务量', '每万客户呼入量', '本年话务总量']
  509. const yData = [300, 1230, 425, 300]
  510. const maxData = [1500, 1500, 1500, 1500]
  511. const option = {
  512. animation: false,
  513. tooltip: {
  514. show: true
  515. },
  516. grid: {
  517. left: '12%',
  518. right: '8%',
  519. bottom: '20%',
  520. z: 100,
  521. containLabel: false,
  522. show: false
  523. },
  524. graphic: {
  525. type: 'group',
  526. bottom: '10%',
  527. left: '7%',
  528. z: 100,
  529. children: [
  530. {
  531. type: 'rect',
  532. left: 0,
  533. bottom: 0,
  534. shape: {
  535. width: 418 * 0.9,
  536. height: 10
  537. },
  538. style: {
  539. fill: '#3f4867'
  540. }
  541. },
  542. {
  543. type: 'polygon',
  544. left: 0,
  545. bottom: 10,
  546. shape: {
  547. // 左上、右上、右下、左下
  548. points: [[418 / 10, -320 / 6], [418 - 418 / 6, -320 / 6], [418 * 0.9, 0], [0, 0]]
  549. },
  550. style: {
  551. fill: '#303256'
  552. }
  553. }
  554. ]
  555. },
  556. xAxis: [
  557. {
  558. show: false,
  559. name: '',
  560. nameGap: 30,
  561. type: 'category',
  562. data: xData,
  563. nameTextStyle: {
  564. color: '',
  565. fontSize: 12
  566. },
  567. nameLocation: '',
  568. // 坐标轴刻度设置
  569. axisTick: {
  570. show: false,
  571. alignWithLabel: true,
  572. lineStyle: {
  573. width: 1,
  574. color: '#333'
  575. }
  576. },
  577. // 是否显示坐标轴的轴线
  578. axisLine: {
  579. show: false,
  580. lineStyle: {
  581. color: '#333',
  582. width: 1
  583. }
  584. },
  585. // 坐标轴刻度标签
  586. axisLabel: {
  587. show: false,
  588. textStyle: {
  589. fontSize: 10,
  590. color: 'rgb(40, 129, 170)'
  591. },
  592. margin: 30
  593. }
  594. },
  595. {
  596. show: false,
  597. type: 'category',
  598. axisLine: {
  599. show: false
  600. },
  601. axisTick: {
  602. show: false
  603. },
  604. axisLabel: {
  605. show: false
  606. },
  607. splitArea: {
  608. show: false
  609. },
  610. splitLine: {
  611. show: false
  612. },
  613. data: xData
  614. }
  615. ],
  616. yAxis: {
  617. name: '',
  618. nameGap: 10,
  619. nameTextStyle: {
  620. color: '',
  621. fontSize: 12
  622. },
  623. nameLocation: 'end',
  624. show: true,
  625. type: 'value',
  626. axisLabel: {
  627. show: true,
  628. textStyle: {
  629. color: '#333',
  630. fontSize: 12
  631. },
  632. margin: 10
  633. },
  634. axisTick: {
  635. show: true,
  636. length: 1,
  637. lineStyle: {
  638. color: '#fff',
  639. width: 1
  640. }
  641. },
  642. // 分隔线
  643. splitLine: {
  644. show: true, // yAxis.show配置为true时,该配置才有效
  645. lineStyle: {
  646. color: '#fff',
  647. width: 2
  648. }
  649. },
  650. // y轴轴线是否显示
  651. axisLine: {
  652. show: true,
  653. lineStyle: {
  654. color: '#333',
  655. width: 1
  656. }
  657. }
  658. },
  659. seriesCustom: {
  660. barWidth: 30,
  661. // 顶部菱形颜色
  662. barTopColor: '#2DB1EF',
  663. // 底部菱形颜色
  664. barBottomColor: '#187dcb',
  665. // 柱子颜色
  666. barColor: '#1db0dd',
  667. // 阴影柱子颜色
  668. shadowColor: '#041133',
  669. // 阴影柱子顶部颜色
  670. shadowTopColor: '#142f5a'
  671. },
  672. series: [
  673. // 顶部
  674. {
  675. id: 'barTopColor', // 用于区分是图表的什么部分
  676. type: 'pictorialBar', // 象形柱图
  677. symbol: 'diamond',
  678. symbolOffset: [0, '-50%'], // 上部菱形
  679. symbolSize: [30, 15],
  680. // symbolOffset: [0, -6], // 上部椭圆
  681. symbolPosition: 'end',
  682. z: 12,
  683. label: {
  684. show: false
  685. },
  686. color: '#2DB1EF',
  687. tooltip: {
  688. show: false
  689. },
  690. data: yData
  691. },
  692. // 底部
  693. {
  694. id: 'barBottomColor', // 用于区分是图表的什么部分
  695. type: 'pictorialBar',
  696. symbol: 'diamond',
  697. symbolSize: [30, 15],
  698. symbolOffset: ['0%', '50%'], // 下部菱形
  699. // symbolOffset: [0, 7], // 下部椭圆
  700. z: 12,
  701. color: '#187dcb',
  702. tooltip: {
  703. show: false
  704. },
  705. label: {
  706. show: false
  707. },
  708. data: yData
  709. },
  710. // 柱子
  711. {
  712. id: 'barColor', // 用于区分是图表的什么部分
  713. type: 'bar',
  714. barWidth: 30,
  715. z: 10,
  716. color: '#115ba6',
  717. label: {
  718. show: true,
  719. position: 'inside',
  720. color: '#fff',
  721. fontSize: 12
  722. },
  723. data: yData
  724. },
  725. // 阴影柱子
  726. {
  727. id: 'shadowColor', // 用于区分是图表的什么部分
  728. type: 'bar',
  729. barWidth: 30,
  730. barGap: '-100%',
  731. itemStyle: {
  732. normal: {
  733. opacity: 0.8,
  734. shadowColor: 'rgba(0, 0, 0, 0.5)', // 阴影颜色
  735. shadowBlur: 0 // 阴影模糊值
  736. }
  737. },
  738. label: {
  739. show: false
  740. },
  741. color: '#041133',
  742. tooltip: {
  743. show: false
  744. },
  745. data: maxData
  746. },
  747. // 阴影顶部
  748. {
  749. id: 'shadowTopColor', // 用于区分是图表的什么部分
  750. type: 'pictorialBar', // 象形柱图
  751. symbol: 'diamond',
  752. symbolOffset: [0, '-50%'], // 上部菱形
  753. symbolSize: [30, 15],
  754. // symbolOffset: [0, -6], // 上部椭圆
  755. symbolPosition: 'end',
  756. z: 12,
  757. label: {
  758. show: false
  759. },
  760. color: '#142f5a',
  761. tooltip: {
  762. show: false
  763. },
  764. data: maxData
  765. }
  766. ]
  767. }
  768. export default {
  769. version,
  770. title,
  771. name,
  772. option,
  773. setting,
  774. optionHandler,
  775. dataHandler
  776. }