# Program that uses eiaClasses to make a Web page that tells a story about
# energy usage in the USA. 

from eiaClasses import Chart, DataSource, HTML_Page

def main():
        # get the data from the file
        eiaData = DataSource()

        # select data for Western region
        w = eiaData.report("West")
        # make a chart for it
        wChart = Chart()
        wChart.addData(w,"West")

        # and for northeast...
        ne = eiaData.report("Northeast")
        neChart = Chart()
        neChart.addData(ne,"Northeast")

        # start an output Web page
        htmlOut = HTML_Page()

        story = """
        People in different parts of the country use energy in
        different ways.  In the Northeast, heat takes up the lions
        share.  But in the West, much of which is hot and dry,
        heat takes much less energy and air conditioning does not
        take that much more. Other appliances, like the stove and the
        TVs, are more interesting targets for energy efficiency in the
        West. 
        """

        # add some stuff for the page
        htmlOut.title("Regional Differences")
        htmlOut.text(story)
        htmlOut.chart(wChart)
        htmlOut.chart(neChart)

        # and finally generate the Web page
        htmlOut.to_HTML()

main()
