Skip to content
Yadong Zhang edited this page Oct 4, 2018 · 2 revisions
<title>Tree Example</title>

<style>

.node { cursor: pointer; }

.node circle { fill: #fff; stroke: steelblue; stroke-width: 3px; }

.node text { font: 12px sans-serif; }

.link { fill: none; stroke: #ccc; stroke-width: 2px; }

</style>
<script src="http://d3js.org/d3.v3.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script> var treeData = [{"name": "Fred", "parent": "null", "children": [{"name": "Money, Banking, & Finance", "parent": "Fred", "children": [{"name": "Interest Rates", "parent": "Money, Banking, & Finance", "children": [{"name": "Interest Rates", "parent": "Interest Rates"}, {"name": "Automobile Loan Rates", "parent": "Interest Rates"}, {"name": "Bankers Acceptance Rate", "parent": "Interest Rates"}, {"name": "Certificates of Deposit", "parent": "Interest Rates"}, {"name": "Commercial Paper", "parent": "Interest Rates"}, {"name": "Corporate Bonds", "parent": "Interest Rates"}, {"name": "Credit Card Loan Rates", "parent": "Interest Rates"}, {"name": "Eurodollar Deposits", "parent": "Interest Rates"}, {"name": "FRB Rates - discount, fed funds, primary credit", "parent": "Interest Rates"}, {"name": "Interest Checking Accounts", "parent": "Interest Rates"}, {"name": "Interest Rate Spreads", "parent": "Interest Rates"}, {"name": "Interest Rate Swaps", "parent": "Interest Rates"}, {"name": "LIBOR Rates", "parent": "Interest Rates"}, {"name": "Long-Term Securities", "parent": "Interest Rates"}, {"name": "Money Market Accounts", "parent": "Interest Rates"}, {"name": "Mortgage Rates", "parent": "Interest Rates"}, {"name": "Personal Loan Rates", "parent": "Interest Rates"}, {"name": "Prime Bank Loan Rate", "parent": "Interest Rates"}, {"name": "Saving Accounts", "parent": "Interest Rates"}, {"name": "Treasury Bills", "parent": "Interest Rates"}, {"name": "Treasury Constant Maturity", "parent": "Interest Rates"}, {"name": "Treasury Inflation-Indexed Securities", "parent": "Interest Rates"}]}, {"name": "Exchange Rates", "parent": "Money, Banking, & Finance", "children": [{"name": "Exchange Rates", "parent": "Exchange Rates"}, {"name": "Daily Rates", "parent": "Exchange Rates"}, {"name": "Monthly Rates", "parent": "Exchange Rates"}, {"name": "Annual Rates", "parent": "Exchange Rates"}, {"name": "Trade-Weighted Indexes", "parent": "Exchange Rates"}, {"name": "By Country", "parent": "Exchange Rates"}]}, {"name": "Monetary Data", "parent": "Money, Banking, & Finance", "children": [{"name": "Monetary Data", "parent": "Monetary Data"}, {"name": "Monetary Base", "parent": "Monetary Data"}, {"name": "Reserves", "parent": "Monetary Data"}, {"name": "M1 and Components", "parent": "Monetary Data"}, {"name": "M2 and Components", "parent": "Monetary Data"}, {"name": "M2 Minus Small Time Deposits", "parent": "Monetary Data"}, {"name": "M3 and Components", "parent": "Monetary Data"}, {"name": "MZM", "parent": "Monetary Data"}, {"name": "Memorandum Items", "parent": "Monetary Data"}, {"name": "Money Velocity", "parent": "Monetary Data"}, {"name": "Borrowings", "parent": "Monetary Data"}, {"name": "Factors Affecting Reserve Balances", "parent": "Monetary Data"}, {"name": "Securities, Loans, & Other Assets & Liabilities Held by Fed", "parent": "Monetary Data"}]}, {"name": "Financial Indicators", "parent": "Money, Banking, & Finance", "children": [{"name": "Financial Indicators", "parent": "Financial Indicators"}, {"name": "Bond Market Indexes", "parent": "Financial Indicators"}, {"name": "Consumer Financial Condition Indexes", "parent": "Financial Indicators"}, {"name": "Financial Activity Measures", "parent": "Financial Indicators"}, {"name": "Stock Market Indexes", "parent": "Financial Indicators"}, {"name": "Volatility Indexes", "parent": "Financial Indicators"}]}, {"name": "Banking", "parent": "Money, Banking, & Finance", "children": [{"name": "Banking", "parent": "Banking"}, {"name": "Commercial Banking", "parent": "Banking"}, {"name": "Condition of Banks", "parent": "Banking"}, {"name": "Consumer Credit", "parent": "Banking"}, {"name": "Delinquencies and Delinquency Rates", "parent": "Banking"}, {"name": "Failures and Assistance Transactions", "parent": "Banking"}, {"name": "8th District Banking Performance", "parent": "Banking"}, {"name": "Mortgage Debt Outstanding", "parent": "Banking"}, {"name": "Net Charge-Offs and Charge-Off Rates", "parent": "Banking"}, {"name": "Securities & Investments", "parent": "Banking"}, {"name": "Senior Loan Officer Survey", "parent": "Banking"}]}, {"name": "Business Lending", "parent": "Money, Banking, & Finance", "children": [{"name": "Business Lending", "parent": "Business Lending"}, {"name": "Commercial Paper", "parent": "Business Lending"}, {"name": "Commercial and Industrial Loans by Time that Pricing Terms Were Set and by Commitment", "parent": "Business Lending"}, {"name": "Commercial and Industrial Loans Backed by Small Business Association", "parent": "Business Lending"}, {"name": "Commercial and Industrial Loans Made by All Commercial Banks", "parent": "Business Lending"}, {"name": "Commercial and Industrial Loans Made by Domestic Banks", "parent": "Business Lending"}, {"name": "Commercial and Industrial Loans Made by Large Domestic Banks", "parent": "Business Lending"}, {"name": "Commercial and Industrial Loans Made by Small Domestic Banks", "parent": "Business Lending"}, {"name": "Commercial and Industrial Loans Made by U.S. Branches and Agencies of Foreign Banks", "parent": "Business Lending"}, {"name": "Commercial and Industrial Loans Made Under Participation or Syndication", "parent": "Business Lending"}]}, {"name": "Foreign Exchange Intervention", "parent": "Money, Banking, & Finance", "children": [{"name": "Foreign Exchange Intervention", "parent": "Foreign Exchange Intervention"}]}]}, {"name": "Population, Employment, & Labor Markets", "parent": "Fred", "children": [{"name": "Current Population Survey (Household Survey)", "parent": "Population, Employment, & Labor Markets", "children": [{"name": "Current Population Survey (Household Survey)", "parent": "Current Population Survey (Household Survey)"}, {"name": "Civilian Labor Force", "parent": "Current Population Survey (Household Survey)"}, {"name": "Civilian Labor Force Participation Rate", "parent": "Current Population Survey (Household Survey)"}, {"name": "Employment", "parent": "Current Population Survey (Household Survey)"}, {"name": "Employment Population Ratio", "parent": "Current Population Survey (Household Survey)"}, {"name": "Unemployment Level", "parent": "Current Population Survey (Household Survey)"}, {"name": "Unemployment Rate", "parent": "Current Population Survey (Household Survey)"}, {"name": "Not in Labor Force", "parent": "Current Population Survey (Household Survey)"}, {"name": "Labor Force Participation Rate", "parent": "Current Population Survey (Household Survey)"}, {"name": "Multiple Jobholders", "parent": "Current Population Survey (Household Survey)"}, {"name": "Duration of Unemployment", "parent": "Current Population Survey (Household Survey)"}, {"name": "Losers and Leavers", "parent": "Current Population Survey (Household Survey)"}, {"name": "Earnings", "parent": "Current Population Survey (Household Survey)"}, {"name": "Entrants and Reentrants", "parent": "Current Population Survey (Household Survey)"}, {"name": "Labor Force Status Flows", "parent": "Current Population Survey (Household Survey)"}]}, {"name": "Current Employment Statistics (Establishment Survey)", "parent": "Population, Employment, & Labor Markets", "children": [{"name": "Current Employment Statistics (Establishment Survey)", "parent": "Current Employment Statistics (Establishment Survey)"}, {"name": "Total Nonfarm", "parent": "Current Employment Statistics (Establishment Survey)"}, {"name": "Total Private", "parent": "Current Employment Statistics (Establishment Survey)"}, {"name": "Goods-Producing", "parent": "Current Employment Statistics (Establishment Survey)"}, {"name": "Service-Providing", "parent": "Current Employment Statistics (Establishment Survey)"}, {"name": "Private Service-Providing", "parent": "Current Employment Statistics (Establishment Survey)"}, {"name": "Mining and Logging", "parent": "Current Employment Statistics (Establishment Survey)"}, {"name": "Construction", "parent": "Current Employment Statistics (Establishment Survey)"}, {"name": "Manufacturing", "parent": "Current Employment Statistics (Establishment Survey)"}, {"name": "Durable Goods", "parent": "Current Employment Statistics (Establishment Survey)"}, {"name": "Nondurable Goods", "parent": "Current Employment Statistics (Establishment Survey)"}, {"name": "Trade, Transportation, and Utilities", "parent": "Current Employment Statistics (Establishment Survey)"}, {"name": "Wholesale Trade", "parent": "Current Employment Statistics (Establishment Survey)"}, {"name": "Retail Trade", "parent": "Current Employment Statistics (Establishment Survey)"}, {"name": "Transportation and Warehousing", "parent": "Current Employment Statistics (Establishment Survey)"}, {"name": "Utilities", "parent": "Current Employment Statistics (Establishment Survey)"}, {"name": "Information", "parent": "Current Employment Statistics (Establishment Survey)"}, {"name": "Financial Activities", "parent": "Current Employment Statistics (Establishment Survey)"}, {"name": "Professional and Business Services", "parent": "Current Employment Statistics (Establishment Survey)"}, {"name": "Education and Health Services", "parent": "Current Employment Statistics (Establishment Survey)"}, {"name": "Leisure and Hospitality", "parent": "Current Employment Statistics (Establishment Survey)"}, {"name": "Other Services", "parent": "Current Employment Statistics (Establishment Survey)"}, {"name": "Government", "parent": "Current Employment Statistics (Establishment Survey)"}]}, {"name": "ADP Employment", "parent": "Population, Employment, & Labor Markets", "children": [{"name": "ADP Employment", "parent": "ADP Employment"}]}, {"name": "Education", "parent": "Population, Employment, & Labor Markets", "children": [{"name": "Education", "parent": "Education"}]}, {"name": "Income Distribution", "parent": "Population, Employment, & Labor Markets", "children": [{"name": "Income Distribution", "parent": "Income Distribution"}]}, {"name": "Job Openings and Labor Turnover (JOLTS)", "parent": "Population, Employment, & Labor Markets", "children": [{"name": "Job Openings and Labor Turnover (JOLTS)", "parent": "Job Openings and Labor Turnover (JOLTS)"}, {"name": "Job Openings (Levels and Rates)", "parent": "Job Openings and Labor Turnover (JOLTS)"}, {"name": "Hires (Levels and Rates)", "parent": "Job Openings and Labor Turnover (JOLTS)"}, {"name": "Total Separations (Levels and Rates)", "parent": "Job Openings and Labor Turnover (JOLTS)"}, {"name": "Quits (Levels and Rates)", "parent": "Job Openings and Labor Turnover (JOLTS)"}, {"name": "Layoffs and Discharges (Levels and Rates)", "parent": "Job Openings and Labor Turnover (JOLTS)"}, {"name": "Other Separations (Levels and Rates)", "parent": "Job Openings and Labor Turnover (JOLTS)"}]}, {"name": "Labor Market Conditions", "parent": "Population, Employment, & Labor Markets", "children": [{"name": "Labor Market Conditions", "parent": "Labor Market Conditions"}]}, {"name": "Population", "parent": "Population, Employment, & Labor Markets", "children": [{"name": "Population", "parent": "Population"}, {"name": "Poverty Measures", "parent": "Population"}, {"name": "Supplemental Nutrition Assistance Program", "parent": "Population"}]}, {"name": "Productivity & Costs", "parent": "Population, Employment, & Labor Markets", "children": [{"name": "Productivity & Costs", "parent": "Productivity & Costs"}, {"name": "Manufacturing", "parent": "Productivity & Costs"}, {"name": "Business", "parent": "Productivity & Costs"}, {"name": "Nonfarm Business", "parent": "Productivity & Costs"}, {"name": "Nonfinancial Corporations", "parent": "Productivity & Costs"}]}, {"name": "Minimum Wage", "parent": "Population, Employment, & Labor Markets", "children": [{"name": "Minimum Wage", "parent": "Minimum Wage"}]}, {"name": "Weekly Initial Claims", "parent": "Population, Employment, & Labor Markets", "children": [{"name": "Weekly Initial Claims", "parent": "Weekly Initial Claims"}]}, {"name": "Tax Data", "parent": "Population, Employment, & Labor Markets", "children": [{"name": "Tax Data", "parent": "Tax Data"}]}]}, {"name": "National Accounts", "parent": "Fred", "children": [{"name": "National Income & Product Accounts", "parent": "National Accounts", "children": [{"name": "National Income & Product Accounts", "parent": "National Income & Product Accounts"}, {"name": "Domestic Capital Account (Saving & Investment)", "parent": "National Income & Product Accounts"}, {"name": "Foreign Transactions", "parent": "National Income & Product Accounts"}, {"name": "Fixed Assets", "parent": "National Income & Product Accounts"}, {"name": "Gross Domestic Income", "parent": "National Income & Product Accounts"}, {"name": "GDP/GNP", "parent": "National Income & Product Accounts"}, {"name": "Gov't Receipts, Expenditures & Investment", "parent": "National Income & Product Accounts"}, {"name": "Health Care Spending", "parent": "National Income & Product Accounts"}, {"name": "Imputations", "parent": "National Income & Product Accounts"}, {"name": "Industry", "parent": "National Income & Product Accounts"}, {"name": "Personal Income & Outlays", "parent": "National Income & Product Accounts"}, {"name": "Price Indexes & Deflators", "parent": "National Income & Product Accounts"}, {"name": "Private Enterprise Income", "parent": "National Income & Product Accounts"}, {"name": "Quantity Indexes", "parent": "National Income & Product Accounts"}, {"name": "Effect of ARRA on Selected NIPA Estimates", "parent": "National Income & Product Accounts"}]}, {"name": "Federal Government Debt", "parent": "National Accounts", "children": [{"name": "Federal Government Debt", "parent": "Federal Government Debt"}]}, {"name": "Flow of Funds", "parent": "National Accounts", "children": [{"name": "Flow of Funds", "parent": "Flow of Funds"}, {"name": "B.101 Balance Sheet of Households and Nonprofit Organizations", "parent": "Flow of Funds"}, {"name": "B.103 Balance Sheet of Nonfinancial Corporate Business", "parent": "Flow of Funds"}, {"name": "B.104 Balance Sheet of Nonfinancial Noncorporate Business", "parent": "Flow of Funds"}, {"name": "D.3 Credit Market Debt Outstanding by Sector", "parent": "Flow of Funds"}, {"name": "L.1 Credit Market Debt Outstanding", "parent": "Flow of Funds"}, {"name": "L.203 Net Interbank Transactions", "parent": "Flow of Funds"}, {"name": "L.208 Debt Securities", "parent": "Flow of Funds"}, {"name": "L.214 Loans", "parent": "Flow of Funds"}, {"name": "S.1 Total Economy - Current Account", "parent": "Flow of Funds"}, {"name": "S.2 Selected Aggregates for Total Economy and Sectors", "parent": "Flow of Funds"}, {"name": "S.3 Households and Nonprofit Institutions Serving Households", "parent": "Flow of Funds"}, {"name": "S.4 Nonfinancial Noncorporate Business", "parent": "Flow of Funds"}, {"name": "S.5 Nonfinancial Corporate Business", "parent": "Flow of Funds"}, {"name": "S.6 Financial Business", "parent": "Flow of Funds"}, {"name": "S.7 Federal Government", "parent": "Flow of Funds"}, {"name": "S.8 State and Local Governments", "parent": "Flow of Funds"}, {"name": "S.9 Rest of the World", "parent": "Flow of Funds"}]}, {"name": "U.S. Trade & International Transactions", "parent": "National Accounts", "children": [{"name": "U.S. Trade & International Transactions", "parent": "U.S. Trade & International Transactions"}, {"name": "Exports", "parent": "U.S. Trade & International Transactions"}, {"name": "Imports", "parent": "U.S. Trade & International Transactions"}, {"name": "Income Payments & Receipts", "parent": "U.S. Trade & International Transactions"}, {"name": "International Investment Position", "parent": "U.S. Trade & International Transactions"}, {"name": "Trade Balance", "parent": "U.S. Trade & International Transactions"}, {"name": "U.S. International Finance", "parent": "U.S. Trade & International Transactions"}]}]}, {"name": "Production & Business Activity", "parent": "Fred", "children": [{"name": "Business Cycle Expansions & Contractions", "parent": "Production & Business Activity", "children": [{"name": "Business Cycle Expansions & Contractions", "parent": "Business Cycle Expansions & Contractions"}]}, {"name": "Construction", "parent": "Production & Business Activity", "children": [{"name": "Construction", "parent": "Construction"}]}, {"name": "Finance Companies", "parent": "Production & Business Activity", "children": [{"name": "Finance Companies", "parent": "Finance Companies"}]}, {"name": "Health Insurance", "parent": "Production & Business Activity", "children": [{"name": "Health Insurance", "parent": "Health Insurance"}]}, {"name": "Housing", "parent": "Production & Business Activity", "children": [{"name": "Housing", "parent": "Housing"}, {"name": "Housing Units Authorized by Building Permits", "parent": "Housing"}, {"name": "Housing Units Authorized, But Not Yet Started", "parent": "Housing"}, {"name": "Housing Starts", "parent": "Housing"}, {"name": "Housing Units Under Construction", "parent": "Housing"}, {"name": "Housing Units Completed", "parent": "Housing"}, {"name": "New Residential Sales", "parent": "Housing"}, {"name": "House Price Indexes", "parent": "Housing"}]}, {"name": "Industrial Production & Capacity Utilization", "parent": "Production & Business Activity", "children": [{"name": "Industrial Production & Capacity Utilization", "parent": "Industrial Production & Capacity Utilization"}]}, {"name": "Manufacturing", "parent": "Production & Business Activity", "children": [{"name": "Manufacturing", "parent": "Manufacturing"}, {"name": "Inventories", "parent": "Manufacturing"}, {"name": "New Orders", "parent": "Manufacturing"}, {"name": "Inventory to Shipments", "parent": "Manufacturing"}, {"name": "Unfilled Orders", "parent": "Manufacturing"}, {"name": "Unfilled Orders to Shipments", "parent": "Manufacturing"}, {"name": "Shipments", "parent": "Manufacturing"}]}, {"name": "Retail Trade", "parent": "Production & Business Activity", "children": [{"name": "Retail Trade", "parent": "Retail Trade"}]}, {"name": "Services", "parent": "Production & Business Activity", "children": [{"name": "Services", "parent": "Services"}]}, {"name": "Technology", "parent": "Production & Business Activity", "children": [{"name": "Technology", "parent": "Technology"}]}, {"name": "Transportation", "parent": "Production & Business Activity", "children": [{"name": "Transportation", "parent": "Transportation"}, {"name": "Motor Vehicles", "parent": "Transportation"}]}, {"name": "Wholesale Trade", "parent": "Production & Business Activity", "children": [{"name": "Wholesale Trade", "parent": "Wholesale Trade"}]}]}, {"name": "Prices", "parent": "Fred", "children": [{"name": "Commodities", "parent": "Prices", "children": [{"name": "Commodities", "parent": "Commodities"}]}, {"name": "Consumer Price Indexes (CPI and PCE)", "parent": "Prices", "children": [{"name": "Consumer Price Indexes (CPI and PCE)", "parent": "Consumer Price Indexes (CPI and PCE)"}, {"name": "Food and Beverages", "parent": "Consumer Price Indexes (CPI and PCE)"}, {"name": "Housing", "parent": "Consumer Price Indexes (CPI and PCE)"}, {"name": "Apparel", "parent": "Consumer Price Indexes (CPI and PCE)"}, {"name": "Transportation", "parent": "Consumer Price Indexes (CPI and PCE)"}, {"name": "Medical Care", "parent": "Consumer Price Indexes (CPI and PCE)"}, {"name": "Recreation", "parent": "Consumer Price Indexes (CPI and PCE)"}, {"name": "Education and Communication", "parent": "Consumer Price Indexes (CPI and PCE)"}, {"name": "Other Goods and Services", "parent": "Consumer Price Indexes (CPI and PCE)"}, {"name": "Commodity and Services Groups", "parent": "Consumer Price Indexes (CPI and PCE)"}, {"name": "Special Indexes", "parent": "Consumer Price Indexes (CPI and PCE)"}]}, {"name": "Cryptocurrencies", "parent": "Prices", "children": [{"name": "Cryptocurrencies", "parent": "Cryptocurrencies"}]}, {"name": "Employment Cost Index", "parent": "Prices", "children": [{"name": "Employment Cost Index", "parent": "Employment Cost Index"}, {"name": "Population, Employment, & Labor Markets", "parent": "Employment Cost Index"}]}, {"name": "Health Care Indexes", "parent": "Prices", "children": [{"name": "Health Care Indexes", "parent": "Health Care Indexes"}]}, {"name": "House Price Indexes", "parent": "Prices", "children": [{"name": "House Price Indexes", "parent": "House Price Indexes"}]}, {"name": "Producer Price Indexes (PPI)", "parent": "Prices", "children": [{"name": "Producer Price Indexes (PPI)", "parent": "Producer Price Indexes (PPI)"}, {"name": "Commodity Based", "parent": "Producer Price Indexes (PPI)"}, {"name": "Industry Based", "parent": "Producer Price Indexes (PPI)"}]}, {"name": "Trade Indexes", "parent": "Prices", "children": [{"name": "Trade Indexes", "parent": "Trade Indexes"}, {"name": "Import Price Indexes", "parent": "Trade Indexes"}, {"name": "Export Price Indexes", "parent": "Trade Indexes"}, {"name": "Services Price Indexes", "parent": "Trade Indexes"}]}]}, {"name": "International Data", "parent": "Fred", "children": [{"name": "Countries", "parent": "International Data", "children": [{"name": "Countries", "parent": "Countries"}, {"name": "Afghanistan", "parent": "Countries"}, {"name": "Albania", "parent": "Countries"}, {"name": "Algeria", "parent": "Countries"}, {"name": "American Samoa", "parent": "Countries"}, {"name": "Andorra", "parent": "Countries"}, {"name": "Angola", "parent": "Countries"}, {"name": "Anguilla", "parent": "Countries"}, {"name": "Antigua and Barbuda", "parent": "Countries"}, {"name": "Argentina", "parent": "Countries"}, {"name": "Armenia", "parent": "Countries"}, {"name": "Aruba", "parent": "Countries"}, {"name": "Australia", "parent": "Countries"}, {"name": "Austria", "parent": "Countries"}, {"name": "Azerbaijan", "parent": "Countries"}, {"name": "Bahamas", "parent": "Countries"}, {"name": "Bahrain", "parent": "Countries"}, {"name": "Bangladesh", "parent": "Countries"}, {"name": "Barbados", "parent": "Countries"}, {"name": "Belarus", "parent": "Countries"}, {"name": "Belgium", "parent": "Countries"}, {"name": "Belize", "parent": "Countries"}, {"name": "Benin", "parent": "Countries"}, {"name": "Bermuda", "parent": "Countries"}, {"name": "Bhutan", "parent": "Countries"}, {"name": "Bolivia, Plurinational State of", "parent": "Countries"}, {"name": "Caribbean Netherlands", "parent": "Countries"}, {"name": "Bosnia and Herzegovina", "parent": "Countries"}, {"name": "Botswana", "parent": "Countries"}, {"name": "Brazil", "parent": "Countries"}, {"name": "British Indian Ocean Territory", "parent": "Countries"}, {"name": "Brunei Darussalam", "parent": "Countries"}, {"name": "Bulgaria", "parent": "Countries"}, {"name": "Burkina Faso", "parent": "Countries"}, {"name": "Burundi", "parent": "Countries"}, {"name": "Cambodia", "parent": "Countries"}, {"name": "Cameroon", "parent": "Countries"}, {"name": "Canada", "parent": "Countries"}, {"name": "Cape Verde", "parent": "Countries"}, {"name": "Cayman Islands", "parent": "Countries"}, {"name": "Central African Republic", "parent": "Countries"}, {"name": "Chad", "parent": "Countries"}, {"name": "Chile", "parent": "Countries"}, {"name": "China", "parent": "Countries"}, {"name": "Christmas Island", "parent": "Countries"}, {"name": "Cocos (Keeling) Islands", "parent": "Countries"}, {"name": "Colombia", "parent": "Countries"}, {"name": "Comoros", "parent": "Countries"}, {"name": "Congo, Republic of the", "parent": "Countries"}, {"name": "Congo, Democratic Republic of the", "parent": "Countries"}, {"name": "Cook Islands", "parent": "Countries"}, {"name": "Costa Rica", "parent": "Countries"}, {"name": "C\u00f4te d\u2019Ivoire", "parent": "Countries"}, {"name": "Croatia", "parent": "Countries"}, {"name": "Cuba", "parent": "Countries"}, {"name": "Cura\u00e7ao", "parent": "Countries"}, {"name": "Cyprus", "parent": "Countries"}, {"name": "Czech Republic", "parent": "Countries"}, {"name": "Denmark", "parent": "Countries"}, {"name": "Djibouti", "parent": "Countries"}, {"name": "Dominica", "parent": "Countries"}, {"name": "Dominican Republic", "parent": "Countries"}, {"name": "Ecuador", "parent": "Countries"}, {"name": "Egypt", "parent": "Countries"}, {"name": "El Salvador", "parent": "Countries"}, {"name": "Equatorial Guinea", "parent": "Countries"}, {"name": "Eritrea", "parent": "Countries"}, {"name": "Estonia", "parent": "Countries"}, {"name": "Ethiopia", "parent": "Countries"}, {"name": "Falkland Islands", "parent": "Countries"}, {"name": "Faroe Islands", "parent": "Countries"}, {"name": "Fiji", "parent": "Countries"}, {"name": "Finland", "parent": "Countries"}, {"name": "France", "parent": "Countries"}, {"name": "French Guiana", "parent": "Countries"}, {"name": "French Polynesia", "parent": "Countries"}, {"name": "French Southern Territories", "parent": "Countries"}, {"name": "Gabon", "parent": "Countries"}, {"name": "Republic of the Gambia", "parent": "Countries"}, {"name": "Georgia", "parent": "Countries"}, {"name": "Germany", "parent": "Countries"}, {"name": "Ghana", "parent": "Countries"}, {"name": "Gibraltar", "parent": "Countries"}, {"name": "Greece", "parent": "Countries"}, {"name": "Greenland", "parent": "Countries"}, {"name": "Grenada", "parent": "Countries"}, {"name": "Guadeloupe", "parent": "Countries"}, {"name": "Guam", "parent": "Countries"}, {"name": "Guatemala", "parent": "Countries"}, {"name": "Guinea", "parent": "Countries"}, {"name": "Guinea-Bissau", "parent": "Countries"}, {"name": "Guyana", "parent": "Countries"}, {"name": "Haiti", "parent": "Countries"}, {"name": "Heard Island and McDonald Islands", "parent": "Countries"}, {"name": "Holy See (Vatican City State)", "parent": "Countries"}, {"name": "Honduras", "parent": "Countries"}, {"name": "Hong Kong", "parent": "Countries"}, {"name": "Hungary", "parent": "Countries"}, {"name": "Iceland", "parent": "Countries"}, {"name": "India", "parent": "Countries"}, {"name": "Indonesia", "parent": "Countries"}, {"name": "Iran, Islamic Republic of", "parent": "Countries"}, {"name": "Iraq", "parent": "Countries"}, {"name": "Ireland", "parent": "Countries"}, {"name": "Isle of Man", "parent": "Countries"}, {"name": "Israel", "parent": "Countries"}, {"name": "Italy", "parent": "Countries"}, {"name": "Jamaica", "parent": "Countries"}, {"name": "Japan", "parent": "Countries"}, {"name": "Jordan", "parent": "Countries"}, {"name": "Kazakhstan", "parent": "Countries"}, {"name": "Kenya", "parent": "Countries"}, {"name": "Kiribati", "parent": "Countries"}, {"name": "Korea, Democratic People's Republic of (North Korea)", "parent": "Countries"}, {"name": "Korea, Republic of (South Korea)", "parent": "Countries"}, {"name": "Kuwait", "parent": "Countries"}, {"name": "Kyrgyz Republic", "parent": "Countries"}, {"name": "Lao People's Democratic Republic", "parent": "Countries"}, {"name": "Latvia", "parent": "Countries"}, {"name": "Lebanon", "parent": "Countries"}, {"name": "Lesotho", "parent": "Countries"}, {"name": "Liberia", "parent": "Countries"}, {"name": "Libyan Arab Jamahiriya", "parent": "Countries"}, {"name": "Liechtenstein", "parent": "Countries"}, {"name": "Lithuania", "parent": "Countries"}, {"name": "Luxembourg", "parent": "Countries"}, {"name": "Macao", "parent": "Countries"}, {"name": "Macedonia, Former Yugoslav Republic of", "parent": "Countries"}, {"name": "Madagascar", "parent": "Countries"}, {"name": "Malawi", "parent": "Countries"}, {"name": "Malaysia", "parent": "Countries"}, {"name": "Maldives", "parent": "Countries"}, {"name": "Mali", "parent": "Countries"}, {"name": "Malta", "parent": "Countries"}, {"name": "Marshall Islands", "parent": "Countries"}, {"name": "Martinique", "parent": "Countries"}, {"name": "Mauritania", "parent": "Countries"}, {"name": "Mauritius", "parent": "Countries"}, {"name": "Mayotte", "parent": "Countries"}, {"name": "Mexico", "parent": "Countries"}, {"name": "Micronesia, Federated States of", "parent": "Countries"}, {"name": "Moldova, Republic of", "parent": "Countries"}, {"name": "Monaco", "parent": "Countries"}, {"name": "Mongolia", "parent": "Countries"}, {"name": "Montenegro", "parent": "Countries"}, {"name": "Montserrat", "parent": "Countries"}, {"name": "Morocco", "parent": "Countries"}, {"name": "Mozambique", "parent": "Countries"}, {"name": "Myanmar", "parent": "Countries"}, {"name": "Namibia", "parent": "Countries"}, {"name": "Nauru", "parent": "Countries"}, {"name": "Nepal", "parent": "Countries"}, {"name": "Netherlands", "parent": "Countries"}, {"name": "New Caledonia", "parent": "Countries"}, {"name": "New Zealand", "parent": "Countries"}, {"name": "Nicaragua", "parent": "Countries"}, {"name": "Niger", "parent": "Countries"}, {"name": "Nigeria", "parent": "Countries"}, {"name": "Niue", "parent": "Countries"}, {"name": "Norfolk Island", "parent": "Countries"}, {"name": "Northern Mariana Islands", "parent": "Countries"}, {"name": "Norway", "parent": "Countries"}, {"name": "Oman", "parent": "Countries"}, {"name": "Pakistan", "parent": "Countries"}, {"name": "Palau", "parent": "Countries"}, {"name": "Palestinian Territories", "parent": "Countries"}, {"name": "Panama", "parent": "Countries"}, {"name": "Papua New Guinea", "parent": "Countries"}, {"name": "Paraguay", "parent": "Countries"}, {"name": "Peru", "parent": "Countries"}, {"name": "Philippines", "parent": "Countries"}, {"name": "Pitcairn", "parent": "Countries"}, {"name": "Poland", "parent": "Countries"}, {"name": "Portugal", "parent": "Countries"}, {"name": "Puerto Rico", "parent": "Countries"}, {"name": "Qatar", "parent": "Countries"}, {"name": "Reunion", "parent": "Countries"}, {"name": "Romania", "parent": "Countries"}, {"name": "Russian Federation", "parent": "Countries"}, {"name": "Rwanda", "parent": "Countries"}, {"name": "Saint Helena, Ascension and Tristan da Cunha", "parent": "Countries"}, {"name": "Saint Kitts and Nevis", "parent": "Countries"}, {"name": "Saint Lucia", "parent": "Countries"}, {"name": "Saint Martin, Collectivity of", "parent": "Countries"}, {"name": "Saint Pierre and Miquelon", "parent": "Countries"}, {"name": "Saint Vincent and the Grenadines", "parent": "Countries"}, {"name": "Samoa", "parent": "Countries"}, {"name": "San Marino", "parent": "Countries"}, {"name": "Sao Tome and Principe", "parent": "Countries"}, {"name": "Saudi Arabia", "parent": "Countries"}, {"name": "Senegal", "parent": "Countries"}, {"name": "Serbia", "parent": "Countries"}, {"name": "Seychelles", "parent": "Countries"}, {"name": "Sierra Leone", "parent": "Countries"}, {"name": "Singapore", "parent": "Countries"}, {"name": "Sint Maarten (Dutch part)", "parent": "Countries"}, {"name": "Slovak Republic", "parent": "Countries"}, {"name": "Slovenia", "parent": "Countries"}, {"name": "Solomon Islands", "parent": "Countries"}, {"name": "Somalia", "parent": "Countries"}, {"name": "South Africa", "parent": "Countries"}, {"name": "South Sudan", "parent": "Countries"}, {"name": "Spain", "parent": "Countries"}, {"name": "Sri Lanka", "parent": "Countries"}, {"name": "Sudan", "parent": "Countries"}, {"name": "Suriname", "parent": "Countries"}, {"name": "Svalbard and Jan Mayen", "parent": "Countries"}, {"name": "Swaziland", "parent": "Countries"}, {"name": "Sweden", "parent": "Countries"}, {"name": "Switzerland", "parent": "Countries"}, {"name": "Syrian Arab Republic", "parent": "Countries"}, {"name": "Taiwan", "parent": "Countries"}, {"name": "Tajikistan", "parent": "Countries"}, {"name": "Tanzania, United Republic of", "parent": "Countries"}, {"name": "Thailand", "parent": "Countries"}, {"name": "Timor-Leste", "parent": "Countries"}, {"name": "Togo", "parent": "Countries"}, {"name": "Tokelau", "parent": "Countries"}, {"name": "Tonga", "parent": "Countries"}, {"name": "Trinidad and Tobago", "parent": "Countries"}, {"name": "Tunisia", "parent": "Countries"}, {"name": "Turkey", "parent": "Countries"}, {"name": "Turkmenistan", "parent": "Countries"}, {"name": "Turks and Caicos Islands", "parent": "Countries"}, {"name": "Tuvalu", "parent": "Countries"}, {"name": "Uganda", "parent": "Countries"}, {"name": "Ukraine", "parent": "Countries"}, {"name": "United Arab Emirates", "parent": "Countries"}, {"name": "United Kingdom", "parent": "Countries"}, {"name": "United States", "parent": "Countries"}, {"name": "Uruguay", "parent": "Countries"}, {"name": "Uzbekistan", "parent": "Countries"}, {"name": "Vanuatu", "parent": "Countries"}, {"name": "Venezuela, Bolivarian Republic of", "parent": "Countries"}, {"name": "Viet Nam", "parent": "Countries"}, {"name": "Virgin Islands, British", "parent": "Countries"}, {"name": "Virgin Islands, U.S.", "parent": "Countries"}, {"name": "Wallis and Futuna", "parent": "Countries"}, {"name": "Western Sahara", "parent": "Countries"}, {"name": "Yemen, Republic of", "parent": "Countries"}, {"name": "Kosovo", "parent": "Countries"}, {"name": "Zambia", "parent": "Countries"}, {"name": "Zimbabwe", "parent": "Countries"}]}, {"name": "Geography", "parent": "International Data", "children": [{"name": "Geography", "parent": "Geography"}, {"name": "Africa", "parent": "Geography"}, {"name": "Americas", "parent": "Geography"}, {"name": "Asia", "parent": "Geography"}, {"name": "Europe", "parent": "Geography"}, {"name": "Oceania", "parent": "Geography"}, {"name": "World", "parent": "Geography"}]}, {"name": "Indicators", "parent": "International Data", "children": [{"name": "Indicators", "parent": "Indicators"}, {"name": "Money, Banking, & Finance", "parent": "Indicators"}, {"name": "National Accounts", "parent": "Indicators"}, {"name": "Population, Employment, & Labor Markets", "parent": "Indicators"}, {"name": "Production & Business Activity", "parent": "Indicators"}, {"name": "Prices", "parent": "Indicators"}, {"name": "Consumer Price Index", "parent": "Indicators"}, {"name": "Work Started", "parent": "Indicators"}, {"name": "Consumer opinion surveys", "parent": "Indicators"}, {"name": "Business tendency surveys (construction)", "parent": "Indicators"}, {"name": "Business tendency surveys (services)", "parent": "Indicators"}, {"name": "Business tendency surveys (manufacturing)", "parent": "Indicators"}, {"name": "Business tendency surveys (retail trade)", "parent": "Indicators"}, {"name": "Business tendency surveys (non-manufacturing)", "parent": "Indicators"}]}, {"name": "Institutions", "parent": "International Data", "children": [{"name": "Institutions", "parent": "Institutions"}, {"name": "Advanced Economies", "parent": "Institutions"}, {"name": "Association of Southeast Asian Nations (ASEAN)", "parent": "Institutions"}, {"name": "Bureau of Labor Statistics Asian Newly Industrialized Countries", "parent": "Institutions"}, {"name": "Bureau of Labor Statistics Industrialized Countries", "parent": "Institutions"}, {"name": "Bureau of Labor Statistics Latin America", "parent": "Institutions"}, {"name": "Bureau of Labor Statistics Pacific Rim", "parent": "Institutions"}, {"name": "Emerging Markets", "parent": "Institutions"}, {"name": "Euro Area", "parent": "Institutions"}, {"name": "European Economic Area", "parent": "Institutions"}, {"name": "European Union", "parent": "Institutions"}, {"name": "Four Big European Countries", "parent": "Institutions"}, {"name": "Group of Seven (G7)", "parent": "Institutions"}, {"name": "Group of Twenty Finance Ministers and Central Bank Governors (G20)", "parent": "Institutions"}, {"name": "International Monetary Fund", "parent": "Institutions"}, {"name": "International Organizations", "parent": "Institutions"}, {"name": "Major 5 Asia", "parent": "Institutions"}, {"name": "NAFTA", "parent": "Institutions"}, {"name": "Non-OECD", "parent": "Institutions"}, {"name": "OECD Non-member Economies", "parent": "Institutions"}, {"name": "OECD Total", "parent": "Institutions"}, {"name": "OECD + Non-member Economies", "parent": "Institutions"}, {"name": "OECD - Europe", "parent": "Institutions"}, {"name": "Unidentified Countries", "parent": "Institutions"}, {"name": "Advance Technology Products", "parent": "Institutions"}, {"name": "NICS", "parent": "Institutions"}]}]}, {"name": "U.S. Regional Data", "parent": "Fred", "children": [{"name": "States", "parent": "U.S. Regional Data", "children": [{"name": "Alabama", "parent": "States"}, {"name": "Alaska", "parent": "States"}, {"name": "Arizona", "parent": "States"}, {"name": "Arkansas", "parent": "States"}, {"name": "California", "parent": "States"}, {"name": "Colorado", "parent": "States"}, {"name": "Connecticut", "parent": "States"}, {"name": "Delaware", "parent": "States"}, {"name": "District of Columbia", "parent": "States"}, {"name": "Florida", "parent": "States"}, {"name": "Georgia", "parent": "States"}, {"name": "Hawaii", "parent": "States"}, {"name": "Idaho", "parent": "States"}, {"name": "Illinois", "parent": "States"}, {"name": "Indiana", "parent": "States"}, {"name": "Iowa", "parent": "States"}, {"name": "Kansas", "parent": "States"}, {"name": "Kentucky", "parent": "States"}, {"name": "Louisiana", "parent": "States"}, {"name": "Maine", "parent": "States"}, {"name": "Maryland", "parent": "States"}, {"name": "Massachusetts", "parent": "States"}, {"name": "Michigan", "parent": "States"}, {"name": "Minnesota", "parent": "States"}, {"name": "Mississippi", "parent": "States"}, {"name": "Missouri", "parent": "States"}, {"name": "Montana", "parent": "States"}, {"name": "Nebraska", "parent": "States"}, {"name": "Nevada", "parent": "States"}, {"name": "New Hampshire", "parent": "States"}, {"name": "New Jersey", "parent": "States"}, {"name": "New Mexico", "parent": "States"}, {"name": "New York", "parent": "States"}, {"name": "North Carolina", "parent": "States"}, {"name": "North Dakota", "parent": "States"}, {"name": "Ohio", "parent": "States"}, {"name": "Oklahoma", "parent": "States"}, {"name": "Oregon", "parent": "States"}, {"name": "Pennsylvania", "parent": "States"}, {"name": "Puerto Rico", "parent": "States"}, {"name": "Rhode Island", "parent": "States"}, {"name": "South Carolina", "parent": "States"}, {"name": "South Dakota", "parent": "States"}, {"name": "Tennessee", "parent": "States"}, {"name": "Texas", "parent": "States"}, {"name": "Utah", "parent": "States"}, {"name": "Vermont", "parent": "States"}, {"name": "Virgin Islands", "parent": "States"}, {"name": "Virginia", "parent": "States"}, {"name": "West Virginia", "parent": "States"}, {"name": "Washington", "parent": "States"}, {"name": "Wisconsin", "parent": "States"}, {"name": "Wyoming", "parent": "States"}]}, {"name": "Census Regions", "parent": "U.S. Regional Data", "children": [{"name": "Midwest", "parent": "Census Regions"}, {"name": "Northeast", "parent": "Census Regions"}, {"name": "South", "parent": "Census Regions"}, {"name": "West", "parent": "Census Regions"}]}, {"name": "BEA Regions", "parent": "U.S. Regional Data", "children": [{"name": "Far West", "parent": "BEA Regions"}, {"name": "Great Lakes", "parent": "BEA Regions"}, {"name": "Mideast", "parent": "BEA Regions"}, {"name": "New England", "parent": "BEA Regions"}, {"name": "Plains", "parent": "BEA Regions"}, {"name": "Rocky Mountain", "parent": "BEA Regions"}, {"name": "Southeast", "parent": "BEA Regions"}, {"name": "Southwest", "parent": "BEA Regions"}]}, {"name": "BLS Regions", "parent": "U.S. Regional Data", "children": [{"name": "Midwest Urban", "parent": "BLS Regions"}, {"name": "Northeast Urban", "parent": "BLS Regions"}, {"name": "South Urban", "parent": "BLS Regions"}, {"name": "West Urban", "parent": "BLS Regions"}, {"name": "Population Size Class A (over 1,500,000)", "parent": "BLS Regions"}, {"name": "Population Size Class B/C (between 50,000 and 1,500,000)", "parent": "BLS Regions"}, {"name": "Population Size Class D (under 50,000)", "parent": "BLS Regions"}]}, {"name": "Federal Reserve Districts", "parent": "U.S. Regional Data", "children": [{"name": "Atlanta", "parent": "Federal Reserve Districts"}, {"name": "Boston", "parent": "Federal Reserve Districts"}, {"name": "Chicago", "parent": "Federal Reserve Districts"}, {"name": "Cleveland", "parent": "Federal Reserve Districts"}, {"name": "Dallas", "parent": "Federal Reserve Districts"}, {"name": "Kansas City", "parent": "Federal Reserve Districts"}, {"name": "Minneapolis", "parent": "Federal Reserve Districts"}, {"name": "New York", "parent": "Federal Reserve Districts"}, {"name": "Philadelphia", "parent": "Federal Reserve Districts"}, {"name": "Richmond", "parent": "Federal Reserve Districts"}, {"name": "San Francisco", "parent": "Federal Reserve Districts"}, {"name": "St. Louis", "parent": "Federal Reserve Districts"}]}, {"name": "Freddie Mac Regions", "parent": "U.S. Regional Data", "children": [{"name": "North Central", "parent": "Freddie Mac Regions"}, {"name": "Northeast", "parent": "Freddie Mac Regions"}, {"name": "Southeast", "parent": "Freddie Mac Regions"}, {"name": "Southwest", "parent": "Freddie Mac Regions"}, {"name": "West", "parent": "Freddie Mac Regions"}]}]}]}]; // ************** Generate the tree diagram ***************** var margin = {top: 20, right: 120, bottom: 20, left: 120}, width = 1200 - margin.right - margin.left, height = 1500 - margin.top - margin.bottom; var i = 0, duration = 750, root; var tree = d3.layout.tree() .size([height, width]); var diagonal = d3.svg.diagonal() .projection(function(d) { return [d.y, d.x]; }); var svg = d3.select("body").append("svg") .attr("width", width + margin.right + margin.left) .attr("height", height + margin.top + margin.bottom) .append("g") .attr("transform", "translate(" + margin.left + "," + margin.top + ")"); root = treeData[0]; root.x0 = height / 2; root.y0 = 0; update(root); d3.select(self.frameElement).style("height", "500px"); function update(source) { // Compute the new tree layout. var nodes = tree.nodes(root).reverse(), links = tree.links(nodes); // Normalize for fixed-depth. nodes.forEach(function(d) { d.y = d.depth * 180; }); // Update the nodes… var node = svg.selectAll("g.node") .data(nodes, function(d) { return d.id || (d.id = ++i); }); // Enter any new nodes at the parent's previous position. var nodeEnter = node.enter().append("g") .attr("class", "node") .attr("transform", function(d) { return "translate(" + source.y0 + "," + source.x0 + ")"; }) .on("click", click); nodeEnter.append("circle") .attr("r", 1e-6) .style("fill", function(d) { return d._children ? "lightsteelblue" : "#fff"; }); nodeEnter.append("text") .attr("x", function(d) { return d.children || d._children ? -13 : 13; }) .attr("dy", ".35em") .attr("text-anchor", function(d) { return d.children || d._children ? "end" : "start"; }) .text(function(d) { return d.name; }) .style("fill-opacity", 1e-6); // Transition nodes to their new position. var nodeUpdate = node.transition() .duration(duration) .attr("transform", function(d) { return "translate(" + d.y + "," + d.x + ")"; }); nodeUpdate.select("circle") .attr("r", 10) .style("fill", function(d) { return d._children ? "lightsteelblue" : "#fff"; }); nodeUpdate.select("text") .style("fill-opacity", 1); // Transition exiting nodes to the parent's new position. var nodeExit = node.exit().transition() .duration(duration) .attr("transform", function(d) { return "translate(" + source.y + "," + source.x + ")"; }) .remove(); nodeExit.select("circle") .attr("r", 1e-6); nodeExit.select("text") .style("fill-opacity", 1e-6); // Update the links… var link = svg.selectAll("path.link") .data(links, function(d) { return d.target.id; }); // Enter any new links at the parent's previous position. link.enter().insert("path", "g") .attr("class", "link") .attr("d", function(d) { var o = {x: source.x0, y: source.y0}; return diagonal({source: o, target: o}); }); // Transition links to their new position. link.transition() .duration(duration) .attr("d", diagonal); // Transition exiting nodes to the parent's new position. link.exit().transition() .duration(duration) .attr("d", function(d) { var o = {x: source.x, y: source.y}; return diagonal({source: o, target: o}); }) .remove(); // Stash the old positions for transition. nodes.forEach(function(d) { d.x0 = d.x; d.y0 = d.y; }); } // Toggle children on click. function click(d) { if (d.children) { d._children = d.children; d.children = null; } else { d.children = d._children; d._children = null; } update(d); } </script>

Clone this wiki locally