123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- namespace jiemufenbu {
- 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) {
- obj.items[0].name = obj.items[0].title
- obj.items[0].value = Number(Number(obj.items[0].value).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('programType*value').color('type')
- .animate({
- appear: {
- animation: 'groupWaveIn'
- }
- });
- chartCatch.toufangfenxiChart.line().position('programType*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) {
- obj.items[0].name = obj.items[0].title
- obj.items[0].value = Number(Number(obj.items[0].value ).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('programType*value').color('type')
- .animate({
- appear: {
- animation: 'groupWaveIn'
- }
- });
- chartCatch.toufangfenxiChart.line().position('programType*value').color('type')
- .animate({
- appear: {
- animation: 'groupWaveIn'
- }
- });
- chartCatch.toufangfenxiChart.render();
- return chartCatch.toufangfenxiChart;
- },
- clearchart(){
- if (chartCatch.toufangfenxiChart !== undefined) chartCatch.toufangfenxiChart.destroy(), chartCatch.toufangfenxiChart = undefined;
- }
- };
- }
|