Comments (6)
How about selecting elements after creating the chart, and adding the handlers there. Does that not work for you?
from d3-parsets.
What should be the argument to the select? i.e. what nodes/classes should we select on and then bind?
I guess my higher level thought is that since parsets wraps the entire rendering, then it should provide these methods, in order to not break them in the future (e.g. if you changed the internal implementation). However, if you have something else in mind, that might be better.
from d3-parsets.
I guess the classes and elements generated by the chart are also part of the API, so “post-selection” is a reasonable way to customise the output further. A similar approach is taken by D3’s components, such as d3.svg.brush and d3.svg.axis; you can customise elements or add event handlers after generating the initial elements.
For d3-parsets, which elements you should select depends on your usage scenario; there should be suitable classes on most elements that you can find by inspecting your chart in a browser, or examining the code. If you think they could be improved, do let me know!
from d3-parsets.
Sounds good to me - I'll reopen this if you ever change the inner DOM structure :)
Thanks, awesome work.
from d3-parsets.
By the way, I just noticed that not all of my event listeners were namespaced, so I’ve just pushed a fix.
from d3-parsets.
By the way, for those curious about how to do this, here is our code that gets the event and then generates a new one with a different structure (graph
is our root svg):
graph.selectAll("g.ribbon-mouse path")
.on("click", function(e) {
that.trigger('click', {
source: e.source.node.name,
sourceDimension: e.source.node.dimension.name,
target: e.target.node.name,
targetDimension: e.target.node.dimension.name,
dimension: e.dimension,
value: e.count
});
});
from d3-parsets.
Related Issues (12)
- mouseover mismatch after sorting
- Custom sorting for categories
- Change dimensions dynamically HOT 2
- Does not work with d3.v4 HOT 6
- parallel nodes with different size
- Save this repo! HOT 3
- Merge ribbons
- Is there a way to make a horizontal parallel sets graph? HOT 1
- The width and Height of the chart doesnt change. It is always set to default values.
- totals are not getting updated HOT 3
- Error: Invalid value for <rect> attribute width="9.399999999999999e-132" HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from d3-parsets.