pie.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. export default {
  2. tooltip: {
  3. trigger: 'item'
  4. },
  5. series: [
  6. {
  7. name: '',
  8. type: 'pie',
  9. radius: '50%',
  10. top: 30,
  11. data: [],
  12. itemStyle: {
  13. borderColor: '#fff',
  14. borderWidth: 1
  15. },
  16. label: {
  17. alignTo: 'edge',
  18. formatter: '{name|{b}}\n{time|{c}}',
  19. minMargin: 5,
  20. edgeDistance: '15%',
  21. lineHeight: 25,
  22. rich: {
  23. time: {
  24. fontSize: 12,
  25. color: '#999'
  26. }
  27. }
  28. },
  29. labelLine: {
  30. length: 10,
  31. length2: 0,
  32. maxSurfaceAngle: 80
  33. },
  34. labelLayout: function (params) {
  35. const isLeft = params.align === 'left'
  36. const points = params.labelLinePoints
  37. // Update the end point.
  38. points[2][0] = isLeft
  39. ? params.labelRect.x
  40. : params.labelRect.x + params.labelRect.width
  41. return {
  42. labelLinePoints: points
  43. }
  44. },
  45. emphasis: {
  46. itemStyle: {
  47. shadowBlur: 10,
  48. shadowOffsetX: 0,
  49. shadowColor: 'rgba(0, 0, 0, 0.5)'
  50. }
  51. }
  52. }
  53. ]
  54. }