d3.js v4如何以编程方式设置画笔 [英] d3.js v4 how to set brush programmatically

查看:65
本文介绍了d3.js v4如何以编程方式设置画笔的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在d3.js v4中构建此平行坐标视图的版本. https://bl.ocks.org/syntagmatic/05a5b0897a48890133beb59c815bd953

I am building a version of this parallel coordinate view in d3.js v4. https://bl.ocks.org/syntagmatic/05a5b0897a48890133beb59c815bd953

在我的示例中,我有一个预定义的选择(以[min,max]数组的形式,在绘图加载后,我想以编程方式将其设置为一个或多个轴上的画笔.但是我无法似乎找到了一种方法.我发现从代码设置画笔的大多数示例都使用d3 v3,并使用设置范围,但在v4中似乎不再起作用.

In my example I have a predefined selection (in the form of a [min,max] array that I would like to set programatically as a brush in one or more of the axes, after the plot has loaded. But I cannot seem to find a way to do it. Most examples I found on setting a brush from code are using d3 v3 and use setting extent but that does not work anymore in v4 it seems.

有人可以给我一些提示和一个简单的示例,以便在这种情况下做到这一点(因此有多个轴和笔刷处于活动状态)吗?

can someone give me some tips and a simple example hot to do this in this case (so with multiple axes and brushes active) ?

谢谢

推荐答案

选择您的画笔组并调用 brush.move ,然后还传递一个包含开始和结束坐标的数组.然后您的画笔移动事件将处理其余的事情.

Select your brush group and call brush.move, then also pass an array with the start and end coordinates. Your brush move event will then take care of the rest.

d3.select(".brush").call(brush.move, [[startX, endX], [startY, endY]]);

这篇关于d3.js v4如何以编程方式设置画笔的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆