Skip to content

feat: v2版子弹图bullet初稿 #1427

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

Merged
merged 13 commits into from
Sep 7, 2020
Merged

feat: v2版子弹图bullet初稿 #1427

merged 13 commits into from
Sep 7, 2020

Conversation

arcsin1
Copy link
Contributor

@arcsin1 arcsin1 commented Aug 13, 2020

#1384 v2版子弹图bullet初稿

@auto-add-label auto-add-label bot added the enhancement New feature or request label Aug 13, 2020
@hustcc hustcc changed the base branch from v2 to master August 14, 2020 07:48
@visiky visiky linked an issue Aug 21, 2020 that may be closed by this pull request
@visiky
Copy link
Member

visiky commented Aug 21, 2020

嗨,子弹图在写单测的时候,可以判断下图例是否在展示区域内,相关 issue 见 #1442

const chart = plot.chart
const legendBBox = chart.getController('legend').getComponents()[0].component.getBBox();
const viewBBox = chart.viewBBox;

// 判断 legendBBox 是否在 viewBBox 内

@arcsin1
Copy link
Contributor Author

arcsin1 commented Aug 21, 2020

嗨,子弹图在写单测的时候,可以判断下图例是否在展示区域内,相关 issue 见 #1442

const chart = plot.chart
const legendBBox = chart.getController('legend').getComponents()[0].component.getBBox();
const viewBBox = chart.viewBBox;

// 判断 legendBBox 是否在 viewBBox 内

好的 我注意这个

@visiky
Copy link
Member

visiky commented Aug 21, 2020

嗨,子弹图在写单测的时候,可以判断下图例是否在展示区域内,相关 issue 见 #1442

const chart = plot.chart
const legendBBox = chart.getController('legend').getComponents()[0].component.getBBox();
const viewBBox = chart.viewBBox;

// 判断 legendBBox 是否在 viewBBox 内

好的 我注意这个

👍

我刚刚看了下 v1 版本的,好像这样子判断还不够,需要在判断下legendBBox minX、minY 是否小于 0(避免被其他误伤,导致被隐藏)

@arcsin1
Copy link
Contributor Author

arcsin1 commented Aug 21, 2020

嗨,子弹图在写单测的时候,可以判断下图例是否在展示区域内,相关 issue 见 #1442

const chart = plot.chart
const legendBBox = chart.getController('legend').getComponents()[0].component.getBBox();
const viewBBox = chart.viewBBox;

// 判断 legendBBox 是否在 viewBBox 内

好的 我注意这个

👍

我刚刚看了下 v1 版本的,好像这样子判断还不够,需要在判断下legendBBox minX、minY 是否小于 0(避免被其他误伤,导致被隐藏)

@arcsin1 arcsin1 closed this Aug 21, 2020
@arcsin1 arcsin1 reopened this Aug 21, 2020
@arcsin1
Copy link
Contributor Author

arcsin1 commented Aug 21, 2020

嗨,子弹图在写单测的时候,可以判断下图例是否在展示区域内,相关 issue 见 #1442

const chart = plot.chart
const legendBBox = chart.getController('legend').getComponents()[0].component.getBBox();
const viewBBox = chart.viewBBox;

// 判断 legendBBox 是否在 viewBBox 内

好的 我注意这个

👍
我刚刚看了下 v1 版本的,好像这样子判断还不够,需要在判断下legendBBox minX、minY 是否小于 0(避免被其他误伤,导致被隐藏)

刚按错了,嗯嗯 ,会判断的

@arcsin1
Copy link
Contributor Author

arcsin1 commented Aug 25, 2020

// TODO 准备最近几天画一个设计图写一些思考来参考,不过最近时间不太葱郁,可能会晚点出来!

});

// 做好排序兼容
const ranges = data[i].ranges.sort((a, b) => a - b);
Copy link
Member

@hustcc hustcc Aug 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sort 是会改变原数据吧~

@hustcc
Copy link
Member

hustcc commented Aug 29, 2020

周一在联系讨论:

  1. 具体多子弹图的实现方案,使用多 view 还是单 view
  2. 解决 多子弹图,统一度量、不统一度量给出解决办法
  3. 其他社区产品如何解决问题 2

@arcsin1
Copy link
Contributor Author

arcsin1 commented Aug 30, 2020

来个设计思路示意图: (view 是 【0,1】)
arcsin1

rangeField: 'ranges',
targetField: 'target',
xField: 'title',
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个单测逻辑写的不对,应该单独为 transformData 进行写单测。现在这个单测相当于是断言 bullet 的数据处理逻辑一定走 transformData 这个方法,而至于 transformData 内部是否有修改,修改是否正确,测试不出来~

target: {
min,
max,
sync: true,
Copy link
Member

@hustcc hustcc Sep 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: 这里是要吧 measure、range、target 都同步 sync。所以应该做法是都设置 sync: 'a-same-key' 即可。sync: true 的意思,是自动以字段名称为 key 去同步。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的 measure, range,target 是不是应该直接是 [measureField], [rangeField], [targetField] ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已经转换过了 不能直接用measureField这种 因为他是数组

style?: ShapeAttrs;
size?: number;
};
export type BulletData = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个类型定义应该不需要了吧~

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有用 transformData的时候需要

@hustcc hustcc self-requested a review September 7, 2020 02:45
@hustcc hustcc merged commit 1210ff4 into antvis:master Sep 7, 2020
@phoema
Copy link

phoema commented Sep 11, 2020

大神们,V2 的子弹图能选竖起来的样式吗,包括多子弹图

@arcsin1
Copy link
Contributor Author

arcsin1 commented Sep 11, 2020

大神们,V2 的子弹图能选竖起来的样式吗,包括多子弹图

会支持的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request PR: merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants