namespace hangyezhanbi { let { formmaterValueZhou } = require("../../../../utils/util") const chartCatch: antvChart = { toufangfenxiChart: undefined } module.exports = { upLine() { if (chartCatch.toufangfenxiChart === undefined) return let key = this.data.select[this.data.select_act].proportionType; let unit = this.data.select[this.data.select_act].unit; chartCatch.toufangfenxiChart.clear() const data = (this.data.DayList.hardMdata || []).map((v: any) => { v[key] = Number(v[key] || 0) v.industryId = v.industryId.toString() return v }); if (chartCatch.toufangfenxiChart === undefined) return; chartCatch.toufangfenxiChart.source(data); chartCatch.toufangfenxiChart.coord('polar', { transposed: true, radius: 0.75 }); chartCatch.toufangfenxiChart.legend(false); chartCatch.toufangfenxiChart.axis(false); chartCatch.toufangfenxiChart.tooltip(false); // 添加饼图文本 chartCatch.toufangfenxiChart.pieLabel({ sidePadding: 10, label1: function label1(data: any, color: string) { return { text: data.midIndustryName, fill: color }; }, label2: function label2(data: any) { return { text: formmaterValueZhou(data[key]) + unit, fill: '#808080', fontWeight: 'bold' }; } }); chartCatch.toufangfenxiChart.interval() .position('industryId*' + key) .color('midIndustryName').adjust('stack'); chartCatch.toufangfenxiChart.render(); }, line(F2: any, config: any) { if (chartCatch.toufangfenxiChart !== undefined) chartCatch.toufangfenxiChart.destroy(), chartCatch.toufangfenxiChart = undefined; let sys = wx.getSystemInfoSync(); let key = this.data.select[this.data.select_act].proportionType; let unit = this.data.select[this.data.select_act].unit; config.height = sys.windowWidth / 16 * 9; chartCatch.toufangfenxiChart = new F2.Chart(config); const data = (this.data.DayList.hardMdata || []).map((v: any) => { v[key] = Number(v[key] || 0) v.industryId = v.industryId.toString() return v }); if (chartCatch.toufangfenxiChart === undefined) return; chartCatch.toufangfenxiChart.source(data); chartCatch.toufangfenxiChart.coord('polar', { transposed: true, radius: 0.75 }); chartCatch.toufangfenxiChart.legend(false); chartCatch.toufangfenxiChart.axis(false); chartCatch.toufangfenxiChart.tooltip(false); // 添加饼图文本 chartCatch.toufangfenxiChart.pieLabel({ sidePadding: 10, label1: function label1(data: any, color: string) { return { text: data.midIndustryName, fill: color }; }, label2: function label2(data: any) { return { text: formmaterValueZhou(data[key]) + unit, fill: '#808080', fontWeight: 'bold' }; } }); chartCatch.toufangfenxiChart.interval() .position('industryId*' + key) .color('midIndustryName').adjust('stack'); chartCatch.toufangfenxiChart.render(); return chartCatch.toufangfenxiChart; }, clearchart(){ if (chartCatch.toufangfenxiChart !== undefined) chartCatch.toufangfenxiChart.destroy(), chartCatch.toufangfenxiChart = undefined; } }; }