Comments (7)
Hello @nicgirault, sorry for the late reply. The issue is that having the structure svg > div > svg
or div > div > svg
is not valid for adding zooming to the main container. So, I was able to add zooming by removing the div
container, and changing the main container to svg
. Solving it is as easy as going to these lines and changing them to:
const container = select(this.conf.container)
This small change will allow users to have SVG containers in their applications, by giving an id
to an svg
element instead of a div
. Then, you should get the expected zooming by adding the following to the SVG:
svg.call(d3.zoom().on("zoom", function() {
svg.attr("transform", d3.event.transform)
}));
There is more information about having an SVG container in the other discussion here.
from circosjs.
@matthewchan15 Sorry, I did not understand you before. You should be specifying the zoom call in your application, after creating the svg
parent container (the same container that you use to create the Circos instance). Make sure you attach the zoom call to that parent container. Then, that svg
is going to include an inner svg
(coming from circos.js). The zoom should be working because the structure will be svg > svg
, instead of svg > div > svg
.
from circosjs.
@jnunez17 The issue was that I wrongly assumed that d3-zoom
was included in the package,json
. Once I installed it, everything worked wonderfully 👍
from circosjs.
Hi @jnunez17 sorry for the late answer. I don't know at all how zoom is working so I won't be able to help you without digging into the subject. I let the issue open so that I will work on it next time I maintain this project. If you found a solution, I would be really glad if you can share it so that I could add it to the documentation of this project.
from circosjs.
@jnunez17 Do you mind posting a code snippet on how you implemented this? I've been trying to make it work with react
but I keep getting this error:
Uncaught TypeError: Cannot read property 'button' of null
Thank you!
from circosjs.
@matthewchan15 That does not seem to be an issue with the zoom itself, but with something you are missing for getting it to work, possibly how you are importing the d3 modules. One thing you can try is importing the whole d3 library at the top of your script (import * as d3 from 'd3';
), and if that fixes your issue then perhaps you are missing a specific d3 module (in case you were importing them separately).
For the zoom, it should work just by removing the extra div container
from the library and then calling the zoom event transform on the outer svg
. I'm explaining the issue and the steps with more detail in my previous comment.
from circosjs.
@jnunez17 Ah yes I tried import * as d3 from 'd3';
, as well as this method import {select} from 'd3-selection'
(example). I am using the d3 package provided in this library with package.json
-> https://github.com/nicgirault/circosJS/blob/master/package.json.
I think there may be a misunderstanding on my part. Did you specify this block of code in circos.js
(this is what I'm trying to do) or when you were creating your instance such as in the first comment you posted?
svg.call(d3.zoom().on("zoom", function() {
svg.attr("transform", d3.event.transform)
}));
from circosjs.
Related Issues (20)
- How to deal with json string?
- Using CircosJS with Observable HOT 1
- events not working? HOT 1
- what input data are required to create a circos plot using miRNA and associated gene ?
- tooltipContent on chords chart HOT 1
- chords connecting two tracks HOT 1
- D3.queue is not a function HOT 1
- Source for Heat map calendar example HOT 1
- Community Feedback: CircosJS wrapper for Dash by Plotly - with zoom/pan & download feature
- Heatmap examples fails to load Firefox 64.0 HOT 1
- It seem是 HOT 2
- Add images just next to the text or label
- Problem with Histogram HOT 1
- Problem with Stack
- Choords not visible ! HOT 1
- Chords: conf.tooltipContent is not a function HOT 1
- version 2.2.0 not available on npm
- whether the width of source-target line can be changed in Chords?
- How to initiate Chords plot in javascript?
- Anyway to use this library on Mobile with React Native?
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 circosjs.