Closed jolars closed 8 years ago
I might add some more documentation on the internal calls when I get a chance, but in the meantime:
The 'venn.venn' function computes the coordinates and radii for the circles:
var sets = [ {sets: ['A'], size: 12}, {sets: ['B'], size: 12}, {sets: ['A','B'], size: 2}];
circles = venn.venn(sets)
// returns:
// {"A":{"x":0,"y":0,"size":12,"radius":1.9544100476116797},
// "B":{"x":2.829980553910518,"y":0,"size":12,"radius":1.9544100476116797}}
You probably will want to scale and translate these to fit in a bounding box (coordinates returned by that call are done so that the circle has the same area as the input):
var scaled = venn.scaleSolution(circles, width, height, padding);
Also computing the best position for the labels is a nice to have. The centre of each circle isn't necessarily the best place for the label (see https://github.com/benfred/venn.js/issues/18):
var textCentres = computeTextCentres(scaled, sets);
Excellent, thank you!
I'm using TikZ+LaTeX to plot figures and it would be terrific if there was a way to return the coordinates and radii of the circles produced by the script, or just an entry in the readme explaining how to return those aspects from the current script.