1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- namespace hangyejiegou {
- const chartCatch: antvChart = {
- toufangfenxiChart: undefined
- }
- module.exports = {
- upLine1() {
- if (chartCatch.toufangfenxiChart === undefined) return
- chartCatch.toufangfenxiChart.clear()
- let key = this.data.select[this.data.select_act].proportionType;
- let total = 0;
- this.data.DayList1.map((v: any) => {
- total += Number(v[key] || 0) * 1000
- })
- total /= 1000;
- const data = this.data.DayList1.map((v: any) => {
- v.p = Number((Number(v[key] / (total || 1)) * 100).toFixed(2));
- return v
- });
- if (chartCatch.toufangfenxiChart === undefined) return;
- chartCatch.toufangfenxiChart.source(data);
- chartCatch.toufangfenxiChart.legend({
- position: 'bottom',
- itemFormatter: function itemFormatter(val: string) {
- let p :any= {};
- for (let i = 0; i < data.length; i++) {
- const v = data[i];
- if (v.name === val) {
- p = v
- break
- }
- }
- return val + ' ' + p.p + "% ";
- }
- });
- chartCatch.toufangfenxiChart.tooltip(false);
- chartCatch.toufangfenxiChart.coord('polar', {
- transposed: true,
- radius: 1
- });
- chartCatch.toufangfenxiChart.axis(false);
- chartCatch.toufangfenxiChart.interval()
- .position('type*p')
- .color('name', ['#1890FF', '#13C2C2', '#2FC25B', '#FACC14', '#F04864', '#8543E0']).adjust('stack');
- 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.windowHeight *0.7;
- chartCatch.toufangfenxiChart = new F2.Chart(config);
- let key = this.data.select[this.data.select_act].proportionType;
- let total = 0;
- this.data.DayList1.map((v: any) => {
- total += Number(v[key] || 0) * 1000
- })
- total /= 1000;
- const data = this.data.DayList1.map((v: any) => {
- v.p = Number((Number(v[key] / (total || 1)) * 100).toFixed(2));
- return v
- });
- if (chartCatch.toufangfenxiChart === undefined) return;
- chartCatch.toufangfenxiChart.source(data);
- chartCatch.toufangfenxiChart.legend({
- position: 'bottom',
- itemFormatter: function itemFormatter(val: string) {
- let p :any= {};
- for (let i = 0; i < data.length; i++) {
- const v = data[i];
- if (v.name === val) {
- p = v
- break
- }
- }
- return val + ' ' + p.p + "% ";
- }
- });
- chartCatch.toufangfenxiChart.tooltip(false);
- chartCatch.toufangfenxiChart.coord('polar', {
- transposed: true,
- radius: 1
- });
- chartCatch.toufangfenxiChart.axis(false);
- chartCatch.toufangfenxiChart.interval()
- .position('type*' + key)
- .color('name', ['#1890FF', '#13C2C2', '#2FC25B', '#FACC14', '#F04864', '#8543E0']).adjust('stack');
- chartCatch.toufangfenxiChart.render();
- return chartCatch.toufangfenxiChart;
- }
- };
- }
|