951Chapter 48Data Visualization with Venn Diagrams .The centers (Business web site)

951Chapter 48Data Visualization with Venn Diagrams .The centers of the circles are always on the same horizontal line. This means that theiry-coordinate is decided in advance, and we change the area of intersection just bychanging the x-coordinates. .The circles always fit within the top two-thirds of the diagram (reserving the lower thirdfor labels). So put the y-coordinate of the centers one-third of the way down the imagefrom the top. And because the circles may not intersect at all, they shouldn t be largerthan half of the width of the image, so we have room to display two of them. We alsomake sure that the circles are no greater than 90 percent of the room available giveneverything we ve said so far, so that they don t touch the image borders. Finally, wedecide that, regardless of the actual numbers as input, the larger of the two circles is aslarge as it can be. (Scale is consistent within the diagram, but not between diagrams.) Determining size and scaleNow we have nearly all the information needed to create a visualization, and the pieces weare lacking, of course, depend on the input values we are going to receive. We use the sizes ofthe actual sets to determine the radii of the circles for display. We want the larger of the twoset counts to correspond to the largest circle we can afford to display, and then scale every- thing else appropriately. (We do all this in the code in Listing 48-2 (venn.php) you maywant to look ahead to that code as we lay out what we need to do in it.) It s actually easiest for us to calculate the largest radius we can afford: Given the constraintswe ve already listed, the larger radius should be 90 percent of 1/4of the image width, or 90 per- cent of 1/3of the image height, whichever is smaller. So we calculate this maximum radius, assume that the larger set size is proportional to the area of a circle with this radius, andcome up with a general conversion for mapping from input numbers to area as measured inpixels. We use this to decide on the areas of the circles and of the intersection area we want. What numbers should we know at this point? We know: .The radius of the bigger circle. (It s the largest radius that fits our constraints.) .The area of the bigger circle (calculated as pi r2). .The radius of the smaller circle (from the ratio of the input set sizes treated as arearatios and then mapped back to a radius). .The area of the smaller circle (calculated). .The area of intersection (scaled the same way as other areas, from the input numbers). .The y-coordinate of the circle centers. (We decreed that it be the line that s one-third ofthe way down the image.) What are we missing before we can display our circles? The only thing that we re missing isthe x-coordinates of the centers. The easy casesWhere we decide to put the circle centers depends on the extent to which our sets overlap. There are some cases that we can dispense with, that don t need all this trigonometry we vebeen spending our time on. Those are: .No items are in the intersection.In this case, we don t want the circles to touch at all. Wesimply locate the centers at default locations in the middles of the two halves of thediagram. Because of the way that we limited the maximum radius, the circles are com- pletely separated.
From our experience, we can recommend PHP5 Web Hosting services, if you need affordable webhost to host and run your web application.

Leave a Reply