namespace ruanzhifenbu { let { formmaterValueZhou } = require("../../../../utils/util") const chartCatch: antvChart = { toufangfenxiChart: undefined } module.exports = { upLine() { if (chartCatch.toufangfenxiChart === undefined) return chartCatch.toufangfenxiChart.clear() let key = this.data.select[this.data.select_act].proportionType; const data = this.data.DayList; if (chartCatch.toufangfenxiChart === undefined) return; chartCatch.toufangfenxiChart.source(data); chartCatch.toufangfenxiChart.coord('polar'); let p: any = {} p[key] = { min: 0, max: 120, nice: false, tickCount: 4 } chartCatch.toufangfenxiChart.source(data, p); chartCatch.toufangfenxiChart.legend(false); chartCatch.toufangfenxiChart.tooltip({ custom: false, // 自定义 tooltip 内容框 onShow: function onChange(obj: any) { console.log(obj) obj.items[0].name = obj.items[0].title obj.items[0].value = Number((obj.items[0].value * 100).toFixed(2)) + '%' } }); chartCatch.toufangfenxiChart.axis(key, { line: { lineWidth: 1, stroke: '#ccc', top: true, // 展示在最上层 }, label: function label(text: string, index: number, total: number) { if (index === total - 1) { return null; } return { top: true }; }, }); chartCatch.toufangfenxiChart.area().position('name*value').color('type') .animate({ appear: { animation: 'groupWaveIn' } }); chartCatch.toufangfenxiChart.line().position('name*value').color('type') .animate({ appear: { animation: 'groupWaveIn' } }); chartCatch.toufangfenxiChart.render(); }, line(F2: any, config: any) { if (chartCatch.toufangfenxiChart !== undefined) chartCatch.toufangfenxiChart.destroy(), chartCatch.toufangfenxiChart = undefined; let sys = wx.getSystemInfoSync(); config.height = sys.windowHeight * .6; chartCatch.toufangfenxiChart = new F2.Chart(config); let key = this.data.select[this.data.select_act].proportionType; const data = this.data.DayList; if (chartCatch.toufangfenxiChart === undefined) return; chartCatch.toufangfenxiChart.source(data); chartCatch.toufangfenxiChart.coord('polar'); let p: any = {} p[key] = { min: 0, max: 120, nice: false, tickCount: 4 } chartCatch.toufangfenxiChart.source(data, p); chartCatch.toufangfenxiChart.legend(false); chartCatch.toufangfenxiChart.tooltip({ custom: false, // 自定义 tooltip 内容框 onShow: function onChange(obj: any) { console.log(obj) obj.items[0].name = obj.items[0].title obj.items[0].value = Number((obj.items[0].value * 100).toFixed(2)) + '%' } }); chartCatch.toufangfenxiChart.axis(key, { line: { lineWidth: 1, stroke: '#ccc', top: true, // 展示在最上层 }, label: function label(text: string, index: number, total: number) { if (index === total - 1) { return null; } return { top: true }; }, }); chartCatch.toufangfenxiChart.area().position('name*value').color('type') .animate({ appear: { animation: 'groupWaveIn' } }); chartCatch.toufangfenxiChart.line().position('name*value').color('type') .animate({ appear: { animation: 'groupWaveIn' } }); chartCatch.toufangfenxiChart.render(); return chartCatch.toufangfenxiChart; }, clearchart(){ if (chartCatch.toufangfenxiChart !== undefined) chartCatch.toufangfenxiChart.destroy(), chartCatch.toufangfenxiChart = undefined; } }; }