F2.ts 4.0 KB

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