微信小程序使用antv f2 设置toolitp不起作用

支付宝转微信开发 ,都是用antv 发现设置好tooplitp不起作用,刚开始以为是触摸事件没有监听到,去源码打印发现没有问题,
重新整理使用发现是没有把chart return出来

  onInitChart4(F2, config) {
    
    
          chart4 = new F2.Chart(config);
          const data = [
            {
    
     codeType: "测试", reportDate: "2011-10-01", value: null },
          ];
          chart4.source(data, {
    
    
            reportDate: {
    
    
              tickCount: 8,
              range: [0, 1],
              formatter: val => {
    
    
                console.log(val)
                  return val.split("-")[2];
              }
            },
            value: {
    
    
              tickCount: 8,
                tickLine: 1,
                isRounding: true,
                max: 12,
                min: 0
            }
          });
          chart4.line().position('reportDate*value').color('codeType'); // 重新定义图形语法
          chart4.point().position('reportDate*value').style({
    
    
            stroke: '#fff',
            lineWidth: 1
          });
          chart4.tooltip({
    
     //提示信息自定义
            showCrosshairs: true,
            showItemMarker: false,
            onShow: function onShow(ev) {
    
    
                console.log(ev)
                var items = ev.items.splice(1, 1);
                console.log(items)
                items[0].name = items[0].name;
                items[0].value = items[0].value;
            }
        });
          chart4.render();
          // 注意:需要把chart return 出来
          return chart4;
        },

目前想知道怎么能够吧onInitChart4放data外边使用,那位大佬看见求指点

猜你喜欢

转载自blog.csdn.net/men_gqi/article/details/111469047