question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Zooming in CircosJS

See original GitHub issue

Hello @nicgirault,

Is there a way to implement normal D3 zooming abilities within Circos layouts?

I’m using the Chords track similar to this example: https://github.com/nicgirault/circosJS/blob/master/doc/chords.png. I want to implement normal pan and zoom by scrolling with the mouse (https://bl.ocks.org/sgruhier/50990c01fe5b6993e82b8994951e23d0), and this is what I’m trying to do:

var width = 1000;
var height = 850;

var svg = d3.select("body")
  .append("div")
  .attr('id', 'chart')
  .attr("width", width)
  .attr("height", height);

svg.select(".all")
  .call(d3.zoom().on("zoom", function() {
    svg.select(".all").attr("transform", d3.event.transform)
  }))
  .append("g");

var myCircos = new Circos({
  container: '#chart',
  width: width,
  height: height
});

// ...
// Adding the configuration data for the layout and chords, and rendering

The zooming is not working as expected. As you can see, I have to do svg.select(".all") to actually select the svg element within the div tag.

Thank you!

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
mtwichancommented, Dec 20, 2018

@jnunez17 The issue was that I wrongly assumed that d3-zoom was included in the package,json. Once I installed it, everything worked wonderfully 👍

1reaction
jorgenunezsiricommented, Dec 2, 2018

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Axis Scaling - Creating Zoomed Regions // CIRCOS Circular ...
In the first two examples in this tutorial section you saw how to adjust local scale by splitting a chromosome into multiple ideograms...
Read more >
interacCircos: The Generation of Interactive Circos Plot
Circos.js ' and 'NG-Circos' and we integrate the modules of 'circosJS', 'BioCircos.js' and ... zoom. Whether or not the plot is zoomable? TEXTModuleDragEvent....
Read more >
interacCircos document - Zhe Cui's website
If you are a NG-Circos/BioCircos.js/circosJS user and familiar with the modules ... library(interacCircos) Circos(zoom = FALSE,genome=list("Example1"=100 ...
Read more >
NG-Circos.js - UCI
... class="pun">,</span><span class="pln"> zoom </span><span class="pun">:</span><span class="pln"> </span><span class="kwd">false</span><span class="pun"> ...
Read more >
Visualize Data In A Circular Layout - Circos.js | CSS Script
Circos.js is a JavaScript graph library to visualizes data in a circular layout that is great for exploring relationships between objects or ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found