909eba93a690a2c78e66823504ebad7420ed47e0.svn-base 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <a-card :bordered="false">
  3. <a-tabs defaultActiveKey="1">
  4. <!-- 柱状图 -->
  5. <a-tab-pane tab="柱状图" key="1">
  6. <bar title="销售额排行" :dataSource="barData" :height="height"/>
  7. </a-tab-pane>
  8. <!-- 多列柱状图 -->
  9. <a-tab-pane tab="多列柱状图" key="2">
  10. <bar-multid title="多列柱状图" :height="height"/>
  11. </a-tab-pane>
  12. <!-- 迷你柱状图 -->
  13. <a-tab-pane tab="迷你柱状图" key="3">
  14. <mini-bar :dataSource="barData" :width="400" :height="200"/>
  15. </a-tab-pane>
  16. <!-- 面积图 -->
  17. <a-tab-pane tab="面积图" key="4">
  18. <area-chart-ty title="销售额排行" :dataSource="areaData" x="月份" y="销售额" :height="height"/>
  19. </a-tab-pane>
  20. <!-- 迷你面积图 -->
  21. <a-tab-pane tab="迷你面积图" key="5">
  22. <div style="padding-top: 100px;width:600px;height:200px">
  23. <mini-area :dataSource="areaData" x="月份" y="销售额" :height="height"/>
  24. </div>
  25. </a-tab-pane>
  26. <!-- 多行折线图 -->
  27. <a-tab-pane tab="多行折线图" key="6">
  28. <line-chart-multid title="多行折线图" :height="height"/>
  29. </a-tab-pane>
  30. <!-- 饼图 -->
  31. <a-tab-pane tab="饼图" key="7">
  32. <pie title="饼图" :height="height"/>
  33. </a-tab-pane>
  34. <!-- 雷达图 -->
  35. <a-tab-pane tab="雷达图" key="8">
  36. <radar title="雷达图" :height="height"/>
  37. </a-tab-pane>
  38. <!-- 仪表盘 -->
  39. <a-tab-pane tab="仪表盘" key="9">
  40. <dash-chart-demo title="仪表盘" :value="9" :height="height"/>
  41. </a-tab-pane>
  42. <!-- 进度条 -->
  43. <a-tab-pane tab="进度条" key="10">
  44. <mini-progress :percentage="30" :target="40" :height="30"/>
  45. <mini-progress :percentage="51" :target="60" :height="30" color="#FFA500"/>
  46. <mini-progress :percentage="66" :target="80" :height="30" color="#1E90FF"/>
  47. <mini-progress :percentage="74" :target="70" :height="30" color="#FF4500"/>
  48. <mini-progress :percentage="92" :target="100" :height="30" color="#49CC49"/>
  49. </a-tab-pane>
  50. <!-- 排名列表 -->
  51. <a-tab-pane tab="排名列表" key="11">
  52. <rank-list title="门店销售排行榜" :list="rankList" style="width: 600px;margin: 0 auto;"/>
  53. </a-tab-pane>
  54. <!-- TransferBar -->
  55. <a-tab-pane tab="TransferBar" key="12">
  56. <transfer-bar title="年度消耗流量一览表" :data="barData" x="月份" y="流量(Mb)" :height="height"/>
  57. </a-tab-pane>
  58. <!-- Trend -->
  59. <a-tab-pane tab="Trend" key="13">
  60. <trend title="Trend" term="Trend:" :percentage="30"/>
  61. </a-tab-pane>
  62. <!-- Liquid -->
  63. <a-tab-pane tab="Liquid" key="14">
  64. <liquid :height="height"/>
  65. </a-tab-pane>
  66. <!-- BarAndLine -->
  67. <a-tab-pane tab="BarAndLine" key="15">
  68. <bar-and-line :height="height"/>
  69. </a-tab-pane>
  70. </a-tabs>
  71. </a-card>
  72. </template>
  73. <script>
  74. import AreaChartTy from '@/components/chart/AreaChartTy'
  75. import Bar from '@/components/chart/Bar'
  76. import BarMultid from '@/components/chart/BarMultid'
  77. import DashChartDemo from '@/components/chart/DashChartDemo'
  78. import LineChartMultid from '@/components/chart/LineChartMultid'
  79. import Liquid from '@/components/chart/Liquid'
  80. import MiniBar from '@/components/chart/MiniBar'
  81. import MiniArea from '@/components/chart/MiniArea'
  82. import MiniProgress from '@/components/chart/MiniProgress'
  83. import Pie from '@/components/chart/Pie'
  84. import Radar from '@/components/chart/Radar'
  85. import RankList from '@/components/chart/RankList'
  86. import TransferBar from '@/components/chart/TransferBar'
  87. import Trend from '@/components/chart/Trend'
  88. import BarAndLine from '@/components/chart/BarAndLine'
  89. export default {
  90. name: 'ViserChartDemo',
  91. components: {
  92. Bar, MiniBar, BarMultid, AreaChartTy, LineChartMultid,
  93. Pie, Radar, DashChartDemo, MiniProgress, RankList,
  94. TransferBar, Trend, Liquid, MiniArea, BarAndLine
  95. },
  96. data() {
  97. return {
  98. height: 420,
  99. rankList: [],
  100. barData: [],
  101. areaData: []
  102. }
  103. },
  104. created() {
  105. setTimeout(() => {
  106. this.loadBarData()
  107. this.loadAreaData()
  108. this.loadRankListData()
  109. }, 100)
  110. },
  111. methods: {
  112. loadData(x, y, max, min, before = '', after = '月') {
  113. let data = []
  114. for (let i = 0; i < 12; i += 1) {
  115. data.push({
  116. [x]: `${before}${i + 1}${after}`,
  117. [y]: Math.floor(Math.random() * max) + min
  118. })
  119. }
  120. return data
  121. },
  122. // 加载柱状图数据
  123. loadBarData() {
  124. this.barData = this.loadData('x', 'y', 1000, 200)
  125. },
  126. // 加载AreaChartTy的数据
  127. loadAreaData() {
  128. this.areaData = this.loadData('x', 'y', 500, 100)
  129. },
  130. loadRankListData() {
  131. this.rankList = this.loadData('name', 'total', 2000, 100, '北京朝阳 ', ' 号店')
  132. }
  133. }
  134. }
  135. </script>
  136. <style scoped>
  137. </style>