F2.ts 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. namespace jiemufenbu {
  2. const chartCatch: antvChart = {
  3. toufangfenxiChart: undefined
  4. }
  5. module.exports = {
  6. upLine() {
  7. if (chartCatch.toufangfenxiChart === undefined) return
  8. chartCatch.toufangfenxiChart.clear()
  9. let key = this.data.select[this.data.select_act].proportionType;
  10. const data = this.data.DayList;
  11. if (chartCatch.toufangfenxiChart === undefined) return;
  12. chartCatch.toufangfenxiChart.source(data);
  13. chartCatch.toufangfenxiChart.coord('polar');
  14. let p: any = {}
  15. p[key] = {
  16. min: 0,
  17. max: 120,
  18. nice: false,
  19. tickCount: 4
  20. }
  21. chartCatch.toufangfenxiChart.source(data, p);
  22. chartCatch.toufangfenxiChart.legend(false);
  23. chartCatch.toufangfenxiChart.tooltip({
  24. custom: false, // 自定义 tooltip 内容框
  25. onShow: function onChange(obj: any) {
  26. obj.items[0].name = obj.items[0].title
  27. obj.items[0].value = Number(Number(obj.items[0].value).toFixed(2)) + '%'
  28. }
  29. });
  30. chartCatch.toufangfenxiChart.axis(key, {
  31. line: {
  32. lineWidth: 1,
  33. stroke: '#ccc',
  34. top: true, // 展示在最上层
  35. },
  36. label: function label(text: string, index: number, total: number) {
  37. if (index === total - 1) {
  38. return null;
  39. }
  40. return {
  41. top: true
  42. };
  43. },
  44. });
  45. chartCatch.toufangfenxiChart.area().position('programType*value').color('type')
  46. .animate({
  47. appear: {
  48. animation: 'groupWaveIn'
  49. }
  50. });
  51. chartCatch.toufangfenxiChart.line().position('programType*value').color('type')
  52. .animate({
  53. appear: {
  54. animation: 'groupWaveIn'
  55. }
  56. });
  57. chartCatch.toufangfenxiChart.render();
  58. },
  59. line(F2: any, config: any) {
  60. if (chartCatch.toufangfenxiChart !== undefined) chartCatch.toufangfenxiChart.destroy(), chartCatch.toufangfenxiChart = undefined;
  61. let sys = wx.getSystemInfoSync();
  62. config.height = sys.windowHeight * .6;
  63. chartCatch.toufangfenxiChart = new F2.Chart(config);
  64. let key = this.data.select[this.data.select_act].proportionType;
  65. const data = this.data.DayList;
  66. if (chartCatch.toufangfenxiChart === undefined) return;
  67. chartCatch.toufangfenxiChart.source(data);
  68. chartCatch.toufangfenxiChart.coord('polar');
  69. let p: any = {}
  70. p[key] = {
  71. min: 0,
  72. max: 120,
  73. nice: false,
  74. tickCount: 4
  75. }
  76. chartCatch.toufangfenxiChart.source(data, p);
  77. chartCatch.toufangfenxiChart.legend(false);
  78. chartCatch.toufangfenxiChart.tooltip({
  79. custom: false, // 自定义 tooltip 内容框
  80. onShow: function onChange(obj: any) {
  81. obj.items[0].name = obj.items[0].title
  82. obj.items[0].value = Number(Number(obj.items[0].value ).toFixed(2)) + '%'
  83. }
  84. });
  85. chartCatch.toufangfenxiChart.axis(key, {
  86. line: {
  87. lineWidth: 1,
  88. stroke: '#ccc',
  89. top: true, // 展示在最上层
  90. },
  91. label: function label(text: string, index: number, total: number) {
  92. if (index === total - 1) {
  93. return null;
  94. }
  95. return {
  96. top: true
  97. };
  98. },
  99. });
  100. chartCatch.toufangfenxiChart.area().position('programType*value').color('type')
  101. .animate({
  102. appear: {
  103. animation: 'groupWaveIn'
  104. }
  105. });
  106. chartCatch.toufangfenxiChart.line().position('programType*value').color('type')
  107. .animate({
  108. appear: {
  109. animation: 'groupWaveIn'
  110. }
  111. });
  112. chartCatch.toufangfenxiChart.render();
  113. return chartCatch.toufangfenxiChart;
  114. },
  115. clearchart(){
  116. if (chartCatch.toufangfenxiChart !== undefined) chartCatch.toufangfenxiChart.destroy(), chartCatch.toufangfenxiChart = undefined;
  117. }
  118. };
  119. }