columnChart.vue 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <!-- 柱状图 -->
  2. <template>
  3. <view class="charts-box">
  4. <view class="charts-box-title">{{ title }}</view>
  5. <qiun-data-charts type="column" :canvas2d="true" :ontouch="true" :chartData="chartData" :opts="opts" />
  6. </view>
  7. </template>
  8. <script>
  9. export default {
  10. props: {
  11. chartData: {
  12. type: Object,
  13. default: () => {
  14. return {}
  15. }
  16. },
  17. title: {
  18. type: [String, Number],
  19. default: ''
  20. },
  21. opts: {
  22. type: Object,
  23. default: () => {
  24. return {
  25. xAxis: {
  26. rotateLabel: false,
  27. labelCount: 12
  28. },
  29. yAxis: {
  30. showTitle: true,
  31. splitNumber: 5,
  32. data: [{
  33. title: '收益(元)',
  34. titleOffsetY: -5
  35. }]
  36. },
  37. legend: {
  38. show: false
  39. },
  40. dataLabel: false,
  41. extra: {
  42. column: {
  43. width: 20
  44. }
  45. }
  46. }
  47. }
  48. }
  49. }
  50. }
  51. </script>
  52. <style lang="scss" scoped>
  53. .charts-box {
  54. background-color: #fff;
  55. border-radius: 5px;
  56. padding: 18px 15px;
  57. &-title {
  58. text-align: center;
  59. margin-bottom: 10px;
  60. }
  61. }
  62. </style>