主权项 |
1. A method for creating an output graphic using a processing device, the method comprising:
receiving one or more elements of a hierarchical data structure, wherein each of the one or more elements includes a value; calculating, via the processing device, a total value for the hierarchical data structure by adding the value from the one or more elements; creating, via the processing device, relationships that associate the one more elements with the total value; generating, via the processing device, a diagram to illustrate the total value and the relationships among the one or more elements and the total value; and the processing device transmitting the diagram for presentation on a display, wherein generating the diagram further includes:
drawing a shape for each of the one or more elements of the hierarchical data structure, wherein the shape comprises a circle;determining an area of a parent circle based on the total value of the hierarchical data structure;calculating a radius of the parent circle;drawing the parent circle based on the radius;inserting a parent circle label in the parent circle;determining children of the parent circle based on the one or more elements of the hierarchical data structure;calculating for each child of the parent circle a percentage the child is of the parent circle;calculating for each child an area of the child circle based on the hierarchical data structure and a radius for the child circle;calculating an angle increment for spacing the children circles around the parent circle;selecting a largest circle of the children circles and drawing the largest circle directly below the parent circle; anddrawing remaining children circles largest to smallest around the parent and using the angle increment for spacing among the remaining circles. |