F2.ts 3.8 KB

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