namespace pindaofenbu { let { formmaterValueZhou } = require("../../../../utils/util") const chartCatch: antvChart = { toufangfenxiChart: undefined } module.exports = { upLine1() { if (chartCatch.toufangfenxiChart === undefined) return chartCatch.toufangfenxiChart.clear() const data = this.data.DayList1; if (chartCatch.toufangfenxiChart === undefined) return; let key = this.data.select[this.data.select_act].proportionType; chartCatch.toufangfenxiChart.legend('gender', { position: 'right' }); chartCatch.toufangfenxiChart.source(data); chartCatch.toufangfenxiChart.scale(key, { tickCount: 3 }); chartCatch.toufangfenxiChart.axis('channelName', { label: (text: string, index: number, total: number) => { let names = ""; let li = text.split("") li.map((v:string,i:number)=>{ names += v; i != li.length - 1 && i !== 0 && i % 2 === 1 && ( names += '\n') }) return { text: names } } }); chartCatch.toufangfenxiChart.axis(key, { label: (text: string, index: number, total: number) => { return { text: formmaterValueZhou(text, 0) } } }); chartCatch.toufangfenxiChart.tooltip({ showCrosshairs: true, triggerOn: ['touchstart', 'touchmove'], onShow: (ev: tooltipOnShow) => { const items = ev.items; items[0].name = items[0].title; items[0].value = formmaterValueZhou(items[0].value, 2) + this.data.select[this.data.select_act].unit; } }); chartCatch.toufangfenxiChart.interval().position('channelName*' + key).shape('smooth').color(["#fd5555"]); chartCatch.toufangfenxiChart.render(); }, line1(F2: any, config: any) { if (chartCatch.toufangfenxiChart !== undefined) chartCatch.toufangfenxiChart.destroy(), chartCatch.toufangfenxiChart = undefined; let sys = wx.getSystemInfoSync(); config.height = sys.windowWidth / 16 * 9; chartCatch.toufangfenxiChart = new F2.Chart(config); const data = this.data.DayList1; if (chartCatch.toufangfenxiChart === undefined) return; let key = this.data.select[this.data.select_act].proportionType; chartCatch.toufangfenxiChart.legend('gender', { position: 'right' }); chartCatch.toufangfenxiChart.source(data); chartCatch.toufangfenxiChart.scale(key, { tickCount: 3 }); chartCatch.toufangfenxiChart.axis('channelName', { label: (text: string, index: number, total: number) => { let names = ""; let li = text.split("") li.map((v:string,i:number)=>{ names += v; i != li.length - 1 && i !== 0 && i % 2 === 1 && ( names += '\n') }) return { text: names } } }); chartCatch.toufangfenxiChart.axis(key, { label: (text: string, index: number, total: number) => { return { text: formmaterValueZhou(text, 0) } } }); chartCatch.toufangfenxiChart.tooltip({ showCrosshairs: true, triggerOn: ['touchstart', 'touchmove'], onShow: (ev: tooltipOnShow) => { const items = ev.items; items[0].name = items[0].title; items[0].value = formmaterValueZhou(items[0].value, 2) + this.data.select[this.data.select_act].unit; } }); chartCatch.toufangfenxiChart.interval().position('channelName*' + key).shape('smooth').color(["#fd5555"]); chartCatch.toufangfenxiChart.render(); return chartCatch.toufangfenxiChart; }, clearchart1(){ if (chartCatch.toufangfenxiChart !== undefined) chartCatch.toufangfenxiChart.destroy(), chartCatch.toufangfenxiChart = undefined; } }; }