Open yleson opened 5 years ago
https://antv.alipay.com/zh-cn/f2/3.x/demo/interaction/pan-for-line-chart.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> <meta name="chart-name" content="折线图平移"> <title>F2 图表组件库 - AntV</title> <link rel="stylesheet" href="https://gw.alipayobjects.com/os/rmsportal/YmDAMEQVbLJpVbKiRQVX.css" /> </head> <body> <script>/*Fixing iframe window.innerHeight 0 issue in Safari*/document.body.clientHeight;</script> <script src="https://gw.alipayobjects.com/os/antv/assets/f2/3.3.8/f2-all.min.js"></script> <script src="https://gw.alipayobjects.com/os/antv/assets/lib/jquery-3.2.1.min.js"></script> <!-- 在 PC 上模拟 touch 事件 --> <script src="https://gw.alipayobjects.com/os/rmsportal/NjNldKHIVQRozfbAOJUW.js"></script> <div class="chart-wrapper"> <div style="height: 120px"></div> <canvas id="mountNode"></canvas> </div> <script> $.getJSON('https://gw.alipayobjects.com/os/antvdemo/assets/data/f2/linear-pan.json', function(data) { var chart = new F2.Chart({ id: 'mountNode', pixelRatio: window.devicePixelRatio }); chart.source(data, { release: { min: 1990, max: 2010 } }); chart.tooltip({ showCrosshairs: true, showItemMarker: false, background: { radius: 2, fill: '#1890FF', padding: [3, 5] }, nameStyle: { fill: '#fff' }, onShow: function onShow(ev) { var items = ev.items; items[0].name = items[0].title; } }); chart.interval().position('release*count'); chart.interaction('pan'); chart.scrollBar({ mode: 'x', xStyle: { offsetY: -5 } }); chart.coord({ transposed: true }); // 绘制 tag chart.guide().tag({ position: [1969, 1344], withPoint: false, content: '1,344', limitInPlot: true, offsetX: 5, direct: 'cr' }); chart.render(); }); </script> </body> </html>
触摸点是正确的,选中手指位置的数据
触摸点向下偏移,偏移量为canvas的y值
求官方出修复一下哇,被产品经理怼死了
@yleson 长摁可以显示 tooltip ,不过兄弟你这竖向滚动,产品能接受吗?
我想要上下滑动 实际是左右滑,上下动
@yleson 长摁可以显示 tooltip ,不过兄弟你这竖向滚动,产品能接受吗? 我想要上下滑动 实际是左右滑,上下动
我也是左右滑,上下滚动;官方说不支持y轴手势上下滑动,让开发用div嵌套设置overflow
Reproduction link
https://antv.alipay.com/zh-cn/f2/3.x/demo/interaction/pan-for-line-chart.html
Steps to reproduce
1.打开demo链接:https://antv.alipay.com/zh-cn/f2/3.x/demo/interaction/pan-for-line-chart.html
2.用下面代码替换模版全部代码:
What is expected?
触摸点是正确的,选中手指位置的数据
What is actually happening?
触摸点向下偏移,偏移量为canvas的y值