Photoshop web design - 953Chapter 48Data Visualization with Venn Diagrams// — create

953Chapter 48Data Visualization with Venn Diagrams// — create the image and allocate colors$image = imagecreate($IMAGE_WIDTH, $IMAGE_HEIGHT) or die( Could not create image ); $background_color = ImageColorAllocate($image, 255,255,255); $left_color = ImageColorAllocate($image, 100, 100, 200); $right_color = ImageColorAllocate($image, 200, 100, 100); $intersection_color = ImageColorAllocate($image, 225, 225, 225); $black_color = ImageColorAllocate($image, 0,0,0); // — decide how big the circles should be$max_radius = min((($IMAGE_HEIGHT * 0.9) / 3), (($IMAGE_WIDTH * 0.9) / 4)); $center_y = $IMAGE_HEIGHT / 3.0; $default_center_x_left = $IMAGE_WIDTH / 4.0; $default_center_x_right = (3 * $IMAGE_WIDTH) / 4.0; $middle_x = $IMAGE_WIDTH / 2.0; $radius_left_side_raw = area_to_radius($left_amount); $radius_right_side_raw = area_to_radius($right_amount); $intersection_radius_raw = area_to_radius($intersection_amount); $scale_factor = $max_radius / (max($radius_left_side_raw, $radius_right_side_raw)); $radius_left_side = $radius_left_side_raw * $scale_factor; $radius_right_side = $radius_right_side_raw * $scale_factor; // (it s convenient to pretend that the intersection area// has a radius (although it s not circular) just so we can// calculate things the same way as the circles) $intersection_radius = $intersection_radius_raw * $scale_factor; $area_left_side = M_PI * $radius_left_side * $radius_left_side; $area_right_side = M_PI * $radius_right_side * $radius_right_side; $intersection_area = M_PI * $intersection_radius * $intersection_radius; // We now have all necessary info except where to locate the// centers of the circles. // Four cases: // 1) no intersection, 2) partial intersection// 3) left is strict subset of right, // 4) right is subset of left. if ($intersection_amount == 0) { // No intersectionContinued54
If you are searching for cheap webhost for your web application, please visit MySQL5 Web Hosting services.

Leave a Reply