chart.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <Echart
  3. :options="options"
  4. id="centreRight2Chart1" style="width: 300px; height: 280px;position: absolute; left: 20%;"
  5. ></Echart>
  6. </template>
  7. <script>
  8. import Echart from '@/common/echart'
  9. export default {
  10. data () {
  11. return {
  12. options: {},
  13. };
  14. },
  15. components: {
  16. Echart,
  17. },
  18. props: {
  19. cdata: {
  20. type: Object,
  21. default: () => ({})
  22. },
  23. },
  24. watch: {
  25. cdata: {
  26. handler (newData) {
  27. // 固定样式数据
  28. let lineStyle = {
  29. normal: {
  30. width: 1,
  31. opacity: 0.5
  32. }
  33. };
  34. this.options = {
  35. radar: {
  36. indicator: newData.indicatorData,
  37. shape: "circle",
  38. splitNumber: 5,
  39. radius: ["0%", "40%"],
  40. name: {
  41. textStyle: {
  42. color: "rgb(238, 197, 102)"
  43. }
  44. },
  45. splitLine: {
  46. lineStyle: {
  47. color: [
  48. "rgba(238, 197, 102, 0.1)",
  49. "rgba(238, 197, 102, 0.2)",
  50. "rgba(238, 197, 102, 0.4)",
  51. "rgba(238, 197, 102, 0.6)",
  52. "rgba(238, 197, 102, 0.8)",
  53. "rgba(238, 197, 102, 1)"
  54. ].reverse()
  55. }
  56. },
  57. splitArea: {
  58. show: false
  59. },
  60. axisLine: {
  61. lineStyle: {
  62. color: "rgba(238, 197, 102, 0.5)"
  63. }
  64. },
  65. nameGap: 18
  66. },
  67. series: [
  68. {
  69. name: "",
  70. type: "radar",
  71. lineStyle: lineStyle,
  72. data: newData.dataRadius,
  73. symbol: "circle",
  74. label: {
  75. show: true,
  76. offset: [0, 3],
  77. },
  78. itemStyle: {
  79. normal: {
  80. color: "#F9713C"
  81. }
  82. },
  83. areaStyle: {
  84. normal: {
  85. opacity: 0.1
  86. }
  87. }
  88. },
  89. ],
  90. title: {
  91. text: '工序投产良率分析',
  92. textStyle: {
  93. color: '#fff', // 白色字体
  94. fontSize: 16,
  95. },
  96. top: '0%',
  97. left: 'center' // 垂直居中
  98. }
  99. }
  100. },
  101. immediate: true,
  102. deep: true
  103. }
  104. }
  105. };
  106. </script>