pieChart.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <!-- 饼图 -->
  2. <template>
  3. <view class="charts-box">
  4. <view class="charts-box-title">{{ title }}</view>
  5. <qiun-data-charts type="pie" :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. // color: ['#1890FF', '#91CB74', '#FAC858', '#EE6666', '#73C0DE', '#3CA272', '#FC8452', '#9A60B4', '#ea7ccc'],
  26. dataLabel: true,
  27. legend: {
  28. position: 'bottom',
  29. lineHeight: 20
  30. },
  31. extra: {
  32. pie: {
  33. activeOpacity: 0.5,
  34. activeRadius: 10,
  35. offsetAngle: 0,
  36. labelWidth: 15,
  37. border: true,
  38. borderWidth: 3,
  39. borderColor: '#FFFFFF',
  40. linearType: 'custom'
  41. }
  42. }
  43. };
  44. }
  45. }
  46. },
  47. data() {
  48. return {};
  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>