ZipViz is a Java application that visualizes demographic data based on a given ZIP code. The application fetches income distribution data from an API and displays it in various chart formats including bar charts, line charts, pie charts, and Lorenz curves.
- Fetch demographic data based on a given ZIP code.
- Visualize income distribution data in various chart formats.
- Export the current chart as an image (.png) or as a CSV file.
- Enter a ZIP code in the text field.
- Select a chart type from the combo box.
- Click the "Submit" button to fetch the data and display the chart.
- Click the "Export" button to export the current chart as an image or as a CSV file.
The application is structured into several classes and interfaces:
ZipVizApp
: The main entry point for the application.ApplicationWindow
: Represents the main application window.DataInputPanel
: Represents a panel for entering data input.DemographicChartPanel
: Represents a JPanel that displays a chart representing demographic data.ChartFactory
: An interface for creating charts.BarChartFactory
,LineChartFactory
,PieChartFactory
,LorenzChartFactory
,InitialChartFactory
: Implementations of theChartFactory
interface for creating different types of charts.ChartFactoryProvider
: Provides aChartFactory
object based on the specified chart type.DataFetcher
: Fetches demographic data from an API based on a given ZIP code.DemographicData
: Represents demographic data, specifically the income distribution data, for a given ZIP code.DataInputObserver
: An interface for observing user's data input.
- Java: JDK 11
- JFreeChart: 1.5.4
- Gson: 2.10.1
- Gradle: 7.3.1
- Swing: Included in JDK 11
Run ZipVizApp.java to start the application.
This application uses the U.S. Census Bureau's API to fetch demographic data. The API key is now stored as an environment variable. To set the API key use:
CENSUS_API_KEY=your_api_key;