lineChart.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <!-- 折线图 -->
  2. <template>
  3. <view class="charts-box">
  4. <view class="charts-box-title">{{ title }}</view>
  5. <qiun-data-charts type="line" :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: 6
  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. data() {
  51. return {}
  52. }
  53. }
  54. </script>
  55. <style lang="scss" scoped>
  56. .charts-box {
  57. background-color: #fff;
  58. border-radius: 5px;
  59. padding: 18px 15px;
  60. &-title {
  61. text-align: center;
  62. margin-bottom: 10px;
  63. }
  64. }
  65. </style>