简体   繁体   English

如何通过d3js用铅笔刷

[英]How to brush with pencil via d3js

I would like to be able to select data in the scatterplot with pencil via d3js library.我希望能够通过 d3js 库用铅笔在散点图中 select 数据。

I have found following sample - https://jsfiddle.net/3mjduntb/ - but there is possible to brush only with rectangle.我找到了以下示例 - https://jsfiddle.net/3mjduntb/ - 但只能用矩形刷。

Source: https://d3-graph-gallery.com/graph/interactivity_brush.html资料来源: https://d3-graph-gallery.com/graph/interactivity_brush.html

I can see the API for brushing:可以看到刷机用的API:

 // Add brushing
  svg
    .call( d3.brush()                 // Add the brush feature using the d3.brush function
      .extent( [ [0,0], [width,height] ] ) // initialise the brush area: start at 0,0 and finishes at width,height: it means I select the whole graph area
      .on("start brush", updateChart) // Each time the brush selection changes, trigger the 'updateChart' function
    )

I cannot find any way how to modify this selection method?我找不到任何方法如何修改此选择方法?

I have found this plugin which is exactly what I needed:我发现这个插件正是我需要的:

https://bl.ocks.org/skokenes/a85800be6d89c76c1ca98493ae777572 https://bl.ocks.org/skokenes/a85800be6d89c76c1ca98493ae777572

It is lasso plugin in d3.js plugins.它是 d3.js 插件中的套索插件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM