123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- namespace pindaofenbu {
- let { formmaterValueZhou } = require("../../../../utils/util")
- const chartCatch: antvChart = {
- toufangfenxiChart: undefined
- }
- module.exports = {
- upLine() {
- if (chartCatch.toufangfenxiChart === undefined) return
- chartCatch.toufangfenxiChart.clear()
- const data = this.data.DayList;
- 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(["#1b9ade", "#fd5555"]);
- 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.windowWidth / 16 * 9;
- chartCatch.toufangfenxiChart = new F2.Chart(config);
- const data = this.data.DayList;
- 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(["#1b9ade", "#fd5555"]);
- chartCatch.toufangfenxiChart.render();
- return chartCatch.toufangfenxiChart;
- },
- clearchart(){
- if (chartCatch.toufangfenxiChart !== undefined) chartCatch.toufangfenxiChart.destroy(), chartCatch.toufangfenxiChart = undefined;
- }
- };
- }
|