Code Monkey home page Code Monkey logo

Comments (3)

benfred avatar benfred commented on August 17, 2024

Yeah - this is working like its supposed to (just not like you want it to =(.

I'm assuming that the output you want is something like this:

screen shot 2014-02-20 at 2 45 11 pm

The problem with that diagram is that sets (0, 1, 3, 4) shouldn't be overlapping at all according to the overlap areas you are passing in - making it have a higher loss function than what its producing.

Look at PR #10 for a proposed method to overcome this. If it works for you - I'll merge it to master .

from venn.js.

scottmartinnet avatar scottmartinnet commented on August 17, 2024

Heh, that makes total sense. I suspected something like that but didn't know how to express it.

This code works great, except for the fact that the diagram produced is taller than it is wide. In the 625x375 window, it would fit better rotated 90 degrees, and other arrangements lay themselves out that way. I don't know if that's related to this at all; I can create a new issue if you want. Regardless, this is a great improvement for our case.

Here's an example of the code for a diagram that gets laid out horizontally, the way that it intuitively seems the above should be laid out:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script><script src="d3.js"></script><script src="venn.js"></script><script type="text/javascript">$(document).ready(function() {    var sets = [{"id":60,"label":"0","size":1960,"radius":53.134792881788606,"y":301.26520711821144,"x":192.04953051060735},{"id":61,"label":"1","size":1858,"radius":51.73373226864182,"y":177.86981869734862,"x":71.73373226864182},{"id":62,"label":"2","size":298,"radius":20.718537149280536,"y":82.18273038458457,"x":192.04953051060735},{"id":63,"label":"3","size":17302,"radius":157.86981869734862,"y":177.86981869734862,"x":404.7991767045968},{"id":64,"label":"4","size":4301,"radius":78.71104488063317,"y":177.86981869734862,"x":192.04953051060735}];    var overlaps = [{"id":60,"sets":[4,0],"size":57},{"id":61,"sets":[4,1],"size":74},{"id":62,"sets":[4,2],"size":12},{"id":63,"sets":[4,3],"size":343},{"sets":[0,0],"size":0,"weight":1e-10},{"sets":[0,1],"size":0,"weight":1e-10},{"sets":[0,2],"size":0,"weight":1e-10},{"sets":[0,3],"size":0,"weight":1e-10},{"sets":[1,0],"size":0,"weight":1e-10},{"sets":[1,1],"size":0,"weight":1e-10},{"sets":[1,2],"size":0,"weight":1e-10},{"sets":[1,3],"size":0,"weight":1e-10},{"sets":[2,0],"size":0,"weight":1e-10},{"sets":[2,1],"size":0,"weight":1e-10},{"sets":[2,2],"size":0,"weight":1e-10},{"sets":[2,3],"size":0,"weight":1e-10},{"sets":[3,0],"size":0,"weight":1e-10},{"sets":[3,1],"size":0,"weight":1e-10},{"sets":[3,2],"size":0,"weight":1e-10},{"sets":[3,3],"size":0,"weight":1e-10}];    var combined = venn.venn(sets, overlaps);    var diagram = venn.drawD3Diagram(d3.select('#overlap-chart'), combined, $('#overlap-chart').width(), 375);});</script><div id="overlap-chart" style="width: 624px; height: 374px;"></div> 

Thanks so much for helping out with this. The implementation of this diagram in our platform has already really impressed people at my company.

from venn.js.

benfred avatar benfred commented on August 17, 2024

fixed by #10

from venn.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.