chart.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <div>
  3. <Echart
  4. :options="options"
  5. id="centreLeft1Chart"
  6. height="350px"
  7. width="315px"
  8. ></Echart>
  9. </div>
  10. </template>
  11. <script>
  12. import Echart from '@/common/echart'
  13. export default {
  14. data () {
  15. return {
  16. options: {},
  17. };
  18. },
  19. components: {
  20. Echart,
  21. },
  22. props: {
  23. cdata: {
  24. type: Object,
  25. default: () => ({})
  26. },
  27. },
  28. watch: {
  29. cdata: {
  30. handler (newData) {
  31. this.options = {
  32. color: [
  33. "#37a2da",
  34. "#32c5e9",
  35. "#9fe6b8",
  36. "#ffdb5c",
  37. "#ff9f7f",
  38. "#fb7293",
  39. "#e7bcf3",
  40. "#8378ea"
  41. ],
  42. tooltip: {
  43. trigger: "item",
  44. formatter: "{a} <br/>{b} : {c} ({d}%)"
  45. },
  46. toolbox: {
  47. show: true
  48. },
  49. calculable: true,
  50. legend: {
  51. orient: "vertical",
  52. icon: "circle",
  53. bottom: 0,
  54. x: "center",
  55. data: newData.cdata,
  56. textStyle: {
  57. color: "#fff",
  58. },
  59. },
  60. series: [
  61. {
  62. name: "不良现象统计",
  63. type: "pie",
  64. radius: [15, 60],
  65. roseType: "area",
  66. center: ["50%", "30%"],
  67. data: newData.seriesData,
  68. }
  69. ]
  70. }
  71. },
  72. immediate: true,
  73. deep: true
  74. }
  75. }
  76. };
  77. </script>
  78. <style lang="scss" scoped>
  79. </style>