Skip to content
Snippets Groups Projects
Commit 5b5a41b3 authored by Stahl, Merle's avatar Stahl, Merle
Browse files

falsche Position der Knoten gefixt

parent 279326a4
No related branches found
No related tags found
2 merge requests!10Output,!9Main
......@@ -22,7 +22,7 @@ color = d3.scaleOrdinal()
.range([' #01d7c0', ' #8b90fe ', ' #a15eb2 ']),
yscale = d3.scaleOrdinal()
.domain(["citing", "input", "cited"])
.range([50, height/2+20, height-10]),
.range([50, height/2, height-50]),
toRemove;
/**
......@@ -45,14 +45,13 @@ var rect = svg.append("rect")
/**
* creates a new simulation
* arranges the nodes according to their group on the y-axis
* arranges the nodes according to their year on the x-axis
*/
var simulation = d3.forceSimulation()
.force("link", d3.forceLink().id(function(d) {return d.doi;}).distance(150).strength(1))
.force("collide", d3.forceCollide(30))
//.force("charge", d3.forceManyBody().strength(-50))
.force("link", d3.forceLink().id(function(d) {return d.doi;}).distance(100).strength(1))
.force("collide", d3.forceCollide(60))
.force("charge", d3.forceManyBody().strength(-50))
.force("center", d3.forceCenter(width/2, height/2+50))
.force("xscale", d3.forceX().strength(1).x(function(d) {return xscale(parseInt(d.year))}))
//.force("xscale", d3.forceX().strength(1).x(function(d) {return xscale(parseFloat(d.year))}))
.force("yscale", d3.forceY().strength(1).y(function(d) {return yscale(d.group)}));
/**
......@@ -65,7 +64,8 @@ var g = svg.append("g")
* creates XAxis element
*/
var xAxis = d3.axisBottom()
.tickFormat(function(d) {return d;});
.tickFormat(function(d) {return d;})
.ticks(10);;
/**
* draw xAxis
......@@ -117,12 +117,12 @@ function update(links, nodes) {
function updateXAxis(nodes) {
years = [];
for (i = 0; i < nodes.length; i++) {
years.push(parseInt(nodes[i]["year"]));
years.push(parseFloat(nodes[i]["year"]));
}
xscale = d3.scaleLinear()
.domain([d3.min(years), d3.max(years)])
.range([0, width])
.domain([d3.min(years)-10, d3.max(years)+10])
.range([50, width-50])
xAxis.scale(xscale);
gX.call(xAxis);
......@@ -155,6 +155,7 @@ function updateNodes(nodes) {
.enter()
.append("g")
.attr("class", "node")
.attr('dx', function(d) {return xscale(parseFloat(d.year))})
.attr("initial_x", function(d) {return d.dx;})
.attr("initial_y", function(d) {return d.dy;})
/*.call(d3.drag()
......@@ -275,11 +276,11 @@ function textfunc(node){
* updates the positions of the links and nodes
*/
function tickHandler() {
link.attr("x1", function (d) {return d.source.x;})
link.attr("x1", function (d) {return xscale(parseInt(d.source.year));})
.attr("y1", function (d) {return d.source.y;})
.attr("x2", function (d) {return d.target.x;})
.attr("x2", function (d) {return xscale(parseInt(d.target.year));})
.attr("y2", function (d) {return d.target.y;});
node.attr("transform", function (d) {return "translate(" + d.x + ", " + d.y + ")";});
node.attr("transform", function (d) {return "translate(" + xscale(parseInt(d.year)) + ", " + d.y + ")";});
}
/**
......@@ -317,7 +318,6 @@ function resetGraph() {
*/
function zoomHandler() {
d3.select('g').attr("transform", d3.event.transform);
//gX.call(xAxis.scale(d3.event.transform.rescaleX(xscale)));
var new_xScale = d3.event.transform.rescaleX(xscale)
gX.call(xAxis.scale(new_xScale));
}
......
......@@ -3,7 +3,7 @@
{
"name": "Comparing Molecular Patterns Using the Example of SMARTS: Applications and Filter Collection Analysis",
"author":"Emanuel S. R. Ehmki,Robert Schmidt, Farina Ohm, Matthias Rarey",
"year":"1997",
"year":"2001",
"doi": "https://doi.org/10.1021/acs.jcim.9b00249",
"group": "input",
"citations": 0
......@@ -27,7 +27,7 @@
{
"name": "Evolution of Novartis\u2019 Small Molecule Screening Deck Design ",
"author": "Ansgar Schuffenhauer, Nadine Schneider, Samuel Hintermann, Douglas Auld, Jutta Blank, Simona Cotesta, Caroline Engeloch, Nikolas Fechner, Christoph Gaul, Jerome Giovannoni, Johanna Jansen, John Joslin, Philipp Krastel, Eugen Lounkine, John Manchester, Lauren G. Monovich, Anna Paola Pelliccioli, Manuel Schwarze, Michael D. Shultz, Nikolaus Stiefl, Daniel K. Baeschlin. ",
"year":"2001",
"year":"1990",
"doi": "https://doi.org/10.1021/acs.jmedchem.0c01332",
"group": "input",
"citations": 250
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment