Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

小程序折线图,X 轴数据为分类类型,平移时线路图错乱 #81

Closed
movingStars opened this issue Aug 29, 2018 · 14 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@movingStars
Copy link

  • F2 Version:

  • Platform:
    IOS和Android都有这个问题

  • Mini Showcase(like screenshots):
    image

  • CodePen Link:

@movingStars
Copy link
Author

我已经加了sortable: false,但还是有问题。不加前是这样的:
image

@simaQ
Copy link
Contributor

simaQ commented Aug 29, 2018

你好,能提供可复现的代码么?

@movingStars
Copy link
Author

movingStars commented Aug 29, 2018

我也试了下你写的这个demo,https://codepen.io/Sima/pen/vayQgo。
发现放到小程序里面运行就会有这个问题。

@simaQ
Copy link
Contributor

simaQ commented Aug 29, 2018

哟! 我复现了,稍等,我修复下,哦了之后回复你哈

@simaQ simaQ self-assigned this Aug 29, 2018
@simaQ simaQ added the bug Something isn't working label Aug 29, 2018
@movingStars
Copy link
Author

好的,非常感谢

@caicaibrid
Copy link

在线等...

@simaQ
Copy link
Contributor

simaQ commented Aug 29, 2018

很快,已经修了,但是需要验证下

@simaQ
Copy link
Contributor

simaQ commented Aug 29, 2018

哦了,@antv/f2@3.2.2-beta.1 版本。

f2-canvas/lib/f2.js 更新下,我已经上传了https://github.com/antvis/wx-f2/tree/master/f2-canvas/lib,或者直接 download https://unpkg.com/@antv/f2@3.2.2-beta.1/dist/f2-all.min.js 这个脚本,注意名字

@movingStars
Copy link
Author

太棒了,我同事都说你们是神速,哈哈

@movingStars
Copy link
Author

线路是显示正常了,但还有两个小问题,看能不能解决一下。
image
Y轴旁边会有一串数字,还有在滑动的时候线路不太连续,比如这里的8/31和9/01

@movingStars
Copy link
Author

在刚才那个demo里面加下面这段代码:
data.map(function(obj) {
chart.guide().text({
position: [obj.name, obj.value],
content: obj.value,
style: {
fill: '#616161',
textBaseline: 'bottom',
textAlign: 'center'
},
offsetY: -5
});
});

Y轴就会有一串数字显示出来,如下:
image

应该就是加了辅助文字的原因

@simaQ
Copy link
Contributor

simaQ commented Aug 29, 2018

恩,我想这个原因和最初的连线一样,因为组成这些图形的点中 x 值是 NaN (因为不在当前数据范围内),在 H5 环境下是 OK 的,看来是微信小程序的 canvas 和 H5 canvas 处理不一样,修复了我及时回复你

@simaQ
Copy link
Contributor

simaQ commented Aug 30, 2018

  1. Y 轴文本的问题,升级至 3.2.2-beta.2
  2. 不连续的问题,是因为横轴对应的是分类数据,你只要在列定义中设置下 range: [ 0, 1 ] 即可,参见我的例子:https://codepen.io/Sima/pen/vayQgo

image

@movingStars
Copy link
Author

好的,辛苦了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants