Assignment 1

 

Description: From a multi-dimensional table with general data, visualize this data as a bar an pie charts in 2D and 3D.


First part. 2D pie chart.


  1. - In a statistical application it is necessary to represent a pie chart for a set of percentage values

  2. - The elements are in an array and their sum is equal to 100%

  3. - Example:

  4. float[] values = {25.0, 45.0, 5.0, 15.0, 10.0};

  5. - Implement a function to draw this information in a pie chart receiving this array as input

  6. - The function will also receive as input the center and radius of the chart

  7. - This function can know the number of values of the array by using the length attribute

  8. - Choose a random color for each sector





Second part. 2D bar chart.


  1. - Develop an analogous function of the previous assignment but now with the objective of drawing a 2D bar chart

  2. - Take the most of the available window sizes and draw the coordinates axes

  3. - Choose the bar width in function of the total number of values and the total window width; and the bar height in function of its particular value and the maximum value of all the elements, taking into account that the height of the bar of the element of maximum value is going to be the height of the window





Third part. 3D bar chart.


  1. - Lets start now from an n-dimensional array

  2. - Draw it in 3D using the primitive box. With it, and by tems of a proper model/view matrix, create a function able to draw each of the 3D bars

  3. - Draw the axes and an auxiliar grid