# File: histogram.py
# Purpose: Generates a histogram of continuous data
# Author:
# Date:

# Required Libraries
from graphics import *

# ============================================================
# HELPFUL FUNCTIONS
# ============================================================

# Function: zeros
# Purpose: generates a list of zeros
# Inputs: size of the list
# Outputs: list of zeros
def zeros(size):
    list = []
    for x in range(size):
        list.append(0)

    return list

# Function: total
# Purpose: calculates a total of the values in a list
# Inputs: a list of data
# Outputs: the total
def total(data):
    t = 0
    for x in data:
        t = t + x

    return t

# ============================================================
# CREATE THE WINDOW
# ============================================================

# Function: createWindow
# Purpose: Create Window and set its coordinate system
# Inputs: length of x axis, offset of the axes from edge of window
# Outputs: the window
def createWindow(xLength, offset):
    
# ============================================================
# DRAW AXES AND LABELS
# ============================================================
    
# Function: drawAxes
# Purpose: Draw and Label Axes (including Ticks)
# Inputs: window, length of x-axis, offset
# Outputs: None
def drawAxes(window, xLength, offset):
   
# Function: labelAxes
# Purpose: Label the Axes
# Inputs:
# Outputs:

# Function: drawTicks
# Purpose: draw and label tick marks
# Inputs:
# Outputs:

# Function: xTicks
# Purpose: Determine position of xTicks
# Inputs:
# Outputs:

# Function: tickLabels
# Purpose: convert numeric tick position to string tick labels
# Inputs:
# Outputs:

# Function: drawTitle
# Purpose: draws the title of the chart
# Inputs:
# Outputs:

# ============================================================
# DRAW THE BAR CHART
# ============================================================
# Function:drawBar
# Purpose: Draw a single bar
# Inputs: window, height and width of bar
# Outputs: None
def drawBar(window, height, width):

# Function: drawHistogram
# Purpose: Draw all bars
# Inputs:
# Outputs:


# ============================================================
# CALCULATE RELATIVE DATA TO BE PLOTTED
# ============================================================

# Function: calcBinSize
# Purpose: Calculate Bin Size
# Inputs: data and the number of bins
# Outputs: the size of a bin
def calcBinSize(data, numBins):
   

# Function: calcFreq
# Purpose: Convert Raw data to Frequency Data
# Inputs: list of raw data (observations), the bin size, and the number of bins
def calcFreq(data, binSize, numBins):
   

# Function: calcRelFreq
# Purpose: Convert Frequency Data to Relative Frequency Data
# Inputs: Frequency Data
# Outputs: Relative Frequency Data
def calcRelFreq(freq):
    

# ============================================================
# IMPORT/EXPORT DATA
# ============================================================

# Function: importData
# Purpose: Import raw data from a file
# Inputs:
# Outputs:


# Function: exportFrequencies
# Purpose: Save Frequency Table to a File
# Inputs:
# Outputs:

# ============================================================
# IMAIN PROGRAM
# ============================================================
def main():
    # IMPORTANT VALUES
    # data set
    data = [64, 73, 12, 84, 4, 98, 87, 6, 13, 29, 96, 10, 18, 16, 75, 43, 74, 41, 87, 90, 54, 33, 9, 38, 54, 11, 11, 13, 19, 14, 11, 36, 2, 9, 91, 86, 2, 61, 32, 53, 37, 92, 45, 30, 25, 75, 40, 74, 49, 39, 32, 36, 74, 29, 76, 24, 20, 80, 1, 16, 93, 63, 19, 72, 13, 88, 79, 75, 49, 47, 95, 5, 45, 12, 8, 33, 55, 25, 6, 55, 16, 25, 77, 64, 17, 80, 76, 42, 46, 2, 61, 73, 44, 11, 42, 63, 74, 9, 31, 31]

    # distance axes are offset from edge of window
    axesOffset = 20

    # prompt user for number of bins
    numBins = input('Please enter number of bins: ') 

    binSize = calcBinSize(data, numBins) # calculate bin size

    xLength = numBins * binSize # the length of the x-axis

    # Create the Window
    
    # Draw the Axes
    
    # Calculate Frequency Data

    # Print Frequency Data to Screen


# invoke main
main()
